首页 > 解决方案 > ng2 i18n:在模板中使用 NOT 英语作为默认语言

问题描述

我正在为讲俄语的人开发应用程序。英语语言环境是“备份”。所以我想在我的模板中看到俄语单词,以便更容易理解。LOCALE_ID它工作正常,但如果我不在模块设置中提供,注入总是“en-US”。或者如果我提供它总是'ru',不管--configuration国旗

是否可以将默认语言设置为非英语?

我的angular.json样子

"build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
             ...
            "i18nLocale": "ru",
          },
          "configurations": {
              "en": {
                  "i18nFile": "app/assets/i18n/messages.en.xlf",
                  "i18nFormat": "xlf",
                  "i18nLocale": "en",
                  "i18nMissingTranslation": "error"
              }
         }

ng serve my-app --configuration en为英语和俄语 提供应用程序ng serve my-app

标签: angularangular-i18n

解决方案


推荐阅读