Angular routing localization with dynamic data

Viewed 27

I have an Angular application and want to add localization with routing. I'll get label data like:

text: {
       de_DE: 'Hallo',
       en_EN: 'Hello'
      }

and I would like to display label:

<span>{{text.[LOCALIZATION_INFO]}}</span>

So I don't have different .json files for different languages.

I think about adding a function to my abstract class to get language info from url. Then I can use it to choose language from my object.

But I don't know it's a correct solution or is there a better approach to implement?

0 Answers
Related