('zh', 'CN', None, None)
>>> parse_locale('zh_Hans_CN')
('zh', 'CN', 'Hans', None)
+ >>> parse_locale('ca_es_valencia')
+ ('ca', 'ES', None, 'VALENCIA')
+ >>> parse_locale('en_150')
+ ('en', '150', None, None)
+ >>> parse_locale('en_us_posix')
+ ('en', 'US', None, 'POSIX')
The default component separator is "_", but a different separator can be
specified using the `sep` parameter:
if parts:
if len(parts[0]) == 4 and parts[0][0].isdigit() or \
len(parts[0]) >= 5 and parts[0][0].isalpha():
- variant = parts.pop()
+ variant = parts.pop().upper()
if parts:
raise ValueError('%r is not a valid locale identifier' % identifier)
# part of a language name.
assert Locale.parse('fi_FI').get_display_name('kw_GB') == None
+
+
+def test_issue_814():
+ loc = Locale.parse('ca_ES_valencia')
+ assert loc.variant == "VALENCIA"
+ assert loc.get_display_name() == 'català (Espanya, valencià)'