Prevent Angular from updating base href with langcode
Posting with my solution, but that kills the new feature of Angular v.9.
The solution is to not use --localize
flag.
So I removed definition:
"i18n": {
"sourceLocale": "de",
"locales": {
"fr": "src/app/locale/messages.fr.xlf",
}
Then I created custom configuration under:
"configurations": {
"fr": {
"i18nFile": "src/app/locale/messages.fr.xlf",
"i18nLocale": "fr",
"outputPath": "dist/fr"
}
And just called:
ng build --configuration=fr
But that is ugly.. so waiting for some better ideas :)
I had the same problem and found the solution in this issue:
https://github.com/angular/angular-cli/issues/17260
You have to write for each locales and for your sourceLocale the baseHref
"i18n": {
"sourceLocale": {
"code": "en",
"baseHref": ""
},
"locales": {
"fr": {
"baseHref": "",
"translation": "src/locale/messages.fr.xlf"
}
}
}
You can override baseHref with this:
"locales": {
"de": {
"translation": "src/locale/messages.de.xlf",
"baseHref": "/"
},
....
}