Finds the locale data for a locale id

@experimental i18n support is experimental.
504528
function findLocaleData(locale) {
    var normalizedLocale = locale.toLowerCase().replace(/_/g, '-');
    var match = LOCALE_DATA[normalizedLocale];
    if (match) {
        return match;
    }
    // let's try to find a parent locale
    var parentLocale = normalizedLocale.split('-')[0];
    match = LOCALE_DATA[parentLocale];
    if (match) {
        return match;
    }
    if (parentLocale === 'en') {
        return localeEn;
    }
    throw new Error("Missing locale data for the locale \"" + locale + "\".");
}
1136036
@Override
    public ULocale getLocale(ULocale.Type type) {
        if (type == ULocale.ACTUAL_LOCALE) {
            return actualLocaleIsSameAsValid ? validLocale : tailoring.actualLocale;
        } else if(type == ULocale.VALID_LOCALE) {
            return validLocale;
        } else {
            throw new IllegalArgumentException("unknown ULocale.Type " + type);
        }
    }
491520
public function findByIdAndLocale($id, $locale)
    {
        try {
            $qb = $this->getShippingQuery($locale);
            $qb->andWhere('shipping.id = :shippingId');
            $qb->setParameter('shippingId', $id);

            return $qb->getQuery()->getSingleResult();
        } catch (NoResultException $exc) {
            return null;
        }
    }
629645
public static String getName(String localeID){
        String tmpLocaleID;
        // Convert BCP47 id if necessary
        if (localeID != null && !localeID.contains("@") && getShortestSubtagLength(localeID) == 1) {
            tmpLocaleID = forLanguageTag(localeID).getName();
            if (tmpLocaleID.length() == 0) {
                tmpLocaleID = localeID;
            }
        } else {
            tmpLocaleID = localeID;
        }
        return nameCache.getInstance(tmpLocaleID, null /* unused */);
    }
891245
public Locale getLocale() {
        UI currentUI = UI.getCurrent();
        Locale locale = currentUI == null ? null : currentUI.getLocale();
        if (locale == null) {
            locale = Locale.getDefault();
        }
        return locale;
    }
1315179
def get_template_i18n(template_name, locale):
    """"""
    if locale is None:
        return [template_name]

    template_list = []
    parts = template_name.rsplit(".", 1)
    root = parts[0]
    suffix = parts[1]

    if locale.territory is not None:
        locale_string = "_".join([locale.language, locale.territory])
        localized_template_path = ".".join([root, locale_string, suffix])
        template_list.append(localized_template_path)

    localized_template_path = ".".join([root, locale.language, suffix])
    template_list.append(localized_template_path)

    # append the default
    template_list.append(template_name)
    return template_list
1060276
def parse_value(v, locale)
      new_value = nil
      case v
        when Symbol then
          lk = @localization_key_object_cache[v.to_s] || \
            Lit::LocalizationKey.where(localization_key: v.to_s).first
          if lk
            loca = Lit::Localization.active.where(locale_id: locale.id).
                        where(localization_key_id: lk.id).first
            new_value = loca.translation if loca && loca.translation.present?
          end
        when String then
          new_value = v
        when Hash then
          new_value = nil
        when Proc then
          new_value = nil # was v.call - requires more love
        else
          new_value = v.to_s
      end
      new_value
    end
410755
def locale_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/locales/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)
563166
private Locale extractLocale() {

        Locale loc = null;
        int underscore = m_name.lastIndexOf("_");
        if (underscore > -1) {
            String localeName = m_name.substring(underscore + 1);
            if (localeName.lastIndexOf(".") > -1) {
                localeName = localeName.substring(0, localeName.lastIndexOf("."));
            }
            loc = CmsLocaleManager.getLocale(localeName);
        }

        return loc;
    }
320533
def locale(self):
        '''
        
        '''
        name = self.json_data['hid_locale']

        # Set to Undefined/0 if not set
        if name is None:
            name = "Undefined"

        return (int(self.json_data['from_hid_locale'][name]), name)
183511
def __get_language_data(self, bundleId, languageId, fallback=False):
        
        url = self.__get_base_bundle_url() + '/' + bundleId + '/' + languageId
        params = {'fallback': 'true'} if fallback else None
        response = self.__perform_rest_call(requestURL=url, params=params)

        if not response:
            return None

        languageData = response.get(self.__RESPONSE_RESOURCE_STRINGS_KEY)

        return languageData
