feat(i18n): add config.supportedLanguages to filter and order UI language list#17190
Open
iospro wants to merge 1 commit intojitsi:masterfrom
Open
Conversation
|
Hi, thanks for your contribution! |
da14658 to
7e86459
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
config.supportedLanguagesoption to restrict and reorder the language list shown in UI settingssupportedLanguages.tsas the single source of truth for all language constantsChanges
config.js// supportedLanguages: ['en', 'ru', 'de']option neardefaultLanguageconfigType.tssupportedLanguages?: Array<string>toIConfigbase/i18n/supportedLanguages.tsLANGUAGES(all) andSUPPORTED_LANGUAGES(filtered by config)base/i18n/i18next.tssupportedLanguages.ts; whitelist uses[DEFAULT_LANGUAGE, ...SUPPORTED_LANGUAGES]base/i18n/languageDetector.web.tsLANGUAGESfor case normalization only; filtering delegated to i18next whitelistbase/i18n/languageDetector.native.tsLANGUAGESfor locale detection (consistent with web)base/i18n/functions.any.tsgetSupportedLanguages(state)Redux selectorsettings/components/native/LanguageSelectView.tsxuseSelector(getSupportedLanguages)for reactive language list on nativesettings/functions.any.tsSUPPORTED_LANGUAGESfor web language selectorHow it works
Web:
window.configis available before the JS bundle loads →SUPPORTED_LANGUAGESis correctly computed at module init time → used directly in i18next whitelist and settings UI.Native: config arrives via Redux after connecting →
getSupportedLanguages(state)selector readsconfig.supportedLanguagesreactively →LanguageSelectViewre-renders with the correct filtered list.Responsibilities:
supportedLanguages.tswindow.config(web)i18next whitelistgetSupportedLanguagesselector