【问题标题】:Using data-i8n with dynamic parms将 data-i8n 与动态参数一起使用
【发布时间】:2013-10-19 21:07:49
【问题描述】:

我可以使用data-18n 没有问题,像这样的 json 属性文件:

<div data-i18n="errIncorrectSpecies"></div>

json 属性文件有这个条目:

"errIncorrectSpecies":"You have selected incorrect species tests."

如何将动态参数放入“errIncorrectSpecies”值?我想在我的 json 文件中这样做:

"errIncorrectSpecies":"You have selected {0} tests for this {1}."

只是不确定如何传入“{0}”和“{1}”...

【问题讨论】:

    标签: jquery json i18next


    【解决方案1】:

    看起来我可以在我的 html 文件中这样做......

    <div>{{i18n('errIncorrectSpecies', {'0':'test','1':'test2'})}}</div>
    

    我将看看是否可以在我的 angular 指令中而不是在 HTML 中以编程方式执行此操作。

    【讨论】:

      猜你喜欢
      • 2023-03-15
      • 2017-02-15
      • 2016-02-25
      • 2016-05-07
      • 2017-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多