Created
November 17, 2018 22:52
-
-
Save AlexMost/d04a857b346cd9f9387639a552aa008a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { addLocale, useLocale } from 'ttag'; | |
const locale = getLocale(); // fetch locale code from cookies, url, localStorage e.t.c | |
if (locale !== 'en') { | |
// load json file with translations | |
const translationsObj = require(`../i18n/${locale}.po.json`); | |
addLocale(locale, translationsObj); | |
useLocale(locale); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment