Translation conventions (gettext is a good example)
React context to contain the translated data. In Redux and react-redux this would be handled by through Provider.
Ways to access the context data. These can be individual components digging the data from the context.
In addition, you would need hooks for loading translations as the user changes the language. If you have a user translatable system, that would need extra effort and design. This is possible to pull off, but it's pretty hard as you will need to take this requirement into account at component level.
Existing Packages
You can see the basic ideas in action at the following solutions:
We used it with our own solution that would scan your code for string identifiers, export to a json from the original language, then import it at poeditor.com , fill up other languages you need for those strings, and export different json files for each language. Another batch script would join this into the l18n js format ...
If you're loading from DB, just preload and cache the composite results and inject directly into the spa in a script variable, saving another request. The variable can be used with a number of tools... It may not be worth having in the Redux store, depending on the app and size. The text strings for an app are usually small compared to scripts, but potentially larger than the rest of application state.
Juho Vepsäläinen
SurviveJS
The general idea is that you have:
Provider.In addition, you would need hooks for loading translations as the user changes the language. If you have a user translatable system, that would need extra effort and design. This is possible to pull off, but it's pretty hard as you will need to take this requirement into account at component level.
Existing Packages
You can see the basic ideas in action at the following solutions:
A lot of these packages seem fairly fresh still.