== 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
---------------------------------------------------------------------
}
]
},
- "production-fr-CA": {
+ "production-cs-CZ": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"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": [
{
"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
}
}
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']
};