Repository navigation
Closed
Description
🐞 Bug report
Command (mark with an x)
- build
- xi18n
Is this a regression?
No, I think it has always happened, but no one noticed or tried this.
Description
Trying to localize the app, but index.html is not a component, so i18n directive doesn't work in it, trying to generate different index files for each locale works ok when built with --configuration=es-CO but not when using --localize to build all locales at once.
🔬 Minimal Reproduction
Repro repo: https://github.com/luchillo17/angular-issue17684-repro
Steps:
- Install and run
npm run build:es-CO. - Note that the build's
dist/angular-issue17684-repro/es-CO/index.htmlwill have the Spanish title fromsrc/index.es-CO.html. - Now run
npm run build:localize. - Note that the build's
dist/angular-issue17684-repro/es-CO/index.htmlwill have the English title fromsrc/index.htmlinstead ofsrc/index.es-CO.html.
🔥 Exception or Error
No error, just using the default index.html, instead of the configured one.
🌍 Your Environment
Angular CLI: 9.1.5
Node: 12.12.0
OS: win32 x64
Angular: 9.1.6
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.901.5
@angular-devkit/build-angular 0.901.5
@angular-devkit/build-optimizer 0.901.5
@angular-devkit/build-webpack 0.901.5
@angular-devkit/core 9.1.5
@angular-devkit/schematics 9.1.5
@angular/cdk 9.2.3
@angular/cli 9.1.5
@angular/material 9.2.3
@ngtools/webpack 9.1.5
@schematics/angular 9.1.5
@schematics/update 0.901.5
rxjs 6.5.5
typescript 3.8.3
webpack 4.42.0
Anything else relevant?
I'm guessing it has to do with how --localize works, maybe it's caching the source locale's index.html and reusing it in all the other locales.
Reacted by Carlos Esteban Lopez Jaramillo
Metadata
Metadata
Assignees
Labels
No labels
Activity
alan-agius4 commentedon May 11, 2020
Hi @luchillo17, this is expected and currently working as intended.
Localization only works for JS files and component templates which
index.htmlis not.When using the
--localize, your JS bundles will be translated in all the locales configured and the configuredindex.htmlfor that build is used, aka the english version ofindex.html.The index is "translated" when you are using
--configuration=es-CObecause in thees-COconfiguration, you are replacing theindex.htmlinput file with a different one, which contains the translations. It's important to note thates-COconfiguration is not linked with--localizefunctionality. It is just a string used as a configuration identity and it can anything.Let's continue tracking this in #8947
angular-automatic-lock-bot commentedon Jun 11, 2020
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.