【问题标题】:Can't combine select and plural in ngx-translate-messageformat-compiler无法在 ngx-translate-messageformat-compiler 中组合选择和复数
【发布时间】:2019-01-24 11:26:17
【问题描述】:

我在我的 Angular 应用程序中使用 ngx-translate-messageformat-compiler。 我在 ngOnInit 中初始化了一个组件属性:

this.translations = { count: this.selections.length, status: this.toStatus };

在我的查找字符串中,我有这样的东西:

"markedThing": "Marked {count} thing{count, plural, =0{s} one{} other{s}} as", "closedSelections": "You've selected {count} thing{count, plural, =0{s} one{} other{s}} to close",

这一切都很好,并尝试来自here 的“选择”示例:

"people": "{gender, select, male{He is} female{She is} other{They are}} {how}", 也可以正常工作。

我的问题是,当我结合选择和复数翻译时,翻译会中断,没有错误,只是应用程序中的字符串保留为它们的“关键”版本(like.this)。

我正在努力的工作是这样的:

"markThing": "Mark thing{count, plural, =0{s} one{} other{s}} as {status, select, UNREAD{unread} READ{read} CLOSED{closed}}",

知道我做错了什么吗?我的模板如下所示:

{{'markThing' | translate:translations}}

【问题讨论】:

    标签: javascript angular angular-pipe ngx-translate angular-i18n


    【解决方案1】:

    对于遇到此问题的任何人,在选择中,需要一个“其他”选项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-06-30
      • 1970-01-01
      • 2018-05-01
      • 1970-01-01
      • 2019-02-04
      • 2018-04-01
      • 2019-03-26
      相关资源
      最近更新 更多