Repository navigation
feat: Localize interface.customWelcome by the user language - #17469
Open
augustobrizio wants to merge 1 commit into
Open
augustobrizio wants to merge 1 commit into
augustobrizio wants to merge 1 commit into
Conversation
customWelcome now accepts the same LocalizedString as mcpServers.trustCheckbox: a plain string, or a map from language to message resolved with useLocalizedConfig (exact locale, base language, en, first entry). A plain string behaves as before.
This branch has not been deployed
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.
Pull Request
Summary
interface.customWelcomeis a plain string, so a deployment whose users work in several languages shows its landing greeting in one of them, while every other string follows the user's interface language. Removing it does not help: the time-of-day greeting keys (com_ui_greeting_*) are not translated in several bundles, Spanish among them.This PR lets
customWelcometake the sameLocalizedStringthatinterface.mcpServers.trustCheckboxalready uses: either a plain string, as today, or a map from language to message.Landing.tsxresolves it with the existinguseLocalizedConfighook: exact locale, then base language, thenen, then the first entry.{{user.name}}substitution is unchanged, and a plain string behaves exactly as before.We run LibreChat for Spanish- and English-speaking users, and the greeting was the one line our Spanish-speaking users saw in English. Until a release carries this, we work around it by rewriting the
/api/configanswer client-side, which we would like to drop.Related to #17362. #11136 addresses a similar need with a new config object (several messages per language, a random pick, time greetings), but it predates
useLocalizedConfigand no longer merges ontodev. This is the smaller version that reuses the existing type. If you prefer that direction, I'm glad to help bring #11136 up to date instead.How it works
Type of change
Testing
The resolution order is the one
useLocalizedConfigalready applies totrustCheckbox; the new cases pin it for the landing greeting.Tested environments/configuration:
Automated tests:
client/src/components/Chat/__tests__/Landing.agent-contact.spec.tsx:es-ARresolves theesentry,en-UStheenentry, andfrfalls back toen. They fail on the currentLanding.tsxand pass with this change. The existing single-string case still passes.packages/data-providerspecs/configpasses.npm run static-checks:full -- --against origin/devpasses (ESLint, Prettier, import sorting, circular dependencies, TypeScript, config migration tests, unused i18n keys). The unused-packages check was skipped becausedepcheckis not installed.devinto a local copy: the Landing spec (13/13), the data-provider build andtsc --noEmitpass.test:client/test:apisuites and e2e.Screenshots / recordings
No visual change: the greeting keeps its component and styling, and only which configured string it shows depends on the language.
Risk / compatibility
Backwards compatible: a plain string validates and renders as before. The schema change widens
customWelcomefromstringtostring | Record<string, string>. Server code only passes it through (data-schemas/src/app/interface.ts), and admin config overrides that set it to a string keep working. Documentation forlibrechat.aiwould follow if this direction is accepted.Checklist