var pluralTypeToLanguages = {
arabic: ['ar'],
bosnian_serbian: ['bs-Latn-BA', 'bs-Cyrl-BA', 'srl-RS', 'sr-RS'],
chinese: ['id', 'id-ID', 'ja', 'ko', 'ko-KR', 'lo', 'ms', 'th', 'th-TH', 'zh'],
croatian: ['hr', 'hr-HR'],
german: ['fa', 'da', 'de', 'en', 'es', 'fi', 'el', 'he', 'hi-IN', 'hu', 'hu-HU', 'it', 'nl', 'no', 'pt', 'sv', 'tr'],
french: ['fr', 'tl', 'pt-br'],
russian: ['ru', 'ru-RU'],
lithuanian: ['lt'],
czech: ['cs', 'cs-CZ', 'sk'],
polish: ['pl'],
icelandic: ['is'],
slovenian: ['sl-SL']
};
function langToTypeMap(mapping) {
var ret = {};
forEach(mapping, function (langs, type) {
forEach(langs, function (lang) {
ret[lang] = type;
});
});
return ret;
}
function pluralTypeName(locale) {
var langToPluralType = langToTypeMap(pluralTypeToLanguages);
return langToPluralType[locale]
|| langToPluralType[split.call(locale, /-/, 1)[0]]
|| langToPluralType.en;
}
function pluralTypeIndex(locale, count) {
return pluralTypes[pluralTypeName(locale)](count);
}
function escape(token) {
return token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
}
function constructTokenRegex(opts) {
var prefix = (opts && opts.prefix) || '%{';
var suffix = (opts && opts.suffix) || '}';
if (prefix === delimiter || suffix === delimiter) {
throw new RangeError('"' + delimiter + '" token is reserved for pluralization');
}
return new RegExp(escape(prefix) + '(.*?)' + escape(suffix), 'g');
}
var defaultTokenRegex = /%\{(.*?)\}/g;