【问题标题】:HTML/JSON: Translate placeholder depending on localeHTML/JSON:根据语言环境翻译占位符
【发布时间】:2017-08-09 15:50:19
【问题描述】:

我有一个带有翻译的 JSON 文件。我特别有一个名为Select_Time_Format 的属性。我想在 HTML 字段的占位符属性中使用此翻译(见下文)

      <label for="time-format" i18ng="'Time_Format'"></label>
      <div class="select2-container select x100" id="s2id4">
        <select ngyn-select2
                ng-model="$ctrl.tournament.time_format"
                ng-options="key as label for (key, label) in $ctrl.timeFormats"
                id="time-format"
                name="time_format"
                class="select x100"
                placeholder="Select Time Format">
        </select>

有没有办法用i18ng="'Select_Time_Format'"之类的东西替换placeholder="Select Time Format

【问题讨论】:

    标签: html json locale translation


    【解决方案1】:

    原来正确的语法如下。

    placeholder="{{ 'Whatever_Your_Translation_Name_Is' | t }}"

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-08-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-06
      相关资源
      最近更新 更多