I have implemented externalization for my angularjs application using https://scotch.io/tutorials/internationalization-of-angularjs-applications
In the same application I have some data, which I am getting from database by creating REST endpoints.
I want to know which is the optimized way for localized the data from database.
Should I create the translation values for the database data in json files like I do for the content in the views?
Should add additional locale values in the database table itself. For example, for each row that i created in english. If i have another locale as French. Then I would create another row in French.
Could you please suggest which is the better way ?
Please let me know if I have not mentioned any detail. I would update the post to clarify that. Thank you.
This depends on which data you have in your database which you want to translate.
But most of the times i think it is a good idea to have several sets of masterdata in the database separated by a locale flag like 'en', 'ru', etc.
I do not think translations of database entries should be done in the client for one simple reason:
Idealy the client should not know anything about the data in the database and should not care about it either - the server should handle this. And the best solution for the server to do so most of the times is to have several entries in the database for each locale.