Skip to content

feat(ai): respond in user's language via browser locale#835

Open
Jonjon-prog wants to merge 2 commits intoafadil:mainfrom
Jonjon-prog:feat/ai-locale-language
Open

feat(ai): respond in user's language via browser locale#835
Jonjon-prog wants to merge 2 commits intoafadil:mainfrom
Jonjon-prog:feat/ai-locale-language

Conversation

@Jonjon-prog
Copy link
Copy Markdown
Contributor

@Jonjon-prog Jonjon-prog commented Apr 10, 2026

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.language is sent from the frontend with every message
  • When the locale is non-English, a language instruction is added to the system prompt: Respond in the language and formatting conventions for locale: fr-FR
  • English users (en, en-US) are unaffected — no instruction is added

Files changed

  • crates/ai/src/types.rs — add locale field to SendMessageRequest
  • crates/ai/src/chat.rs — inject locale instruction into the system prompt
  • apps/frontend/src/features/ai-assistant/types.ts — add locale to AiSendMessageRequest
  • apps/frontend/src/features/ai-assistant/hooks/use-chat-runtime.ts — pass navigator.language

Test plan

  • Set your OS/browser language to French (or any non-English language)
  • Send a message to the AI assistant
  • Verify the response is in French (or your configured language)
  • Verify English users still get English responses

Checklist

By submitting this PR, I agree to the CLA.

Jonjon-prog and others added 2 commits April 6, 2026 09:23
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.
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.

1 participant