MCPcopy Index your code
hub / github.com/RustPython/RustPython / _build_localename

Function _build_localename

Lib/locale.py:503–522  ·  view source on GitHub ↗

Builds a locale code from the given tuple (language code, encoding). No aliasing or normalizing takes place.

(localetuple)

Source from the content-addressed store, hash-verified

501 raise ValueError('unknown locale: %s' % localename)
502
503def _build_localename(localetuple):
504
505 """ Builds a locale code from the given tuple (language code,
506 encoding).
507
508 No aliasing or normalizing takes place.
509
510 """
511 try:
512 language, encoding = localetuple
513
514 if language is None:
515 language = 'C'
516 if encoding is None:
517 return language
518 else:
519 return language + '.' + encoding
520 except (TypeError, ValueError):
521 raise TypeError('Locale must be None, a string, or an iterable of '
522 'two strings -- language code, encoding.') from None
523
524def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')):
525

Callers 1

setlocaleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected