Do a lookup for the locale code that is set for this layout.

        NOTE: USB HID specifies only 35 different locales. If your layout does not fit, it should be set to Undefined/0

        @return: Tuple (<USB HID locale code>, <name>)
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)
1330700
def list_locales(self) -> List[Optional[Text]]:
        

        locales = list(self.dict.keys())

        if not locales:
            locales.append(None)

        return locales
1032518
def setCurrentLocale(self, locale):
        
        locale = str(locale)
        for i in xrange(self.count()):
            if self.itemData(i) == locale:
                self.setCurrentIndex(i)
                return True
        return False
537701
String getDisplayName(
        Locale locale,
        NumberSystem numsys,
        AttributeQuery attributes
    ) {

        Map<String, String> textForms = CalendarText.getInstance("generic", locale).getTextForms();
        char zeroDigit = attributes.get(Attributes.ZERO_DIGIT, numsys.getDigits().charAt(0));
        String display = toNumeral(numsys, zeroDigit, this.getNumber());

        if (this.leap) {
            boolean trailing =
                attributes.get(LEAP_MONTH_IS_TRAILING, "R".equals(textForms.get("leap-alignment")));
            char indicator =
                attributes.get(LEAP_MONTH_INDICATOR, textForms.get("leap-indicator").charAt(0));
            display = (trailing ? display + indicator : indicator + display);
        }

        return display;

    }
1278668
function (code) {
            var list = {}, cde = 'short', name = null;

            if ( typeof(code) != 'undefined' && typeof(userLocales[0][code]) == 'string' ) {
                cde = code
            } else if ( typeof(code) != 'undefined' ) (
                console.warn('`'+ code +'` not supported : sticking with `short` code')
            )

            for ( var i = 0, len = userLocales.length; i< len; ++i ) {

                if (userLocales[i][cde]) {

                    name = userLocales[i].full || userLocales[i].officialName.short;

                    if ( name )
                        list[ userLocales[i][cde] ] = name;
                }
            }

            return list
        }
876415
function getLocaleDayNames(locale, formStyle, width) {
    var /** @type {?} */ data = findLocaleData(locale);
    var /** @type {?} */ daysData = /** @type {?} */ ([data[3 /* DaysFormat */], data[4 /* DaysStandalone */]]);
    var /** @type {?} */ days = getLastDefinedValue(daysData, formStyle);
    return getLastDefinedValue(days, width);
}
593884
public Locale inferDeviceLocale(Context context) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
      return context.getResources().getConfiguration().getLocales().get(0);
    } else {
      return context.getResources().getConfiguration().locale;
    }
  }
637356
def to_google_translate_compatible_locale(locale)
      return locale unless locale.include?('-') && !SUPPORTED_LOCALES_WITH_REGION.include?(locale)
      locale.split('-', 2).first
    end
367130
def locale(self) -> babel.core.Locale or None:
        
        if not self.language_code:
            return None
        if not hasattr(self, '_locale'):
            setattr(self, '_locale', babel.core.Locale.parse(self.language_code, sep='-'))
        return getattr(self, '_locale')
337658
private Collection<Locale> initLocales() {

        Collection<Locale> locales = null;
        switch (m_bundleType) {
            case DESCRIPTOR:
                locales = new ArrayList<Locale>(1);
                locales.add(Descriptor.LOCALE);
                break;
            case XML:
            case PROPERTY:
                locales = OpenCms.getLocaleManager().getAvailableLocales(m_cms, m_resource);
                break;
            default:
                throw new IllegalArgumentException();
        }
        return locales;

    }
627589
def setAvailableLocales(self, locales):
        
        try:
            expr = re.compile('[a-z]+_[A-Z]+')
            babel_locales = []
            for locale in locales:
                if not expr.match(locale):
                    continue
                
                try:
                    babel_locale = babel.Locale.parse(str(locale))
                except (babel.UnknownLocaleError, StandardError):
                    continue
                
                if babel_locale.territory and babel_locale.language:
                    babel_locales.append(babel_locale)
            
            babel_locales.sort(key=str)
        except ImportError:
            babel_locales = []
        
        self._availableLocales = babel_locales
        self.setDirty()
101105
public Enumeration getLocales()
    {
        Enumeration enm = _httpRequest.getFieldValues(HttpFields.__AcceptLanguage,
                                                       HttpFields.__separators);

        // handle no locale
        if (enm == null || !enm.hasMoreElements())
            return Collections.enumeration(__defaultLocale);
        
        // sort the list in quality order
        List acceptLanguage = HttpFields.qualityList(enm);
        
        if (acceptLanguage.size()==0)
            return
                Collections.enumeration(__defaultLocale);

        Object langs = null;
        int size=acceptLanguage.size();
        
        // convert to locals
        for (int i=0; i<size; i++)
        {
            String language = (String)acceptLanguage.get(i);
            language=HttpFields.valueParameters(language,null);
            String country = "";
            int dash = language.indexOf('-');
            if (dash > -1)
            {
                country = language.substring(dash + 1).trim();
                language = language.substring(0,dash).trim();
            }
            langs=LazyList.ensureSize(langs,size);
            langs=LazyList.add(langs,new Locale(language,country));
        }

        if (LazyList.size(langs)==0)
            return Collections.enumeration(__defaultLocale);
            
        return Collections.enumeration(LazyList.getList(langs));
    }
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;
    }
1154809
private static String getDisplayCountryInternal(ULocale locale, ULocale displayLocale) {
        return LocaleDisplayNames.getInstance(displayLocale)
                .regionDisplayName(locale.getCountry());
    }
688482
def get(cls, code: str) -> "Locale":
        
        if code not in cls._cache:
            assert code in _supported_locales
            translations = _translations.get(code, None)
            if translations is None:
                locale = CSVLocale(code, {})  # type: Locale
            elif _use_gettext:
                locale = GettextLocale(code, translations)
            else:
                locale = CSVLocale(code, translations)
            cls._cache[code] = locale
        return cls._cache[code]
711856
def implicit_locals(self):
        
        locals_ = (("__module__", self.special_attributes.attr___module__),)
        if sys.version_info >= (3, 3):
            # __qualname__ is defined in PEP3155
            locals_ += (("__qualname__", self.special_attributes.attr___qualname__),)
        return locals_
97209
def get_device_address(usb_device):
        
        try:
            usb_device.ctrl_transfer(0x21, 0x09, 0x0300, 0, GrizzlyUSB.COMMAND_GET_ADDR)
            internal_addr = usb_device.ctrl_transfer(0xa1, 0x01, 0x0301, 0, 2)[1]
            return internal_addr >> 1
        except usb.USBError as e:
            return GrizzlyUSB.USB_DEVICE_ERROR