Builds a locale code from the given tuple (language code, encoding). No aliasing or normalizing takes place.
(localetuple)
| 501 | raise ValueError('unknown locale: %s' % localename) |
| 502 | |
| 503 | def _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 | |
| 524 | def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')): |
| 525 |