Skip to content

feat(i18n): add config.supportedLanguages to filter and order UI language list#17190

Open
iospro wants to merge 1 commit intojitsi:masterfrom
iospro:feat/add-config-supportedLanguages-to-filter-and-order-UI-language-list
Open

feat(i18n): add config.supportedLanguages to filter and order UI language list#17190
iospro wants to merge 1 commit intojitsi:masterfrom
iospro:feat/add-config-supportedLanguages-to-filter-and-order-UI-language-list

Conversation

@iospro
Copy link
Contributor

@iospro iospro commented Mar 22, 2026

Summary

  • Added config.supportedLanguages option to restrict and reorder the language list shown in UI settings
  • Introduced supportedLanguages.ts as the single source of truth for all language constants
  • Language filtering works correctly on both web (static init) and native (reactive via Redux)

Changes

File Details
config.js Added // supportedLanguages: ['en', 'ru', 'de'] option near defaultLanguage
configType.ts Added supportedLanguages?: Array<string> to IConfig
base/i18n/supportedLanguages.ts New file: exports LANGUAGES (all) and SUPPORTED_LANGUAGES (filtered by config)
base/i18n/i18next.ts Re-exports from supportedLanguages.ts; whitelist uses [DEFAULT_LANGUAGE, ...SUPPORTED_LANGUAGES]
base/i18n/languageDetector.web.ts Uses LANGUAGES for case normalization only; filtering delegated to i18next whitelist
base/i18n/languageDetector.native.ts Uses LANGUAGES for locale detection (consistent with web)
base/i18n/functions.any.ts Added getSupportedLanguages(state) Redux selector
settings/components/native/LanguageSelectView.tsx Uses useSelector(getSupportedLanguages) for reactive language list on native
settings/functions.any.ts Uses SUPPORTED_LANGUAGES for web language selector

How it works

Web: window.config is available before the JS bundle loads → SUPPORTED_LANGUAGES is correctly computed at module init time → used directly in i18next whitelist and settings UI.

Native: config arrives via Redux after connecting → getSupportedLanguages(state) selector reads config.supportedLanguages reactively → LanguageSelectView re-renders with the correct filtered list.

Responsibilities:

Layer Responsibility
supportedLanguages.ts Compute filtered list from window.config (web)
i18next whitelist Enforce allowed languages in i18next engine
Language detectors Normalize/detect only — no filtering
getSupportedLanguages selector Filter for native UI from Redux state

@jitsi-jenkins
Copy link

Hi, thanks for your contribution!
If you haven't already done so, could you please make sure you sign our CLA (https://jitsi.org/icla for individuals and https://jitsi.org/ccla for corporations)? We would unfortunately be unable to merge your patch unless we have that piece :(.

@iospro iospro force-pushed the feat/add-config-supportedLanguages-to-filter-and-order-UI-language-list branch from da14658 to 7e86459 Compare March 22, 2026 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants