feat(ai): respond in user's language via browser locale#835
Open
Jonjon-prog wants to merge 2 commits intoafadil:mainfrom
Open
feat(ai): respond in user's language via browser locale#835Jonjon-prog wants to merge 2 commits intoafadil:mainfrom
Jonjon-prog wants to merge 2 commits intoafadil:mainfrom
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pass navigator.language from the frontend to the backend on every message. When the locale is non-English, the system prompt instructs the assistant to respond in that language and follow its formatting conventions.
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
Hi :)
While using the AI assistant in French, I noticed it always replied in English — even when I was writing in French. This small change makes it automatically respond in the user's language based on their browser/OS locale.
How it works
navigator.languageis sent from the frontend with every messageRespond in the language and formatting conventions for locale: fr-FRen,en-US) are unaffected — no instruction is addedFiles changed
crates/ai/src/types.rs— addlocalefield toSendMessageRequestcrates/ai/src/chat.rs— inject locale instruction into the system promptapps/frontend/src/features/ai-assistant/types.ts— addlocaletoAiSendMessageRequestapps/frontend/src/features/ai-assistant/hooks/use-chat-runtime.ts— passnavigator.languageTest plan
Checklist
By submitting this PR, I agree to the CLA.