Only use basehref
authorChocobozzz <me@florianbigard.com>
Wed, 12 Feb 2020 10:34:34 +0000 (11:34 +0100)
committerChocobozzz <me@florianbigard.com>
Wed, 12 Feb 2020 13:09:55 +0000 (14:09 +0100)
Will allow us to use the localize option

client/angular.json
client/src/app/app.module.ts
scripts/build/client.sh

index bf3a860aaaa28242feed352b0351b84afed56629..d9cee9bac6d826265049a2dedaf573c334d7166d 100644 (file)
       "sourceRoot": "src",
       "projectType": "application",
       "i18n": {
-        "sourceLocale": "en",
+        "sourceLocale": {
+          "code": "en",
+          "baseHref": "/client/en-US/"
+        },
         "locales": {
           "hu": {
             "translation": "src/locale/angular.hu-HU.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/hu-HU/"
           },
           "th": {
             "translation": "src/locale/angular.th-TH.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/th-TH/"
           },
           "fi": {
             "translation": "src/locale/angular.fi-FI.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/fi-FI/"
           },
           "nl": {
             "translation": "src/locale/angular.nl-NL.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/nl-NL/"
           },
           "gd": {
             "translation": "src/locale/angular.gd.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/gd/"
           },
           "el": {
             "translation": "src/locale/angular.el-GR.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/el-GR/"
           },
           "es": {
             "translation": "src/locale/angular.es-ES.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/es-ES/"
           },
           "oc": {
             "translation": "src/locale/angular.oc.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/oc/"
           },
           "pt": {
             "translation": "src/locale/angular.pt-BR.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/pt-BR/"
           },
           "pt-PT": {
             "translation": "src/locale/angular.pt-PT.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/pt-PT/"
           },
           "sv": {
             "translation": "src/locale/angular.sv-SE.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/sv-SE/"
           },
           "pl": {
             "translation": "src/locale/angular.pl-PL.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/pl-PL/"
           },
           "ru": {
             "translation": "src/locale/angular.ru-RU.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/ru-RU/"
           },
           "zh-Hans": {
             "translation": "src/locale/angular.zh-Hans-CN.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/zh-Hans-CN/"
           },
           "zh-Hant": {
             "translation": "src/locale/angular.zh-Hant-TW.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/zh-Hant-TW/"
           },
           "fr": {
             "translation": "src/locale/angular.fr-FR.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/fr-FR/"
           },
           "ja": {
             "translation": "src/locale/angular.ja-JP.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/ja-JP/"
           },
           "eu": {
             "translation": "src/locale/angular.eu-ES.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/eu-ES/"
           },
           "ca": {
             "translation": "src/locale/angular.ca-ES.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/ca-ES/"
           },
           "cs": {
             "translation": "src/locale/angular.cs-CZ.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/cs-CZ/"
           },
           "eo": {
             "translation": "src/locale/angular.eo.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/eo/"
           },
           "de": {
             "translation": "src/locale/angular.de-DE.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/de-DE/"
           },
           "it": {
             "translation": "src/locale/angular.it-IT.xlf",
-            "baseHref": "/"
+            "baseHref": "/client/it-IT/"
           }
         }
       },
index 14fdb7588b9a3996e6e7b7fe090ca65f25379c7d..d11dba34d3febf4150b5bca3e1af1f3116835949 100644 (file)
@@ -18,6 +18,7 @@ import { SearchModule } from '@app/search'
 import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
 import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component'
 import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models'
+import { APP_BASE_HREF } from '@angular/common'
 
 export function metaFactory (serverService: ServerService): MetaLoader {
   return new MetaStaticLoader({
@@ -67,6 +68,11 @@ export function metaFactory (serverService: ServerService): MetaLoader {
   ],
 
   providers: [
+    {
+      provide: APP_BASE_HREF,
+      useValue: '/'
+    },
+
     {
       provide: TRANSLATIONS,
       useFactory: (locale: string) => {
index 99394838aa3bd578c3a9585754fd7b884c72e9cd..aa3f89c03324789798bbd7f9713a902bc3dc2d58 100755 (executable)
@@ -76,10 +76,11 @@ if [ -z ${1+x} ] || [ "$1" != "--light" ]; then
         # TODO: remove when the project will use runtime translations
         pre_build_hook "$lang"
 
-        npm run ng build --  --output-path "dist/build" --deploy-url "/client/$lang/" --prod --configuration="$lang"
+        npm run ng build -- --prod --configuration="$lang"
 
-        mv "dist/build/$key" "dist/$lang"
-        rmdir "dist/build"
+        if [ ! "$lang" = "$key" ]; then
+          mv "dist/$key" "dist/$lang"
+        fi
 
         # Do not duplicate assets
         rm -r "./dist/$lang/assets"