feat(i18n): language-aware AI surfaces (ko/en/ja) + v0.9.1 - #24
Merged
Conversation
The companion system prompt and context were hardcoded Korean, so the AI always replied in Korean even with the UI set to English. Thread the selected app language from the desktop client through to prompt building. - prompt.go: buildSystem(lang)/buildContext(d, lang) branch to English when lang starts with "en"; add buildSystemEn and English section headers/labels, otherwise keep Korean as the default. - companion.go/runner.go: add SendOptions.Language, pass it to runner.start. - rpc.ts/useCompanion.ts: send the current useI18n() language on every turn. - tests: cover the English system prompt and context labels; update existing buildSystem/buildContext call sites for the new signatures.
displayNodeLabel recognized 씬/Scene and 장/Chapter but not the web-novel 권(part) and 화(chapter) labels, so an English UI still showed "1권"/"1화" in the outline, breadcrumb, and editor title. Match those patterns across ko/en/ja and render via the existing webNovelPartNumber/ChapterNumber keys.
Follow-up to the companion prompt fix: many engine strings that reach the UI or the model were still hardcoded Korean. Split them by destination: - Frontend-rendered labels: context-checklist section labels are now translated in the frontend by stable section id (ko/en/ja keys), with the engine label as fallback; companion checklist uses a "companion" variant. - Model-facing prompts: editor AI-run prompts (ai.Options.Language), contextualedit plan/consistency messages, companion query results, the direct-apply correction nudge, and the compact-history summary all branch by language. Both companion system prompts now pin the response language explicitly so history in another language cannot flip replies. - Runner status/result strings (tool status, applied/cancelled/apply results) localize via the run's language. - Summarizer prompts now follow the manuscript's own language (background job with no UI-language signal). - Intent/apply/research detection keyword lists gain English equivalents so English requests classify like Korean ones.
The earlier language branching was binary (en vs Korean default), so a Japanese UI still produced Korean AI output. Extend every localized surface to three languages: - pickLang/langPick become (lang, ko, en, ja); add isJapanese helpers. - buildSystemJa: full Japanese companion system prompt with an explicit "always respond in Japanese" line; Japanese context section labels, reference purpose labels/instructions, and entity kind labels. - Japanese editor AI-run prompts (persona, tone directives, section headers, project-meta labels). - Japanese runner status/result strings, query results, compact-history labels, and contextualedit plan/consistency messages. - Japanese intent/apply/research detection keywords so Japanese requests classify like Korean ones (scene-write/rewrite, direct apply, research).
Two remaining Korean leaks with a non-Korean UI: - Stored node labels are canonical Korean (1권/1화/씬 1/1부/1장), and AI prompts showed them raw, so the model echoed Korean labels. Add node.DisplayLabel/DisplayBreadcrumb (ko/en/ja, both directions) and apply in companion buildContext (outline tree, excerpts, spine), companion query results, and editor-AI buildUser (scene label, nearby/related breadcrumbs). Also add the missing N부/Part/第N部 pattern to the frontend displayNodeLabel (keys already existed). - FactBookPanel hardcoded Korean user-turn prompts (scene review, fact-check, alternative-source) and the "검색 후 자료집에 저장:" choice prefix, which pulled replies into Korean. Move the three prompts and the prefix to i18n (ko/en/ja) and strip any language's prefix when reading a chosen claim.
|
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
Verification
go test ./...green, incl. new en/ja prompt tests and node.DisplayLabel tests