#RewriteCond %{HTTPS} off
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [NE,R,L]
-<Directory "/openils/var/web/eg2">
- FallbackResource /eg2/index.html
+# ------------------------------------------------------------------------
+# /eg2/ client setup and locale configuration.
+#
+# If a valid locale cookie is present that does not match the current
+# path, redirect to the requested locale path.
+# Otherwise, if no locale is active, redirect to the default locale.
+
+# fr-CA
+#RewriteCond %{REQUEST_URI} ^/eg2/
+#RewriteCond %{REQUEST_URI} !^/eg2/fr-CA/
+#RewriteCond %{HTTP_COOKIE} eg_locale=fr_ca
+#RewriteRule ^/eg2/(.*) https://%{HTTP_HOST}/eg2/fr-CA/$1 [R=307,L]
+
+# Default / en-US.
+# No alternate supported cookie provided.
+#RewriteCond %{REQUEST_URI} ^/eg2/
+#RewriteCond %{REQUEST_URI} !^/eg2/([a-z]{2}-[A-Z]{2})/
+#RewriteRule ^/eg2/(.*) https://%{HTTP_HOST}/eg2/en-US/$1 [R=307,L]
+
+# en-US build
+# This is the only required configuration when only using the default locale.
+<Directory "/openils/var/web/eg2/en-US">
+ FallbackResource /eg2/en-US/index.html
</Directory>
+# fr-CA build
+#<Directory "/openils/var/web/eg2/fr-CA">
+# FallbackResource /eg2/fr-CA/index.html
+#</Directory>
ng lint
---------------------------------------------------------------------
+=== OPTIONAL: Building for an alternate locale
+
+* Using fr-CA as an example.
+* An fr-CA configuration is supplied by default.
+* Currently translation builds are only available on --prod build mode.
+* Uncomment the locale lines in eg_vhost.conf and restart apache.
+
+[source,sh]
+---------------------------------------------------------------------
+npm run build-translations
+# Modify some <target> entries in src/locale/messages.fr-CA.xlf to test
+ng build --configuration=production-fr-CA --output-path ../../web/eg2/fr-CA --deploy-url /eg2/fr-CA/ --base-href /eg2/fr-CA
+---------------------------------------------------------------------
+
=== Deploy
Build and install Evergreen code as usual. Restart Evergreen and Apache.
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
- "baseHref": "/eg2",
- "deployUrl": "/eg2/",
- "outputPath": "../../web/eg2",
+ "baseHref": "/eg2/en-US",
+ "deployUrl": "/eg2/en-US/",
+ "outputPath": "../../web/eg2/en-US",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"with": "src/environments/environment.prod.ts"
}
]
+ },
+ "production-fr-CA": {
+ "optimization": true,
+ "outputHashing": "all",
+ "sourceMap": false,
+ "extractCss": true,
+ "namedChunks": false,
+ "aot": true,
+ "extractLicenses": true,
+ "vendorChunk": false,
+ "buildOptimizer": true,
+ "i18nFile": "src/locale/messages.fr-CA.xlf",
+ "i18nFormat": "xlf",
+ "i18nLocale": "fr-CA",
+ "i18nMissingTranslation": "ignore",
+ "fileReplacements": [
+ {
+ "replace": "src/environments/environment.ts",
+ "with": "src/environments/environment.prod.ts"
+ }
+ ]
}
}
},
"test": "npm run create-mock-idl; ng test",
"lint": "ng lint",
"e2e": "ng e2e",
- "create-mock-idl": "cd src/test_data && perl idl2js.pl"
+ "create-mock-idl": "cd src/test_data && perl idl2js.pl",
+ "build-translations": "ng xi18n --output-path locale && xliffmerge fr-CA"
},
"private": true,
"dependencies": {
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-phantomjs-launcher": "^1.0.4",
+ "ngx-i18nsupport": "^0.16.3",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "2.7.2"
+ },
+ "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
}
}