[Enhancement] Move localization to redux-saga (#54).

This commit is contained in:
Qolzam
2018-05-10 10:44:10 +07:00
parent 29c9f017ce
commit ef38b086cd
8 changed files with 70 additions and 65 deletions

View File

@@ -4,29 +4,6 @@ import { setActiveLanguage } from 'react-localize-redux'
import { LanguageType } from 'store/reducers/locale/langugeType'
import config from 'src/config'
/**
* Initialize translation
*/
export const initTranslation = () => {
return (dispatch: Function , getState: Function) => {
// - Intialize language
const languages = [
{ name: 'English', code: LanguageType.English },
{ name: 'French', code: LanguageType.French },
{ name: 'Spanish', code: LanguageType.Spanish }
]
dispatch(initialize(languages))
// To set a different default active language set the `defaultLanguage` option.
dispatch(initialize(languages, { defaultLanguage: config.settings.defaultLanguage }))
const englishLocale = require('locale/en.json')
const spanishLocale = require('locale/es.json')
dispatch(addTranslationForLanguage(englishLocale, LanguageType.English))
dispatch(addTranslationForLanguage(spanishLocale, LanguageType.Spanish))
}
}
/**
* Set active language for translation
*/