loadTranslations throwing Unable to parse ICU expression exception
See original GitHub issue🐞 bug report
Affected Package
@angular/localize
Is this a regression?
Unsure if this is considered a regression as this is a new feature for me.
Description
When using loadTranslations
from @angular/localize
and providing a translation such as Version <x id="INTERPOLATION" equiv-text="{{ appVersion$ | async }}"/>
, a runtime error occurs.
The xlf file generated by ng xi18n
looks like this:
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en-US" datatype="plaintext" original="ng2.template">
<body>
<trans-unit id="my_id" datatype="html">
<source>Version <x id="INTERPOLATION" equiv-text="{{ appVersion$ | async }}"/></source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/app.component.html</context>
<context context-type="linenumber">1</context>
</context-group>
</trans-unit>
</body>
</file>
</xliff>
🔬 Minimal Reproduction
- Clone https://github.com/s992/i18ntest
ng build --prod
- Serve the files in the
dist/i18ntest
directory (e.g.npx http-server
) - Navigate to http://localhost:8080 (or your port of choice)
- Observe error in console
🔥 Exception or Error
ERROR Error: Unable to parse ICU expression in "Version <x id="INTERPOLATION" equiv-text="{{ appVersion$ | async }}"/>" message.
at main.8831a1ce5c96d40b5885.js:1
at main.8831a1ce5c96d40b5885.js:1
at template (main.8831a1ce5c96d40b5885.js:1)
at Vr (main.8831a1ce5c96d40b5885.js:1)
at Lr (main.8831a1ce5c96d40b5885.js:1)
at as (main.8831a1ce5c96d40b5885.js:1)
at main.8831a1ce5c96d40b5885.js:1
at Lr (main.8831a1ce5c96d40b5885.js:1)
at ri.create (main.8831a1ce5c96d40b5885.js:1)
at t.bootstrap (main.8831a1ce5c96d40b5885.js:1)
🌍 Your Environment
Angular Version: Note that the following is from the minimal repro, issue also occurs in Angular 9.
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 10.0.4
Node: 10.16.3
OS: darwin x64
Angular: 10.0.5
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.1000.4
@angular-devkit/build-angular 0.1000.4
@angular-devkit/build-optimizer 0.1000.4
@angular-devkit/build-webpack 0.1000.4
@angular-devkit/core 10.0.4
@angular-devkit/schematics 10.0.4
@angular/cli 10.0.4
@ngtools/webpack 10.0.4
@schematics/angular 10.0.4
@schematics/update 0.1000.4
rxjs 6.5.5
typescript 3.9.7
webpack 4.43.0
Anything else relevant?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Unable to parse ICU expression. i18n using angular
I have array of left-menu items which I want to convert into other language. I am getting following error here: Unable to parse...
Read more >In-context mode issue with angular interpolation
Which make angular crash with the following error: Unable to parse ICU expression in “crwdns8303:0{{ value }}crwdne8303:0” message.
Read more >Release Notes for Helix Visual Client (P4V) - Perforce Software
On Ubuntu, this package is sometimes either not installed or not installed properly. If libxcb-xinerama0 is not found, P4V will throw an error...
Read more >Diff - platform/frameworks/base - Google Git
String) throws java.lang.SecurityException; method public void setCrossProfileCallerIdDisabled(android.content.ComponentName, boolean); + method public ...
Read more >Angular 버전 변경 리스트 - change log
compiler: normalize line endings in ICU expansions (#36741) (70dd27f), ... core: verify parsed ICU expression at runtime before executing it ...
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
That’s definitely an option. Otherwise you’ll need to start touching our private APIs like https://github.com/angular/angular/blob/master/packages/localize/src/tools/src/translate/translation_files/translation_parsers/xliff1_translation_parser.ts#L40
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.