848508
function(id) {
            if (!$$.App) $$.App = this;
            if (!$$.App._languages) {
                // Initialise localization.
                var languages = [],
                langStyle = document.createElement("style"),
                children = document.querySelectorAll("[lang]");
                document.head.appendChild(langStyle);
                $$.App._langStyle = langStyle;
                for (var i = 0 ; i < children.length ; i++) {
                    var child = children[i];
                    lang = child.getAttribute("lang");
                    found = false;
                    for (k = 0 ; k < languages.length ; k++) {
                        if (languages[k] == lang) {
                            found = true;
                            break;
                        }
                    }
                    if (!found) {
                        languages.push(lang);
                    }
                }
                $$.App._languages = languages;
            }

            var that = this, lang, k, found, first, txt;
            languages = $$.App._languages;
            if (id === undefined) {
                // Return current language.
                lang = $$.lang();  // localStorage.getItem("wtag-language");
                if (!lang) {
                    lang = navigator.language || navigator.browserLanguage || "fr";
                    lang = lang.substr(0, 2);
                }
                $$.lang(lang);
                // localStorage.setItem("wtag-language", lang);
                return lang;
            } else {
                // Set current language and display localized elements.
                found = false;
                for (k = 0 ; k < languages.length ; k++) {
                    if (languages[k] == id) {
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    id = languages[0];
                }
                txt = "";
                first = true;
                for (k = 0 ; k < languages.length ; k++) {
                    lang = languages[k];
                    if (lang != id) {
                        if (first) {
                            first = false;
                        } else {
                            txt += ",";
                        }
                        txt += "[lang=" + lang + "]";
                    }
                }
                $$.App._langStyle.textContent = txt + "{display: none}";
                $$.lang(id);
                //localStorage.setItem("wtag-language", id);
            }
        }
1294348
def find_locales(self) -> Dict[str, gettext.GNUTranslations]:
        
        translations = {}

        for name in os.listdir(self.path):
            if not os.path.isdir(os.path.join(self.path, name)):
                continue
            mo_path = os.path.join(self.path, name, 'LC_MESSAGES', self.domain + '.mo')

            if os.path.exists(mo_path):
                with open(mo_path, 'rb') as fp:
                    translations[name] = gettext.GNUTranslations(fp)
            elif os.path.exists(mo_path[:-2] + 'po'):
                raise RuntimeError(f"Found locale '{name} but this language is not compiled!")

        return translations
1322804
protected function buildLocaleInfo()
    {
        $this->locale_info = localeconv();

        // convert locale info to UTF-8
        $character_encoding = $this->detectCharacterEncoding();
        if ($character_encoding !== null && $character_encoding !== 'UTF-8') {
            $this->locale_info = $this->iconvArray(
                $character_encoding,
                'UTF-8',
                $this->locale_info
            );
        }

        // special-cases and workarounds
        switch ($this->preferred_locale) {
            // Hebrew-Israeli
            case 'he_IL':
            case 'he_IL.utf8':
                $this->locale_info['currency_symbol'] = '₪';
                break;

            // Japanese and Chinese
            case 'ja_JP':
            case 'ja_JP.utf8':
            case 'zh_CN':
            case 'zh_CN.utf8':
                // use single-width Yen character, renders by default in Windows
                $this->locale_info['currency_symbol'] = '¥';
                break;
        }
    }
936655
function resolveLanguage ( value ) {
	if ( typeof value === 'string' ) {
		const lang = _.find(langs, ( o ) => { return o.locale.indexOf(value) !== -1; });
		if ( typeof lang !== 'undefined' ) {
			return lang.id;
		}
	}
	return value;
}
68640
def extract_locale_from_tld 
        parsed_locale = request.host.split('.').last 
        (I18n.available_locales.include? parsed_locale) ? parsed_locale.to_sym : nil 
      end
521842
public function findByLocale($id, $locale)
    {
        return $this->model->with(['type', 'contents' => function($query) {
                        $query->with('lang');
                    }])->where('id', $id)->first();
    }