Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function changeLocale(locale: string) {
console.log(locale);
const translationObj = getTranslationObj(locale);
addLocale(locale, translationObj);
useLocale(locale);
}
const { t, ngettext, msgid, addLocale, useLocale } = require('ttag');
const locale = process.env.LOCALE;
if (locale) {
const translationObj = require(`./${locale}.po.json`);
addLocale(locale, translationObj);
useLocale(locale);
}
function startCount(n) {
console.log(t`starting count up to ${n}`);
for (let i = 0; i <= n; i++) {
console.log(ngettext(msgid`${i} tick passed`, `${i} ticks passed`, i));
}
}
startCount(3);
import { addLocale, useLocale } from 'ttag';
if (process.env.NODE_ENV !== 'production') {
const ukLocale = require('./uk.po');
addLocale('uk', ukLocale);
useLocale('uk');
}