question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

  1. Clone https://github.com/s992/i18ntest
  2. ng build --prod
  3. Serve the files in the dist/i18ntest directory (e.g. npx http-server)
  4. Navigate to http://localhost:8080 (or your port of choice)
  5. 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:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
petebacondarwincommented, Jul 27, 2020
0reactions
angular-automatic-lock-bot[bot]commented, Aug 27, 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found