Returns the language, script, country, and variant as separate strings.
163251
public String[] getLanguageScriptCountryVariant() {
        reset();
        return new String[] {
                getString(parseLanguage()),
                getString(parseScript()),
                getString(parseCountry()),
                getString(parseVariant())
        };
    }
481993
def languages(self):
        
        result = set()
        languages = self._safe_get_element('ItemAttributes.Languages')
        if languages is not None:
            for language in languages.iterchildren():
                text = self._safe_get_element_text('Name', language)
                if text:
                    result.add(text.lower())
        return result
629133
public function languageString()
    {
        $data = $data1 = $data2 = [];
        $language = $this->getLang();
        if (file_exists(route()->locale."{$language}.php")) {
            $data1 += require route()->locale."{$language}.php";
        }
        $path = route()->com;
        $disk_scan = array_diff(scandir($path), ['..', '.']);
        foreach ($disk_scan as $scans) {
            if (file_exists($path.$scans."/Locale/{$language}.php")) {
                $data2 += require $path.$scans."/Locale/{$language}.php";
            }
        }
        $data = array_merge($data1, $data2);

        return $data;
    }
286904
def Scripts(unicode_dir=_UNICODE_DIR):
  

  scripts = {}

  def DoLine(codes, fields):
    """Process single Scripts.txt line, updating scripts."""
    (_, name) = fields
    scripts.setdefault(name, []).extend(codes)

  ReadUnicodeTable(unicode_dir+"/Scripts.txt", 2, DoLine)
  return scripts
900201
function makeLanguageObj(langStr) {
        var shortName;
        shortName = langStr.toLowerCase().substr(0,2);
        return {
            name: langStr,
            shortName: shortName,
            nativeName: langStr,
            path: shortName + '/'
        };
    }
619761
def get_countrytag(country):
    """"""
    norm_name = {
        'australia': 'Australia',
        'brazil': 'Brazil',
        'brasil': 'Brazil',
        'canada': 'Canada',
        'european union': 'European Union',
        'eu': 'European Union',
        'e.u.': 'European Union',
        'france': 'France',
        'mexico': 'Mexico',
        'méxico': 'Mexico',
        'méjico': 'Mexico',
        'spain': 'Spain',
        'espana': 'Spain',
        'españa': 'Spain',
        'uk': 'United Kingdom',
        'u.k.': 'United Kingdom',
        'united kingdom': 'United Kingdom',
        'united states of america': 'United States',
        'united states': 'United States',
        'us': 'United States',
        'usa': 'United States',
        'u.s.': 'United States',
        'u.s.a.': 'United States'
    }
    if country is not None and country.lower() in norm_name:
        return REGIONTAGS.get(norm_name.get(country.lower()))
    else:
        raise ValueError(
            'The available regions are {0}.'.format(
                ', '.join('\'{}\''.format(k) for k in REGIONTAGS)))
8079
def _get_languages(cls) -> set:
        """"""
        if not cls._server_is_alive():
            cls._start_server_on_free_port()
        url = urllib.parse.urljoin(cls._url, 'Languages')
        languages = set()
        for e in cls._get_root(url, num_tries=1):
            languages.add(e.get('abbr'))
            languages.add(e.get('abbrWithVariant'))
        return languages
72288
protected String toLocaleString(Locale locale) {
		String language = locale.getLanguage();
		if(language.isEmpty()) return "";

		String country = locale.getCountry();
		if(country.isEmpty()) return language;

		String variant = locale.getVariant();
		if(variant.isEmpty()) {
			return language + '-' + country;
		} else {
			return language + '-' + country + '-' + variant;
		}
	}
469258
def get_locale(self, language=None, country=None, variant=None):
        
        # http://www.openoffice.org/api/docs/common/ref/com/sun/star/lang/Locale.html
        locale = uno.createUnoStruct('com.sun.star.lang.Locale')
        if language:
            locale.Language = language
        if country:
            locale.Country = country
        if variant:
            locale.Variant = variant
        formats = self._target.getNumberFormats()
        return Locale(locale, formats)
591354
def ext_language(ext, exts=None):
    
    languages = {
        '.py': 'python',
        '.py2': 'python2',
        '.py3': 'python3',
        '.sh': 'bash',
        '.bash': 'bash',
        '.pl': 'perl',
        '.js': 'javascript',
        '.txt': 'english',
    }
    ext_languages = {_: languages[_] for _ in exts} if exts else languages
    return ext_languages.get(ext)
