mjschranz
mjschranz

Reputation: 96

How to specify custom translation ID when using $localize

I'm upgrading my application from Angular 8 to Angular 10 and previously made use of the https://github.com/ngx-translate/i18n-polyfill library to help with translations inside our typescript files.

We are upgrading to v10.1.0 which should support extraction of these strings from our components (which appears to be working just fine). However I can't seem to find documentation on how to specify custom IDs for each string inside the components themselves.

The previous polyfill library specified this format $localize:meaning|description@@id:message but it isn't working. An example usage by myself would be $localize@@CUSTOM_ID:String message`.

Instead the entire string @@CUSTOM_ID:String message gets set with a random ID.

Any help?

Upvotes: 3

Views: 1001

Answers (1)

mjschranz
mjschranz

Reputation: 96

Found the answer in a previous $localize question. Turns out you just need to separate each section with semi-colons.

To take my previous example, :@@CUSTOM_UD:string message.

Upvotes: 3

Related Questions