I would like to create a multilingual application with React.
As I see it, this will have a js file for each language, for example:
en.js:
module.exports = {
langEnglish: 'English',
langFrench: 'French',
navHome: 'Home',
navUsers: 'Users',
...
};
fr.js:
module.exports = {
langEnglish: 'Anglais',
langFrench: 'FranΓ§ais',
navHome: 'Accueil',
navUsers: 'Utilisateurs',
...
};
Since each language file will be quite large and dozens of different languages ββcan be supported, I would prefer to download only the correct file for use depending on the selected language, in order to minimize download time (and bandwidth usage).
For example, I could have a variable in application state
var App = React.createClass({
getInitialState: function () {
return {
lang: 'en'
};
},
...
and some user control to switch this variable between frand en.
en.js , , fr.js .. ?