Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
// enforce number
count = parseInt(count, 10);
// find the correct plural rule for given locale
if (typeof translated === 'object') {
let p = null;
// create a new Plural for locale
// and try to cache instance
if (PluralsForLocale[targetLocale]) {
p = PluralsForLocale[targetLocale];
} else {
p = new MakePlural(targetLocale);
PluralsForLocale[targetLocale] = p;
}
// fallback to 'other' on case of missing translations
translated = translated[p(count)] || translated.other;
}
return postProcess(translated, namedValues, params, count);
}
export const loadLanguageData = (language: string) => {
const plurals = new MakePlural(language, {
cardinals: true,
ordinals: true
})
return { plurals }
}