LP1821067 Angular i18n uses XMB; cs-CZ examples
authorBill Erickson <berickxx@gmail.com>
Wed, 20 Mar 2019 18:38:44 +0000 (14:38 -0400)
committerDan Wells <dbw2@calvin.edu>
Tue, 26 Mar 2019 15:53:44 +0000 (11:53 -0400)
Includes documentation updates and cs-CZ example using export cs-CZ .xtb
translation bundle.

Also remove xmliffmerge configuration options since we are not using
xliff files.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Dan Wells <dbw2@calvin.edu>

Open-ILS/src/eg2/CHEAT_SHEET.adoc
Open-ILS/src/eg2/angular.json
Open-ILS/src/eg2/package.json
Open-ILS/src/eg2/src/environments/environment.prod.ts

index 84f4e5d..2b90def 100644 (file)
@@ -14,18 +14,31 @@ ng build --prod     # compile production mode
 
 == OPTIONAL: Adding a Locale 
 
-* Using fr-CA as an example.
-* An fr-CA configuration is supplied by default.  Additional configs
+* Using cs-CZ as an example.
+* A cs-CZ configuration is supplied by default.  Additional configs
   must be added where needed.
 * Currently translation builds are only available on --prod build mode.
 * Uncomment the locale lines in eg_vhost.conf and restart apache.
 * TODO: expand docs on package.json file changes required to add locales.
 
+=== Exporting Source Strings
+
 [source,sh]
 ---------------------------------------------------------------------
 npm run export-strings
-npm run merge-strings -- fr-CA
-# APPLY TRANSLATIONS TO src/locale/messages.fr-CA.xlf
-npm run build-fr-CA # modify package.json for other locales
+---------------------------------------------------------------------
+
+* Then upload the messages.xmb file to the translation service
+
+=== Import and Build the Translation
+
+1. Edit the "locales" array ./src/environments/environment.prod.ts to 
+   include cs-CZ.
+2. Export translations as ".XTB" files from translation service.
+3. Put the file in src/locale/messages.cs-CZ.xtb
+4. Build the application for the selected locale by running:
+[source,sh]
+---------------------------------------------------------------------
+npm run build-cs-CZ
 ---------------------------------------------------------------------
 
index e50c8db..ee7329d 100644 (file)
@@ -45,7 +45,7 @@
                 }
               ]
             },
-            "production-fr-CA": {
+            "production-cs-CZ": {
               "optimization": true,
               "outputHashing": "all",
               "sourceMap": false,
@@ -55,9 +55,9 @@
               "extractLicenses": true,
               "vendorChunk": false,
               "buildOptimizer": true,
-              "i18nFile": "src/locale/messages.fr-CA.xlf",
-              "i18nFormat": "xlf",
-              "i18nLocale": "fr-CA",
+              "i18nFile": "src/locale/messages.cs-CZ.xtb",
+              "i18nFormat": "xtb",
+              "i18nLocale": "cs-CZ",
               "i18nMissingTranslation": "ignore",
               "fileReplacements": [
                 {
index 0c57e46..0da3579 100644 (file)
@@ -9,9 +9,8 @@
     "lint": "ng lint",
     "e2e": "ng e2e",
     "create-mock-idl": "cd src/test_data && perl idl2js.pl",
-    "export-strings": "ng xi18n --output-path locale",
-    "merge-strings": "xliffmerge",
-    "build-fr-CA": "ng build --configuration=production-fr-CA --output-path ../../web/eg2/fr-CA --deploy-url /eg2/fr-CA/ --base-href /eg2/fr-CA; sed -i s/IDL2js\\\"/IDL2js?locale=fr-CA\\\"/g ../../web/eg2/fr-CA/index.html; sed -i s/lang=\\\"en\\\"/lang=\\\"fr\\\"/g ../../web/eg2/fr-CA/index.html"
+    "export-strings": "ng xi18n --output-path locale --i18n-format xmb",
+    "build-cs-CZ": "ng build --configuration=production-cs-CZ --output-path ../../web/eg2/cs-CZ --deploy-url /eg2/cs-CZ/ --base-href /eg2/cs-CZ; sed -i s/IDL2js\\\"/IDL2js?locale=cs-CZ\\\"/g ../../web/eg2/cs-CZ/index.html; sed -i s/lang=\\\"en\\\"/lang=\\\"cs\\\"/g ../../web/eg2/cs-CZ/index.html"
   },
   "private": true,
   "dependencies": {
     "ts-node": "~5.0.1",
     "tslint": "~5.9.1",
     "typescript": "~3.1.6"
-  },
-  "xliffmergeOptions": {
-    "srcDir": "src/locale",
-    "genDir": "src/locale",
-    "i18nFile": "messages.xlf",
-    "i18nBaseFile": "messages",
-    "i18nFormat": "xlf",
-    "encoding": "UTF-8",
-    "defaultLanguage": "en",
-    "languages": [
-      "en",
-      "fr-CA"
-    ],
-    "removeUnusedIds": true,
-    "supportNgxTranslate": false,
-    "ngxTranslateExtractionPattern": "@@|ngx-translate",
-    "useSourceAsTarget": true,
-    "targetPraefix": "",
-    "targetSuffix": "",
-    "beautifyOutput": false,
-    "allowIdChange": false,
-    "autotranslate": false,
-    "apikey": "",
-    "apikeyfile": "",
-    "verbose": false,
-    "quiet": false
   }
 }
index df78657..d7953f9 100644 (file)
@@ -1,5 +1,6 @@
 export const environment = {
   production: true,
-  // locales: ['en-US', 'fr-CA']
+  // TODO: a way to pass these in at build time.
+  // locales: ['en-US', 'fr-CA', 'cs-CZ']
   locales: ['en-US']
 };