Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function loadLocalizationFromPOFile(locale, poFileContent) {
const localization = gettextParser.po.parse(poFileContent);
// addLocale(locale, removeEmptyTranslations(localization));
addLocale(locale, localization);
return localization;
}
export function addTranslationsToTTag(translations: Translations[]) {
const localesToUse: Locale[] = [];
// register with ttag
for (const t of translations) {
const locale = localeFromString(t.headers.language);
addLocale(locale.string, t);
localesToUse.push(locale);
}
console.log('Available locales:', localesToUse.map(l => l.string));
// set locale in ttag
useLocales(localesToUse.map(locale => locale.string));
// update active locales
// we need to modify the actual array content, so that all imported references get the changes
currentLocales.splice(0, currentLocales.length);
currentLocales.push(...localesToUse);
}
export function addTranslationsToTTag(translations: Translations[]) {
const localesToUse: Locale[] = [];
// register with ttag
for (const t of translations) {
const locale = localeFromString(t.headers.language);
addLocale(locale.string, t);
localesToUse.push(locale);
}
console.log('Available locales:', localesToUse.map(l => l.string));
// set locale in ttag
useLocales(localesToUse.map(locale => locale.string));
// update active locales
// we need to modify the actual array content, so that all imported references get the changes
currentLocales.splice(0, currentLocales.length);
currentLocales.push(...localesToUse);
}
if (showNonCollection[section.id]) {
// Already pressed it, so show a button to edit collection.
return (
function loadAllLocales() {
fs.readdirSync(poDirPath)
.forEach(poFileName => {
const localeToLoad = path.basename(poFileName, '.txt');
loadedLocales.push(localeToLoad);
const poFileContent = fs.readFileSync(path.join(poDirPath, poFileName));
loadLocalizationFromPOFile(localeToLoad, poFileContent);
});
}
loadAllLocales();
const preferredLocales = uniq([
loadedLocales.indexOf(locale) === -1 ? localeWithoutCountry(locale) : locale,
'en_US'
]);
useLocales(preferredLocales);
const selectors = {
homeButton: t`Home`,
startButton: t`Okay, let’s go!`,
placeMarker: 'Bunte SchokoWelt' + ' ' + t`Fully wheelchair accessible`,
editButton: t`Fully wheelchair accessible` + ' ' + t`Entrance has no steps, and all rooms are accessible without steps.`,
expandButton: t`Expand details`,
partiallyOption: t`Partially`,
cancelButton: t`Cancel`,
addImagesButton: t`Add images`,
searchButton: t`Search`,
searchInput: t`Search for place or address`,
shoppingButton: t`Shopping`,
atLeastPartiallyWheelchairAccessibleButton: t`Partially wheelchair accessible`,
goButton: t`Go!`,
showMeWhereIAmButton: t`Show me where I am`,
const handleChangeSieve = console.log;
console.log('[FILTER]', filter);
return (
{c('Add Filter Modal').t`Custom Filter`}
<div>
<label>{c('New Label form').t`Name`}</label>
<input required="{true}" label="" placeholder="{c('New" value="{model.Name}" type="text" id="accountName">
</div>
{model.Name && type !== 'sieve' ? : null}
{type === 'sieve' ? : null}
{c('New Label form').t`Cancel`}
{c('New Label form').t`Save`}
);
}
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);
export function changeLocale(locale: string) {
console.log(locale);
const translationObj = getTranslationObj(locale);
addLocale(locale, translationObj);
useLocale(locale);
}
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);