Builds a locale code from the given tuple (language code, encoding). No aliasing or normalizing takes place.
(localetuple)
| 511 | raise ValueError('unknown locale: %s' % localename) |
| 512 | |
| 513 | def _build_localename(localetuple): |
| 514 | |
| 515 | """ Builds a locale code from the given tuple (language code, |
| 516 | encoding). |
| 517 | |
| 518 | No aliasing or normalizing takes place. |
| 519 | |
| 520 | """ |
| 521 | try: |
| 522 | language, encoding = localetuple |
| 523 | |
| 524 | if language is None: |
| 525 | language = 'C' |
| 526 | if encoding is None: |
| 527 | return language |
| 528 | else: |
| 529 | return language + '.' + encoding |
| 530 | except (TypeError, ValueError): |
| 531 | raise TypeError('Locale must be None, a string, or an iterable of ' |
| 532 | 'two strings -- language code, encoding.') from None |
| 533 | |
| 534 | def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')): |
| 535 |
no outgoing calls
no test coverage detected