Generate a file that contains all locale to import for closure.
Tree shaking will only keep the data for the `goog.LOCALE` locale.
162037
function generateAllLocalesFile(LOCALES, ALIASES) {
  const existingLocalesAliases = {};
  const existingLocalesData = {};

  // for each locale, get the data and the list of equivalent locales
  LOCALES.forEach(locale => {
    const eqLocales = new Set();
    eqLocales.add(locale);
    if (locale.match(/-/)) {
      eqLocales.add(locale.replace(/-/g, '_'));
    }

    // check for aliases
    const alias = ALIASES[locale];
    if (alias) {
      eqLocales.add(alias);

      if (alias.match(/-/)) {
        eqLocales.add(alias.replace(/-/g, '_'));
      }

      // to avoid duplicated "case" we regroup all locales in the same "case"
      // the simplest way to do that is to have alias aliases
      // e.g. 'no' --> 'nb', 'nb' --> 'no-NO'
      // which means that we'll have 'no', 'nb' and 'no-NO' in the same "case"
      const aliasKeys = Object.keys(ALIASES);
      for (let i = 0; i < aliasKeys.length; i++) {
        const aliasValue = ALIASES[alias];
        if (aliasKeys.indexOf(alias) !== -1 && !eqLocales.has(aliasValue)) {
          eqLocales.add(aliasValue);

          if (aliasValue.match(/-/)) {
            eqLocales.add(aliasValue.replace(/-/g, '_'));
          }
        }
      }
    }

    for (let l of eqLocales) {
      // find the existing content file
      const path = `${RELATIVE_I18N_DATA_FOLDER}/${l}.ts`;
      if (fs.existsSync(`${RELATIVE_I18N_DATA_FOLDER}/${l}.ts`)) {
        const localeName = formatLocale(locale);
        existingLocalesData[locale] =
            fs.readFileSync(path, 'utf8')
                .replace(`${HEADER}\n`, '')
                .replace('export default ', `export const locale_${localeName} = `)
                .replace('function plural', `function plural_${localeName}`)
                .replace(/,(\n  | )plural/, `, plural_${localeName}`)
                .replace('const u = undefined;\n\n', '');
      }
    }

    existingLocalesAliases[locale] = eqLocales;
  });

  function generateCases(locale) {
    let str = '';
    let locales = [];
    const eqLocales = existingLocalesAliases[locale];
    for (let l of eqLocales) {
      str += `case '${l}':\n`;
      locales.push(`'${l}'`);
    }
    let localesStr = '[' + locales.join(',') + ']';

    str += `  l = locale_${formatLocale(locale)};
    locales = ${localesStr};
    break;\n`;
    return str;
  }

  function formatLocale(locale) { return locale.replace(/-/g, '_'); }
  // clang-format off
  return `${HEADER}
import {registerLocaleData} from '../src/i18n/locale_data';

const u = undefined;

${LOCALES.map(locale => `${existingLocalesData[locale]}`).join('\n')}

let l: any;
let locales: string[] = [];

switch (goog.LOCALE) {
${LOCALES.map(locale => generateCases(locale)).join('')}}

if(l) {
  locales.forEach(locale => registerLocaleData(l, locale));
}
`;
  // clang-format on
}
885190
def find_globals_and_nonlocals(node, globs, nonlocals, code, version):
    """"""
    for n in node:
        if isinstance(n, SyntaxTree):
            globs, nonlocals = find_globals_and_nonlocals(n, globs, nonlocals,
                                                          code, version)
        elif n.kind in read_global_ops:
            globs.add(n.pattr)
        elif (version >= 3.0
              and n.kind in nonglobal_ops
              and n.pattr in code.co_freevars
              and n.pattr != code.co_name
              and code.co_name != '<lambda>'):
            nonlocals.add(n.pattr)
    return globs, nonlocals
1049079
function getLanguage(sLang) {
		var oLocale;
		if (sLang) {
			oLocale = new Locale(sLang);
		} else {
			oLocale = sap.ui.getCore().getConfiguration().getLocale();
		}

		var sLanguage = oLocale.getLanguage().toLowerCase();

		// adjustment of the language to corresponds to Hyphenopoly pattern files (.hpb files)
		switch (sLanguage) {
			case "en":
				sLanguage = "en-us";
				break;
			case "nb":
				sLanguage = "nb-no";
				break;
			case "no":
				sLanguage = "nb-no";
				break;
			case "el":
				sLanguage = "el-monoton";
				break;
		}

		return sLanguage;
	}
45674
def clean_locale(configuration, locale):
    
    dirname = configuration.get_messages_dir(locale)
    if not dirname.exists():
        # Happens when we have a supported locale that doesn't exist in Transifex
        return
    for filename in dirname.files('*.po'):
        clean_file(configuration, dirname.joinpath(filename))
326906
function build(config, locale, done) {
  const shouldWatch = (util.env[`watch`] || util.env[`w`]) && (config.watch !== false);

  if (locale && config.i18n && (config.i18n.locales instanceof Array) && (locale === config.i18n.locales[0]))
    locale = undefined;

  config = normalizeConfig(config, locale);

  metalsmith(config.base || __dirname)
    .clean(false)
    .source(config.src)
    .ignore(config.ignore)
    .destination(config.dest)
    .metadata(config.metadata.global)
    .use(collections(config.collections))
    .use(related(config.related))
    .use((config.tags) ? tags(config.tags) : noop())
    .use(pagination(config.pagination))
    .use(metadata(config.metadata.collections))
    .use(markdown(config.markdown))
    .use(config.multilingual ? multilingual(locale) : noop())
    .use(permalinks(config.permalinks))
    .use(pathfinder(locale, config.i18n && config.i18n.locales))
    .use(layouts(config.layouts))
    .use(inPlace(config.inPlace))
    .use((config.prism !== false) ? prism(config.prism, locale) : noop())
    .use((config.mathjax !== false) ? mathjax(config.mathjax, locale) : noop())
    .use(permalinks(config.permalinks))
    .use(reporter(locale))
    .build(function(err) {
      if (err && shouldWatch) util.log(util.colors.blue(`[metalsmith]`), util.colors.red(err));
      done(!shouldWatch && err);
    });
}
180350
public static String toLanguageTag(Locale locale) {
        return locale.getLanguage() + (hasText(locale.getCountry()) ? "-" + locale.getCountry() : EMPTY);
    }
275660
public static function local()
    {
        //====================================================================//
        // Initialize Local Core Management Class
        if (isset(self::core()->localcore)) {
            return self::core()->localcore;
        }
        //====================================================================//
        // Verify Local Core Class Exist & is Valid
        if (!self::validate()->isValidLocalClass()) {
            throw new Exception('You requested access to Local Class, but it is Invalid...');
        }
        //====================================================================//
        // Initialize Class
        self::core()->localcore = new Local();
        //====================================================================//
        //  Load Translation File
        self::translator()->load('local');
        //====================================================================//
        // Load Local Includes
        self::core()->localcore->Includes();
        //====================================================================//
        // Return Local Class
        return self::core()->localcore;
    }
643633
protected final String toLocaleStr(Locale locale) {
    if (locale == Locale.ROOT) { return ""; }
    String language = locale.getLanguage();
    String country = locale.getCountry();
    String variant = locale.getVariant();
    if (language == "" && country == "" && variant == "") { return ""; }

    StringBuilder sb = new StringBuilder();
    if (variant != "") {
      sb.append(language).append('_').append(country).append('_').append(variant);
    } else if (country != "") {
      sb.append(language).append('_').append(country);
    } else {
      sb.append(language);
    }
    return sb.toString();
  }
387984
function getLocalESLintVersion() {
    try {
        const eslintPath = relativeModuleResolver("eslint", path.join(process.cwd(), "__placeholder__.js"));
        const eslint = require(eslintPath);

        return eslint.linter.version || null;
    } catch (_err) {
        return null;
    }
}
426256
def create_for_locale
      field_key = FieldKey.find_by_global_key(params[:i18n_key])
      phrase = I18n::Backend::ActiveRecord::Translation.find_or_create_by(
        key: field_key.global_key,
      locale: params[:locale]
)
      unless phrase.value.present?
        I18n.backend.reload!
        phrase.value = params[:i18n_value]
        phrase.save!
      end
      render json: { success: true }
    end
