From 7a9c6289a2dd97d08c8bda3cc0751cfb21183301 Mon Sep 17 00:00:00 2001 From: Brian Beggs Date: Thu, 25 Jun 2026 14:37:45 -0400 Subject: [PATCH] feat: add Uzbek language support Adds the Uzbek (`uz`) locale to the i18n supported locales list, along with the corresponding FormatJS plural-rules and relative-time-format locale data, the i18n-iso-countries locale registration, and the messages PropTypes shape. Mirrors the prior Vietnamese support change (#825). Uzbek translations already exist for downstream MFEs in the openedx-translations pipeline; this change lets frontend-platform recognize `uz` as an expected locale (silencing the dev-mode "Unexpected locale" warning) and ensures plural/relative-time formatting and localized country names work for `uz`. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/i18n/countries.js | 2 ++ src/i18n/lib.js | 4 ++++ src/i18n/lib.test.js | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/i18n/countries.js b/src/i18n/countries.js index f1a487165..3ab85b07a 100644 --- a/src/i18n/countries.js +++ b/src/i18n/countries.js @@ -15,6 +15,7 @@ import ptLocale from 'i18n-iso-countries/langs/pt.json'; import ruLocale from 'i18n-iso-countries/langs/ru.json'; import ukLocale from 'i18n-iso-countries/langs/uk.json'; import viLocale from 'i18n-iso-countries/langs/vi.json'; +import uzLocale from 'i18n-iso-countries/langs/uz.json'; import { getPrimaryLanguageSubtag } from './lib'; @@ -41,6 +42,7 @@ COUNTRIES.registerLocale(ruLocale); // COUNTRIES.registerLocale(thLocale); // Doesn't exist in lib. COUNTRIES.registerLocale(ukLocale); COUNTRIES.registerLocale(viLocale); +COUNTRIES.registerLocale(uzLocale); /** * Provides a lookup table of country IDs to country names for the current locale. diff --git a/src/i18n/lib.js b/src/i18n/lib.js index eb0f1dfe8..3019f3552 100644 --- a/src/i18n/lib.js +++ b/src/i18n/lib.js @@ -18,6 +18,7 @@ import '@formatjs/intl-pluralrules/locale-data/ru'; import '@formatjs/intl-pluralrules/locale-data/th'; import '@formatjs/intl-pluralrules/locale-data/uk'; import '@formatjs/intl-pluralrules/locale-data/vi'; +import '@formatjs/intl-pluralrules/locale-data/uz'; import '@formatjs/intl-relativetimeformat/polyfill'; import '@formatjs/intl-relativetimeformat/locale-data/ar'; @@ -35,6 +36,7 @@ import '@formatjs/intl-relativetimeformat/locale-data/ru'; import '@formatjs/intl-relativetimeformat/locale-data/th'; import '@formatjs/intl-relativetimeformat/locale-data/uk'; import '@formatjs/intl-relativetimeformat/locale-data/vi'; +import '@formatjs/intl-relativetimeformat/locale-data/uz'; const cookies = new Cookies(); const supportedLocales = [ @@ -55,6 +57,7 @@ const supportedLocales = [ 'th', // Thai 'uk', // Ukrainian 'vi', // Vietnamese + 'uz', // Uzbek ]; const rtlLocales = [ 'ar', // Arabic @@ -224,6 +227,7 @@ const messagesShape = { th: PropTypes.objectOf(PropTypes.string), // Thai uk: PropTypes.objectOf(PropTypes.string), // Ukrainian vi: PropTypes.objectOf(PropTypes.string), // Vietnamese + uz: PropTypes.objectOf(PropTypes.string), // Uzbek }; const optionsShape = { diff --git a/src/i18n/lib.test.js b/src/i18n/lib.test.js index 75b82ec9f..b4b2626b1 100644 --- a/src/i18n/lib.test.js +++ b/src/i18n/lib.test.js @@ -80,7 +80,7 @@ describe('lib', () => { messages: {}, }); - expect(console.warn).toHaveBeenCalledTimes(16); + expect(console.warn).toHaveBeenCalledTimes(17); expect(console.warn).toHaveBeenCalledWith('Missing locale: ar'); expect(console.warn).toHaveBeenCalledWith('Missing locale: es-419'); expect(console.warn).toHaveBeenCalledWith('Missing locale: fr'); @@ -95,6 +95,7 @@ describe('lib', () => { expect(console.warn).toHaveBeenCalledWith('Missing locale: th'); expect(console.warn).toHaveBeenCalledWith('Missing locale: uk'); expect(console.warn).toHaveBeenCalledWith('Missing locale: vi'); + expect(console.warn).toHaveBeenCalledWith('Missing locale: uz'); }); });