使用i18n的Angular 6设置默认值

时间:2018-11-11 05:23:07

标签: angular angular6 angular-i18n

这是我的步骤

  1. 更改模板并添加i18n管道

 <h2 class="semi-bold text-white" i18n="@@loginSloganLeft">
          Let Your Brochures Go Digital
</h2>

  1. 运行角度cli

    ng xi18n-输出路径语言环境

  2. 更改angular.json

"production": {
          "fileReplacements": [
            {
              "replace": "src/environments/environment.ts",
              "with": "src/environments/environment.prod.ts"
            }
          ],
          "i18nFile": "src/locale/messages.xlf",
          "i18nFormat": "xlf",
          "i18nLocale": "en",
          "i18nMissingTranslation": "error",

当我运行ng服务器时(使用不带参数的默认生产方式),我看到的是html文本,而不是.xlf文件文本

enter image description here

0 个答案:

没有答案