Lines Matching refs:code
349 """ Returns a normalized locale code for the given locale
352 The returned locale code is formatted for use with
359 the default encoding for the locale code just like setlocale()
381 code = locale_alias.get(lookup_name, None)
382 if code is not None:
383 return code
387 code = locale_alias.get(langname, None)
388 if code is not None:
390 if '.' in code:
391 langname, defenc = code.split('.')
393 langname = code
417 """ Parses the locale code for localename and returns the
418 result as tuple (language code, encoding).
424 The language code corresponds to RFC 1766. code and encoding
429 code = normalize(localename)
430 if '@' in code:
432 code, modifier = code.split('@')
433 if modifier == 'euro' and '.' not in code:
437 return code, 'iso-8859-15'
439 if '.' in code:
440 return tuple(code.split('.')[:2])
441 elif code == 'C':
447 """ Builds a locale code from the given tuple (language code,
464 them as tuple (language code, encoding).
479 Except for the code 'C', the language code corresponds to RFC
480 1766. code and encoding can be None in case the values cannot
488 code, encoding = _locale._getdefaultlocale()
492 # make sure the code/encoding values are valid
493 if sys.platform == "win32" and code and code[:2] == "0x":
495 code = windows_locale.get(int(code, 0))
498 return code, encoding
517 tuple (language code, encoding).
522 Except for the code 'C', the language code corresponds to RFC
523 1766. code and encoding can be None in case the values cannot
535 a string, an iterable of two strings (language code and encoding),
560 # On Win32, this will return the ANSI code page
1594 # locale code.