kjda / ReactJs-Phonegap

A boilerplate ReactJS-Phonegap/Cordova App + Flux data flow

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Internationalization

mschipperheyn opened this issue · comments

This is really great! One thing I would like to see is how to deal with internationalization / multilingual ui.

commented

The App has a language store which is used to offer multilingual functionality.

you can define which languages your app supports in flux/store/lang/*
if you add a new language, you have to include it in flux/store/lang/index.js

you can switch language using:

require('flux/actions/lang').setLocale('en');

For date/time localizatioins
on app start you could check which locale user has, set it in AppState store
One could make simple components for displaying time, dates, day names, etc according to AppState locale

it could look like this

<DateTime value={new Date()} dateOnly={true} />
<DateTime value={new Date()} timeOnly={true} /> 
<DateTime value={new Date()}  /> 

For this, I would recommend using momentjs & moment-timezone