diff --git a/.changeset/yummy-donkeys-repair.md b/.changeset/yummy-donkeys-repair.md new file mode 100644 index 00000000..ac46ac32 --- /dev/null +++ b/.changeset/yummy-donkeys-repair.md @@ -0,0 +1,5 @@ +--- +'@theoplayer/web-ui': patch +--- + +Language names in the language menu are now capitalized according to that language's case mappings. diff --git a/src/util/CommonUtils.ts b/src/util/CommonUtils.ts index 1b673c97..35b50a59 100644 --- a/src/util/CommonUtils.ts +++ b/src/util/CommonUtils.ts @@ -106,7 +106,9 @@ export const localizeLanguageName: (languageCode: string) => string | undefined const displayNames = new Intl.DisplayNames([languageCode, 'en'], { type: 'language', fallback: 'none' }); const localName = displayNames.of(languageCode); if (localName) { - return localName.slice(0, 1).toUpperCase() + localName.slice(1); + const locale = displayNames.resolvedOptions().locale; + const [first] = localName; + return first.toLocaleUpperCase(locale) + localName.slice(first.length); } } : (_languageCode) => undefined;