24226
function fileContent(file, dontIgnoreExports) {
    return fs.readFileSync(file, 'UTF-8').split(/\r?\n/)
        .map(line => {
            if (/(=|^|\s)require\(['"]/.test(line)
                || (!dontIgnoreExports && /^\s*(module\.)?exports\s+=/.test(line))
            ) {
                return '// ' + line;
            }

            return line.replace(OPTI_ENUM_REPLACE_REG, optiEnumReplaceFn);
        })
        .join('\n');
}
1147852
function getLocale (key) {
    var locale;

    if (key && key._locale && key._locale._abbr) {
        key = key._locale._abbr;
    }

    if (!key) {
        return globalLocale;
    }

    if (!isArray$2(key)) {
        //short-circuit everything else
        locale = loadLocale(key);
        if (locale) {
            return locale;
        }
        key = [key];
    }

    return chooseLocale(key);
}
616667
function defaultLocale() {
		var sLocale;
		// use the current session locale, if available
		if (window.sap && window.sap.ui && sap.ui.getCore) {
			sLocale = sap.ui.getCore().getConfiguration().getLanguage();
			sLocale = normalize(sLocale);
		}
		// last fallback is english if no or no valid locale is given
		return sLocale || "en";
	}
901958
private static FairyModule getFairyModuleForLocale(DataMaster dataMaster, Locale locale, RandomGenerator randomGenerator) {

		LanguageCode code;
		try {
			code = LanguageCode.valueOf(locale.getLanguage().toUpperCase());
		} catch (IllegalArgumentException e) {
			LOG.warn("Uknown locale " + locale);
			code = LanguageCode.EN;
		}

		switch (code) {
			case PL:
				return new PlFairyModule(dataMaster, randomGenerator);
			case EN:
				return new EnFairyModule(dataMaster, randomGenerator);
			case ES:
				return new EsFairyModule(dataMaster, randomGenerator);
			case FR:
				return new EsFairyModule(dataMaster, randomGenerator);
			case SV:
				return new SvFairyModule(dataMaster, randomGenerator);
			case ZH:
				return new ZhFairyModule(dataMaster, randomGenerator);
			case DE:
				return new DeFairyModule(dataMaster, randomGenerator);
			case KA:
				return new KaFairyModule(dataMaster, randomGenerator);
			default:
				LOG.info("No data for your language - using EN");
				return new EnFairyModule(dataMaster, randomGenerator);
		}
	}
947058
def get_parser(parser):
    
    parser.description = textwrap.dedent("""
        Segment the .po files in LOCALE(s) based on the segmenting rules in
        config.yaml.

        Note that segmenting is *not* idempotent: it modifies the input file, so
        be careful that you don't run it twice on the same file.
    """.strip())
    parser.add_argument("locale", nargs="+", help="a locale to segment")
1227138
function localeIsLoaded(locale) {
  return !!(Cldr._raw && Cldr._raw.main && Cldr._raw.main[getLocaleKey(locale)]);
}
1166944
function Locales() {

    var _require = function(path) {
        var cacheless = (process.env.IS_CACHELESS == 'false') ? false : true;
        if (cacheless) {
            try {
                delete require.cache[require.resolve(path)];
                return require(path)
            } catch (err) {
                throw err
            }

        } else {
            return require(path)
        }
    }

    /**
     * init
     *
     * return {array} regions collection
     * */
    var init  = function () {

        var dir         = __dirname + '/dist/region' // regions by language
            , files     = fs.readdirSync(dir)
            , i         = 0
            , key       = null
            , regions   = []
        ;

        for (var f = 0, len = files.length; f < len; ++f) {
            if ( ! /^\./.test(files[f]) || f == len-1 ) {
                key         = files[f].split(/\./)[0];
                regions[i]  = { lang: key, content: _require( dir + '/' + files[f] ) }
            }
        }


        return regions
    }
    

    return init()
}