Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
translated = translate(config, locale, singular, plural);
// 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 (pluralsInstanceForLocale[locale]) {
p = pluralsInstanceForLocale[locale];
} else {
MakePlural.load(plurals);
p = new MakePlural(locale).compile();
pluralsInstanceForLocale[locale] = p;
}
// fallback to 'other' on case of missing translations
translated = translated[p(countNumber)] || translated.other;
}
// Accept an object with named values as the last parameter
if (typeof values[values.length - 1] === 'object') {
namedValues = values.pop();
}
return postProcess(config, translated, namedValues, values, countNumber);
}