Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const cldr = require('cldr');
// locale list
const locales = cldr.localeIds;
const langToRule = {};
const ruleToLang = {};
const variants = [];
const localeToVariant = {};
const DEFAULT_RULE = `function anonymous(n\n/**/) {\nreturn"other"\n}`;
const EMPTY_RULE = `function anonymous(n\n/**/) {\n\n}`;
locales.forEach(locale => {
const rule = normalizeRule(cldr.extractPluralRuleFunction(locale).toString());
const lang = getVariantLang(locale, rule);
if (!lang || !rule) {
return;
}
if (!ruleToLang[rule]) {
findLocales: function() {
var re = new RegExp('_', 'g');
return cldr.localeIds.map(function(locale) {
return locale.replace(re, '-');
}).filter(function(locale) {
if (locale === 'root') {
return false;
}
var parts = locale.split('-');
return parts.length === 1;
});
}
function setlocale(locale) {
locale = typeof(locale) === "undefined" ? "en_US" : locale;
if((cldr && (cldr.localeIds.indexOf(locale.replace(/-/g, '_').toLowerCase()) === -1)) || (!cldr && ((locale.replace(/-/g, '_').toLowerCase() !== "en_us")))) {
throw new IllegalLocaleError();
}
this.day_name = _extractLocaleDays(false, locale);
this.day_abbr = _extractLocaleDays(true, locale);
this.month_name = _extractLocaleMonths(false, locale);
this.month_abbr = _extractLocaleMonths(true, locale);
};
function isValidLocale(locale) {
return cldr.localeIds.indexOf(normalize(locale)) >= 0;
}
isKnownLocaleCode: function(code) {
if (code === 'root') {
return false;
}
code = code.replace(/-/g, '_');
code = code.toLowerCase();
return cldr.localeIds.indexOf(code) >= 0;
},