Skip to content

Instantly share code, notes, and snippets.

@derzunov
Last active November 10, 2016 19:28
Show Gist options
  • Save derzunov/e8eb5aa8d8240f19796ab874a7c5bb08 to your computer and use it in GitHub Desktop.
Save derzunov/e8eb5aa8d8240f19796ab874a7c5bb08 to your computer and use it in GitHub Desktop.
// Full example code see here - https://github.com/derzunov/redux-react-i18n/tree/master/example
import { i18nActions, i18nReducer, Loc } from 'redux-react-i18n';
//...
// Code Code Code ...
//...
store.dispatch( i18nActions.setLanguages(
[
{
code: 'ru-RU',
name: 'Русский'
},
{
code: 'pl',
name: 'Polish'
}
]
) );
store.dispatch( i18nActions.setDictionaries(
{
'ru-RU':
{
'key_1': 'Первый дефолтный ключ из установленного нами словаря',
'key_2': [ [ "Остался", "Осталось", "Осталось" ], " ", "$count", " ", [ "час", "часа", "часов" ] ],
'key_3': 'Просто число после двоеточия: $Count'
},
'pl':
{
'key_1': 'Prosze, dwa bilety drugiej klasy do Warszawy.',
'key_2': [[ "Pozostała", "Pozostały", "Pozostało" ], " ", "$count", " ", [ "godzina", "godziny", "godzin" ] ],
'key_3': 'Numer: $Count'
}
}
) );
store.dispatch( i18nActions.setCurrent( 'ru-RU' ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment