ID generated by xi18n command does not match ID generated at run time
See original GitHub issueπ Bug report
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- xi18n
- run
- config
- help
- version
- doc
Is this a regression?
Not sureDescription
string ID generated by using "ng xi18n --ivy --format=xlf" dont match ID at runtime. Im getting `localize.js:392 No translation found for ...`π¬ Minimal Reproduction
- Say add
<custom-element i18n-label label="Your details must match your government issued ID"></custom-element>
in your template - Run
ng xi18n --ivy --format=xlf
command - in your main.ts add
loadTranslations({<key from xlf file>:<string vlaue>})
- run it with βng serveβ
π₯ Exception or Error
In the console I see `localize.js:392 localize.js:392 No translation found for "4775231765644062609" ("Your details must match your government issued ID") warning. By comparison ID for that string in the xlf file was "bf882f6f9243369463e44749b2780c253ddce34a"
π Your Environment
Angular CLI: 10.1.1
Node: 10.15.3
OS: darwin x64
Angular: 10.1.4
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.901.12
@angular-devkit/build-angular 0.1001.4
@angular-devkit/build-ng-packagr 0.1001.4
@angular-devkit/build-optimizer 0.1001.4
@angular-devkit/build-webpack 0.1001.4
@angular-devkit/core 7.3.10
@angular-devkit/schematics 7.3.10
@angular/cdk 10.2.3
@angular/cli 10.1.1
@angular/flex-layout 10.0.0-beta.32
@angular/google-maps 10.2.3
@angular/material 10.2.3
@ngtools/webpack 10.1.4
@schematics/angular 8.3.23
@schematics/update 0.1001.1
ng-packagr 10.1.2
rxjs 6.6.3
typescript 3.9.7
webpack 4.44.1
Anything else relevant?
I also noticed that IDs generated from templates vs from $localize in TS files have different length. Here is ID from $localize: 4998556035340110929 and here is from template 47c477a6e7959ffde7a0ab247ec1c88468d5e101. Looks like ones from templates is hexadecimal where from $localize are numbers only. And template IDs twice longer.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
angular 10 translation strings IDs dont match - Stack Overflow
Any idea why runtime ID for the same string different from one generated by xi18n? Much appreciate help. angular Β· localization Β· angular10....
Read more >add an option for xi18n tool to detect Inconsistency for ID content
With angular i18n, If the same message ID is used in several ... the same ID, does not contain the same message, and...
Read more >ng extract-i18n - Angular
Option Description Default Value
ββformat Output format for the generated file. xlf
ββoutβfile Name of the file to output.
ββoutputβpath Path where output will be placed....
Read more >Localizing your app - Angular Hispano
The ng xi18n command (with no options) generates a source language file named messages.xlf in the project src folder. Create translation files for...
Read more >Internationalization with @angular/localize | Ninja Squad
The error is self-explanatory: as the i18n attributes are now converted to $localize calls in the generated code, we need to load the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For reference, I think the line that needs to change to support legacy message ids in Ivy JIT mode is https://github.com/angular/angular/blob/d795a001375a7d06592450d6f57a4f05d4d3e8e9/packages/compiler/src/render3/view/i18n/meta.ts#L55
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.