我在一个像这样的Range7项目中使用i18n:
<a *ngIf="!last" [routerLink]="[item.url]" i18n="Breadcrumbs@@breadcrumb-label"> {item.label, select, projects {Projekte} new {Neu}}</a>到目前为止这还不错。较低级别的面包屑显示一个不能翻译的name属性。当item.label是项目或新项目时,我如何翻译它,如果不是的话,如何翻译它呢?
我试过了
{item.label, select, projects {Projekte} new {Neu} other {item.label}}和
{item.label, select, projects {Projekte} new {Neu} other item.label}但很明显他们两个人都没有用。
发布于 2019-03-11 12:48:50
我通过使用单独的模板来解决这个问题:
<ng-container *ngTemplateOutlet="isFixedLabel(item.label) ? fixed : other; context: { item: item }"></ng-container>
<ng-template #fixed i18n="Breadcrumbs@@breadcrumb-label" let-item="item"> {item.label, select, projects {Projekte} new {Neu}}</ng-template>
<ng-template #other let-item="item">{{ item.label }}</ng-template>https://stackoverflow.com/questions/55066462
复制相似问题