968403
function getLanguages(properties) {
  if (!Array.isArray(properties['wof:lang_x_official'])) {
    return [];
  }
  return properties['wof:lang_x_official']
    .filter(l => (typeof l === 'string' && l.length === 3))
    .map(l => l.toLowerCase());
}
189517
def split(sql, encoding=None):
    
    stack = engine.FilterStack()
    return [text_type(stmt).strip() for stmt in stack.run(sql, encoding)]
791626
def multilingual(request):
    
    codes = sorted(get_language_code_list())
    return {'LANGUAGE_CODES': codes,
            'LANGUAGE_CODES_AND_NAMES': [(c, LANG_DICT.get(c, c)) for c in codes], 
            'DEFAULT_LANGUAGE_CODE': get_default_language_code(),
            'ADMIN_MEDIA_URL': settings.ADMIN_MEDIA_PREFIX}
1321845
public static Locale localeForString(String localeString) {
        if (localeString == null || localeString.isEmpty()) {
            return null;
        }
        Locale locale;
        String[] localeParts = localeString.split("_");
        switch (localeParts.length) {
            case 1:
                locale = new Locale(localeParts[0]);
                break;
            case 2:
                locale = new Locale(localeParts[0], localeParts[1]);
                break;
            default:
                // Use default for 3 and above, merge the parts back and put them all in the varient
                StringBuilder varient = new StringBuilder(localeParts[2]);
                for (int i = 3; i < localeParts.length; i++) {
                    varient.append("_");
                    varient.append(localeParts[i]);
                }
                locale = new Locale(localeParts[0], localeParts[1], varient.toString());
                break;
        }
        return locale;
    }
516643
def subtags(self):
        
        data = self.data
        subtags = []

        # if tag is grandfathered return no subtags
        if 'record' in data and self.data['record']['Type'] == 'grandfathered':
            return subtags

        codes = data['tag'].split('-')
        # Try and find the language tag.
        for i, code in enumerate(codes):

            # Singletons and anything after are unhandled.
            if len(code) == 1:
                #Stop the loop (stop processing after a singleton).
                break

            # Check for non-existent tag.
            if code not in index:
                continue
            types = index[code]

            # Language subtags may only appear at the beginning of the tag, otherwise the subtag type is indeterminate.
            if 'language' in types and i == 0:
                subtags.append(Subtag(code, 'language'))
                continue

            if len(code) == 2:
                # Should be a region
                if 'region' in types:
                    subtags.append(Subtag(code, 'region'))
                # Error case: language subtag in the wrong place.
                elif 'language' in types:
                    subtags.append(Subtag(code, 'language'))

            elif len(code) == 3:
                # Could be a numeric region code e.g. '001' for 'World'.
                if 'region' in types:
                    subtags.append(Subtag(code, 'region'))
                elif 'extlang' in types:
                    subtags.append(Subtag(code, 'extlang'))
                # Error case: language subtag in the wrong place.
                elif 'language' in types:
                    subtags.append(Subtag(code, 'language'))

            elif len(code) == 4:
                # Could be a numeric variant
                if 'variant' in types:
                    subtags.append(Subtag(code, 'variant'))
                elif 'script' in types:
                    subtags.append(Subtag(code, 'script'))

            else:
                # Should be a variant
                if 'variant' in types:
                    subtags.append(Subtag(code, 'variant'))

        return subtags
630901
def language_contents(instance):
    
    if instance['type'] != 'language-content' or 'contents' not in instance:
        return

    for key, value in instance['contents'].items():
        if key not in enums.LANG_CODES:
            yield JSONError("Invalid key '%s' in 'contents' property must be"
                            " an RFC 5646 code" % key, instance['id'])
        for subkey, subvalue in value.items():
            if not PROPERTY_FORMAT_RE.match(subkey):
                yield JSONError("'%s' in '%s' of the 'contents' property is "
                                "invalid and must match a valid property name"
                                % (subkey, key), instance['id'], 'observable-dictionary-keys')
1088898
def to_array(self):
        
        array = super(PassportElementErrorFiles, self).to_array()
        array['source'] = u(self.source)  # py2: type unicode, py3: type str
        array['type'] = u(self.type)  # py2: type unicode, py3: type str
        array['file_hashes'] = self._as_array(self.file_hashes)  # type list of str
        array['message'] = u(self.message)  # py2: type unicode, py3: type str
        return array