phensley / cldr-engine

Internationalization and localization in Typescript with Unicode CLDR, batteries included
https://phensley.github.io/cldr-engine/
Apache License 2.0
48 stars 3 forks source link

General.getLanguageDisplayName returns nothing for multi-subtag language tags #1

Closed mate-h closed 4 years ago

mate-h commented 4 years ago

Hey Patrick,

I stumbled upon this small bug, just thought I would leave this for you here. Testing for v0.25.1 with an English bundle loaded, this statement returns nothing instead of "Simplified Chinese":

cldr.General.getLanguageDisplayName('zh-Hans');

It only works for plain language ids, like 'en' or 'es'. I've included a snippet from the English bundle for reference, note that in most cases, the tag in question includes a region subtag, except in the case of Chinese.

"ar-001": "Modern Standard Arabic",
"de-AT": "Austrian German",
"de-CH": "Swiss High German",
"en-AU": "Australian English",
"en-CA": "Canadian English",
"en-GB": "British English",
"en-US": "American English",
"es-419": "Latin American Spanish",
"es-ES": "European Spanish",
"es-MX": "Mexican Spanish",
"fa-AF": "Dari",
"fr-CA": "Canadian French",
"fr-CH": "Swiss French",
"nds-NL": "Low Saxon",
"nl-BE": "Flemish",
"pt-BR": "Brazilian Portuguese",
"pt-PT": "European Portuguese",
"ro-MD": "Moldavian",
"sr-ME": "Montenegrin",
"sw-CD": "Congo Swahili",
"zh-Hans": "Simplified Chinese",
"zh-Hant": "Traditional Chinese",

(Source: https://github.com/unicode-cldr/cldr-localenames-modern/blob/master/main/en/languages.json)

Example on codesandbox.io

Edit @phensley/cldr language name bug example

Possible issue location

https://github.com/phensley/cldr-engine/blob/master/packages/cldr-schema/src/code/names.ts#L6

Once again, thanks for all the hard work.

phensley commented 4 years ago

@mate-h Thanks for the report - I have a branch which fixes this; I'll prioritize getting it merged ASAP.

phensley commented 4 years ago

@mate-h This is fixed in 0.25.3