I have a Web API application that needs to support localization for multiple languages, and I want to know which approach would be most suited.
For simplicity, if I have a collection of books in the database, and the titles need to be translated into different languages and return to the user, is any of the following good for the need?
- Store the default language (english) title in the database. Store the translated titles in resource files. Then, when the user requests the Web API for (chinese) title, I will perform the following steps:
- Pull the default english book title by Id
- Use the english book title as key, pull the translated value from chinese.resx resource file
- Return the translated value
- Store both default language and translated titles in the database but separate tables. Pull the translated table as a relationship and return the titles to user.
I am leaning toward #1 as I have done #2 before and it was not that easy to maintain translated text for me in database. But I am not sure if there is any downside in implementing #1. Or is there any other approach to this? Thanks