Skip to main content

Multilingual Support — Spanish & Hungarian

Changes​

packages/semantic-search/src/index.ts​

Fixed tokenize() for Unicode: Changed [^a-z0-9\s-] to [^\p{L}\p{N}\s-] (Unicode property escapes, u flag). Spanish and Hungarian diacritics (á, é, ő, ü, ű, ñ) are now preserved instead of stripped. This was the most critical bug — it silently destroyed non-ASCII words before grounding could run.

Added Spanish stopwords: de, la, el, que, por, más, está, este, esta, son, etc. (~25 words).

Added Hungarian stopwords: az, és, nem, egy, van, már, vagy, csak, pedig, tehát, etc. (~25 words).

Multi-language question-word stripping in defaultFanOutQueries(): Added Spanish (puedes, por favor, muéstrame…) and Hungarian (tudnál, kérem, mutasd…) request phrases.

services/backend/src/routes/bots/prompts/language.ts (new)​

Language detection and response-matching section added to the system prompt:

  • Respond in the same language the user writes in (Spanish → Spanish, Hungarian → Hungarian)
  • Technical identifiers stay in their original form (parameter names, file paths, tool names, code)
  • Strict rule: never respond in English when the user writes in another language

services/backend/src/routes/bots/prompts/builder.ts​

Added languageSection() as the final section in buildSystemPrompt().

What this does NOT cover (future work)​

  • Strategy authoring docs (authoring-guide.md, q-library.md) are English-only — if users ask questions about writing strategies in Spanish/Hungarian, the AI will answer in their language but the doc excerpts surfaced as sources will still be in English
  • SOUL.md files inside strategy bundles — these are written by the AI and can be generated in the user's language going forward
  • Formatting rules (formatting.ts) reference specific English filler phrases to avoid; equivalent filler phrases in Spanish/Hungarian are not enumerated (the model handles this via language understanding)