Only use basehref

Will allow us to use the localize option
pull/2460/head
Chocobozzz 2020-02-12 11:34:34 +01:00
parent 3f87a46f1d
commit 8cc56c7fdd
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 37 additions and 27 deletions

View File

@ -8,99 +8,102 @@
"sourceRoot": "src", "sourceRoot": "src",
"projectType": "application", "projectType": "application",
"i18n": { "i18n": {
"sourceLocale": "en", "sourceLocale": {
"code": "en",
"baseHref": "/client/en-US/"
},
"locales": { "locales": {
"hu": { "hu": {
"translation": "src/locale/angular.hu-HU.xlf", "translation": "src/locale/angular.hu-HU.xlf",
"baseHref": "/" "baseHref": "/client/hu-HU/"
}, },
"th": { "th": {
"translation": "src/locale/angular.th-TH.xlf", "translation": "src/locale/angular.th-TH.xlf",
"baseHref": "/" "baseHref": "/client/th-TH/"
}, },
"fi": { "fi": {
"translation": "src/locale/angular.fi-FI.xlf", "translation": "src/locale/angular.fi-FI.xlf",
"baseHref": "/" "baseHref": "/client/fi-FI/"
}, },
"nl": { "nl": {
"translation": "src/locale/angular.nl-NL.xlf", "translation": "src/locale/angular.nl-NL.xlf",
"baseHref": "/" "baseHref": "/client/nl-NL/"
}, },
"gd": { "gd": {
"translation": "src/locale/angular.gd.xlf", "translation": "src/locale/angular.gd.xlf",
"baseHref": "/" "baseHref": "/client/gd/"
}, },
"el": { "el": {
"translation": "src/locale/angular.el-GR.xlf", "translation": "src/locale/angular.el-GR.xlf",
"baseHref": "/" "baseHref": "/client/el-GR/"
}, },
"es": { "es": {
"translation": "src/locale/angular.es-ES.xlf", "translation": "src/locale/angular.es-ES.xlf",
"baseHref": "/" "baseHref": "/client/es-ES/"
}, },
"oc": { "oc": {
"translation": "src/locale/angular.oc.xlf", "translation": "src/locale/angular.oc.xlf",
"baseHref": "/" "baseHref": "/client/oc/"
}, },
"pt": { "pt": {
"translation": "src/locale/angular.pt-BR.xlf", "translation": "src/locale/angular.pt-BR.xlf",
"baseHref": "/" "baseHref": "/client/pt-BR/"
}, },
"pt-PT": { "pt-PT": {
"translation": "src/locale/angular.pt-PT.xlf", "translation": "src/locale/angular.pt-PT.xlf",
"baseHref": "/" "baseHref": "/client/pt-PT/"
}, },
"sv": { "sv": {
"translation": "src/locale/angular.sv-SE.xlf", "translation": "src/locale/angular.sv-SE.xlf",
"baseHref": "/" "baseHref": "/client/sv-SE/"
}, },
"pl": { "pl": {
"translation": "src/locale/angular.pl-PL.xlf", "translation": "src/locale/angular.pl-PL.xlf",
"baseHref": "/" "baseHref": "/client/pl-PL/"
}, },
"ru": { "ru": {
"translation": "src/locale/angular.ru-RU.xlf", "translation": "src/locale/angular.ru-RU.xlf",
"baseHref": "/" "baseHref": "/client/ru-RU/"
}, },
"zh-Hans": { "zh-Hans": {
"translation": "src/locale/angular.zh-Hans-CN.xlf", "translation": "src/locale/angular.zh-Hans-CN.xlf",
"baseHref": "/" "baseHref": "/client/zh-Hans-CN/"
}, },
"zh-Hant": { "zh-Hant": {
"translation": "src/locale/angular.zh-Hant-TW.xlf", "translation": "src/locale/angular.zh-Hant-TW.xlf",
"baseHref": "/" "baseHref": "/client/zh-Hant-TW/"
}, },
"fr": { "fr": {
"translation": "src/locale/angular.fr-FR.xlf", "translation": "src/locale/angular.fr-FR.xlf",
"baseHref": "/" "baseHref": "/client/fr-FR/"
}, },
"ja": { "ja": {
"translation": "src/locale/angular.ja-JP.xlf", "translation": "src/locale/angular.ja-JP.xlf",
"baseHref": "/" "baseHref": "/client/ja-JP/"
}, },
"eu": { "eu": {
"translation": "src/locale/angular.eu-ES.xlf", "translation": "src/locale/angular.eu-ES.xlf",
"baseHref": "/" "baseHref": "/client/eu-ES/"
}, },
"ca": { "ca": {
"translation": "src/locale/angular.ca-ES.xlf", "translation": "src/locale/angular.ca-ES.xlf",
"baseHref": "/" "baseHref": "/client/ca-ES/"
}, },
"cs": { "cs": {
"translation": "src/locale/angular.cs-CZ.xlf", "translation": "src/locale/angular.cs-CZ.xlf",
"baseHref": "/" "baseHref": "/client/cs-CZ/"
}, },
"eo": { "eo": {
"translation": "src/locale/angular.eo.xlf", "translation": "src/locale/angular.eo.xlf",
"baseHref": "/" "baseHref": "/client/eo/"
}, },
"de": { "de": {
"translation": "src/locale/angular.de-DE.xlf", "translation": "src/locale/angular.de-DE.xlf",
"baseHref": "/" "baseHref": "/client/de-DE/"
}, },
"it": { "it": {
"translation": "src/locale/angular.it-IT.xlf", "translation": "src/locale/angular.it-IT.xlf",
"baseHref": "/" "baseHref": "/client/it-IT/"
} }
} }
}, },

View File

@ -18,6 +18,7 @@ import { SearchModule } from '@app/search'
import { WelcomeModalComponent } from '@app/modal/welcome-modal.component' import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component' import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component'
import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models' import { buildFileLocale, getCompleteLocale, isDefaultLocale } from '@shared/models'
import { APP_BASE_HREF } from '@angular/common'
export function metaFactory (serverService: ServerService): MetaLoader { export function metaFactory (serverService: ServerService): MetaLoader {
return new MetaStaticLoader({ return new MetaStaticLoader({
@ -67,6 +68,11 @@ export function metaFactory (serverService: ServerService): MetaLoader {
], ],
providers: [ providers: [
{
provide: APP_BASE_HREF,
useValue: '/'
},
{ {
provide: TRANSLATIONS, provide: TRANSLATIONS,
useFactory: (locale: string) => { useFactory: (locale: string) => {

View File

@ -76,10 +76,11 @@ if [ -z ${1+x} ] || [ "$1" != "--light" ]; then
# TODO: remove when the project will use runtime translations # TODO: remove when the project will use runtime translations
pre_build_hook "$lang" 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" if [ ! "$lang" = "$key" ]; then
rmdir "dist/build" mv "dist/$key" "dist/$lang"
fi
# Do not duplicate assets # Do not duplicate assets
rm -r "./dist/$lang/assets" rm -r "./dist/$lang/assets"