I'm working on a Scala Play 2.7 project and have a use-case for saving in the database data that needs i18n.
I have two design choices:
en
as part of the key and do so for every supported language.Downsides are e.g. for choice #1 the database needs to be updated for every new language supported; for choice #2 queries to the database need to be "decorated" looking up the corresponding translation for each key in messages.x
I would go with a 3rd option, store the translation key with the arguments required to render the message, it's up to you how to store those, it could be an array or a JSON.
The database is updated only once per message, adding new languages only requires to update the messages
files, and for rendering a message, you only need to do a single query which you would have done anyway, it just retrieves a bit more data.