Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular Ivy i18n: No translation found for <ID>

I've updated an existing Angular application that uses i18n to version 9. After doing this, it throws errors during build that it cannot find my translations:

No translation found for "6570363013146073520" ("Dashboard")

I noted that the ID provided above does not exist in my messages.xlf files and looks to be in a totally different format.

Here's what it looked like before Angular 9:

<trans-unit id="f65253954b66e929a8b4d5ecaf61f9129f8cec64" datatype="html">
  <source>Dashboard</source>
  <target state="final">The translated string</target>
</trans-unit>

I found this on Github that talks about the problem, but I don't understand how it's fixed. How do I tell Angular to use the "legacy format" that they are talking about in that issue?

Or is there another solution to this?

like image 266
Glenn Utter Avatar asked Nov 20 '25 10:11

Glenn Utter


1 Answers

I know this is an old question, but I found a way to pass the error, you need to give id like this :

<h1 i18n="@@anyId">
  I don&apos;t output any element
</h1> 

instead of i18n="ba0cc104d3d69bf669f97b8d96a4c5d8d9559aa3", then in your .xlf file you need to use like this:

<trans-unit id="anyId" datatype="html">
   <source>I don&apos;t output any element</source>
   <target>Je n'affiche aucun élément</target>
   <context-group purpose="location">
      <context context-type="sourcefile">app\app.component.ts</context>
      <context context-type="linenumber">10</context>
   </context-group>
</trans-unit>

well by this, error will be vanished.

like image 65
Ali Eshghi Avatar answered Nov 22 '25 01:11

Ali Eshghi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!