Locale('de', territory='DE')
This also can perform resolving of likely subtags which it does
- by default.
+ by default. This is for instance useful to figure out the most
+ likely locale for a territory you can use ``'und'`` as the
+ language tag:
+
+ >>> Locale.parse('und_AT')
+ Locale('de', territory='AT')
:param identifier: the locale identifier string
:param sep: optional component separator
return locale
# Now try without script and variant
- lcoale = _try_load(parts2[:2])
+ locale = _try_load(parts2[:2])
if locale is not None:
return locale
- # Give up.
raise UnknownLocaleError(input_id)
def __eq__(self, other):
assert l.territory == 'TW'
assert l.script == 'Hant'
+ l = Locale.parse('und_AT')
+ assert l.language == 'de'
+ assert l.territory == 'AT'
+
def test_get_display_name(self):
zh_CN = Locale('zh', 'CN', script='Hans')
assert zh_CN.get_display_name('en') == 'Chinese (Simplified, China)'