]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Allow I18N when using "ng serve"
authorTiago Melo <tmelo@suse.com>
Mon, 7 Oct 2019 17:25:13 +0000 (17:25 +0000)
committerRicardo Dias <rdias@suse.com>
Tue, 15 Oct 2019 10:46:15 +0000 (11:46 +0100)
"ng serve" doesn't support i18n flags, so we need to define all language
specific settings in angular.json.

Then we can use them with the configuration flag, p.e.:
"ng serve --configuration=pt-BR"

We can also use this configurations for non production build, p.e.:
"ng build --configuration=pt-BR"

Set some global options, that will be shared by all configurations.

Signed-off-by: Tiago Melo <tmelo@suse.com>
(cherry picked from commit c6d657980c19641a33f691404e711d372f8ec09e)

src/pybind/mgr/dashboard/frontend/angular.json
src/pybind/mgr/dashboard/frontend/package.json

index 2aa680c1a2e79def814c90aac20bed85915acd78..7347182fa1e21c2b36a068ed709982eb0052b875 100644 (file)
@@ -11,6 +11,9 @@
         "build": {
           "builder": "@angular-devkit/build-angular:browser",
           "options": {
+            "aot": true,
+            "i18nFormat": "xlf",
+            "i18nMissingTranslation": "ignore",
             "outputPath": "dist",
             "index": "src/index.html",
             "main": "src/main.ts",
               "sourceMap": false,
               "extractCss": true,
               "namedChunks": false,
-              "aot": true,
               "extractLicenses": true,
               "vendorChunk": false,
               "buildOptimizer": true,
-              "i18nMissingTranslation": "ignore",
               "fileReplacements": [
                 {
                   "replace": "src/environments/environment.ts",
                   "with": "src/environments/environment.prod.ts"
                 }
               ]
+            },
+            "cs": {
+              "outputPath": "dist/cs/",
+              "i18nFile": "src/locale/messages.cs.xlf",
+              "i18nLocale": "cs"
+            },
+            "de-DE": {
+              "outputPath": "dist/de-DE/",
+              "i18nFile": "src/locale/messages.de-DE.xlf",
+              "i18nLocale": "de-DE"
+            },
+            "en-US": {
+              "outputPath": "dist/en-US/",
+              "i18nFile": "src/locale/messages.en-US.xlf",
+              "i18nLocale": "en-US"
+            },
+            "es-ES": {
+              "outputPath": "dist/es-ES/",
+              "i18nFile": "src/locale/messages.es-ES.xlf",
+              "i18nLocale": "es-ES"
+            },
+            "fr-FR": {
+              "outputPath": "dist/fr-FR/",
+              "i18nFile": "src/locale/messages.fr-FR.xlf",
+              "i18nLocale": "fr-FR"
+            },
+            "id-ID": {
+              "outputPath": "dist/id-ID/",
+              "i18nFile": "src/locale/messages.id-ID.xlf",
+              "i18nLocale": "id-ID"
+            },
+            "it-IT": {
+              "outputPath": "dist/it-IT/",
+              "i18nFile": "src/locale/messages.it-IT.xlf",
+              "i18nLocale": "it-IT"
+            },
+            "ja-JP": {
+              "outputPath": "dist/ja-JP/",
+              "i18nFile": "src/locale/messages.ja-JP.xlf",
+              "i18nLocale": "ja-JP"
+            },
+            "pl-PL": {
+              "outputPath": "dist/pl-PL/",
+              "i18nFile": "src/locale/messages.pl-PL.xlf",
+              "i18nLocale": "pl-PL"
+            },
+            "pt-BR": {
+              "outputPath": "dist/pt-BR/",
+              "i18nFile": "src/locale/messages.pt-BR.xlf",
+              "i18nLocale": "pt-BR"
+            },
+            "zh-CN": {
+              "outputPath": "dist/zh-CN/",
+              "i18nFile": "src/locale/messages.zh-CN.xlf",
+              "i18nLocale": "zh-CN"
+            },
+            "zh-TW": {
+              "outputPath": "dist/zh-TW/",
+              "i18nFile": "src/locale/messages.zh-TW.xlf",
+              "i18nLocale": "zh-TW"
             }
           }
         },
           "configurations": {
             "production": {
               "browserTarget": "ceph-dashboard:build:production"
+            },
+            "cs": {
+              "browserTarget": "ceph-dashboard:build:cs"
+            },
+            "de-DE": {
+              "browserTarget": "ceph-dashboard:build:de-DE"
+            },
+            "en-US": {
+              "browserTarget": "ceph-dashboard:build:en-US"
+            },
+            "es-ES": {
+              "browserTarget": "ceph-dashboard:build:es-ES"
+            },
+            "fr-FR": {
+              "browserTarget": "ceph-dashboard:build:fr-FR"
+            },
+            "id-ID": {
+              "browserTarget": "ceph-dashboard:build:id-ID"
+            },
+            "it-IT": {
+              "browserTarget": "ceph-dashboard:build:it-IT"
+            },
+            "ja-JP": {
+              "browserTarget": "ceph-dashboard:build:ja-JP"
+            },
+            "pl-PL": {
+              "browserTarget": "ceph-dashboard:build:pl-PL"
+            },
+            "pt-BR": {
+              "browserTarget": "ceph-dashboard:build:pt-BR"
+            },
+            "zh-CN": {
+              "browserTarget": "ceph-dashboard:build:zh-CN"
+            },
+            "zh-TW": {
+              "browserTarget": "ceph-dashboard:build:zh-TW"
             }
           }
         },
index 1e510b0d9fe4585dacbc3cea0be68dd69a37ae64..e1f493b24aef1044d2121b2ad7200b6baaadca23 100644 (file)
@@ -9,7 +9,7 @@
     "ng": "ng",
     "start": "npm run env_build && ng serve --host 0.0.0.0",
     "build": "npm run env_build && ng build",
-    "build-i18n": "export _locale=${LOCALE:-$npm_package_config_locale}; [ -f src/locale/messages.${_locale}.xlf ] && npm run build -- --i18nFormat=xlf --outputPath=dist/${_locale} --i18nFile=src/locale/messages.${_locale}.xlf --i18nLocale=${_locale}",
+    "build-i18n": "export _locale=${LOCALE:-$npm_package_config_locale}; [ -f src/locale/messages.${_locale}.xlf ] && npm run build -- --outputPath=dist/${_locale} --i18nFile=src/locale/messages.${_locale}.xlf --i18nLocale=${_locale}",
     "build:en-US": "LOCALE=en-US npm run build-i18n",
     "build:de-DE": "LOCALE=de-DE npm run build-i18n",
     "build:es-ES": "LOCALE=es-ES npm run build-i18n",