Reputation: 4070
I was developing a simple site with multilingual function. My stack was AngularJS + JSON, basically a JSON file with different context in different languages.
Then I started to think if it is indeed a better solution in terms of performance to parse simple text from JSON and substitute text content variable values on the fly versus just creating a simple .html page for one language and another .html page for another language with text inside the html pre filled and then just using angular to change those pages by using route.
I would gladly hear out any thoughts about which method to use, or maybe you have a suggestion for a totally different approach in order to optimise the loading and rendering time of a page.
Thanks in advance for your time!
Upvotes: 0
Views: 54
Reputation: 2330
It is always better to use JSON files for the same. You can use i18n library for the multilingual purpose. With this you will be having multiple JSON's for each language and a single .html file. i18n will handle the language switching, there is no need to create route for each language. If you need to accommodate more languages in future, that can be achieved easily. Please refer the below link for more details.
https://angular-translate.github.io/
Upvotes: 1