Skip to content

feat(i18n): language-aware AI surfaces (ko/en/ja) + v0.9.1 - #24

Merged
devlikebear merged 6 commits into
mainfrom
feat/companion-language-aware
Jul 5, 2026
Merged

feat(i18n): language-aware AI surfaces (ko/en/ja) + v0.9.1#24
devlikebear merged 6 commits into
mainfrom
feat/companion-language-aware

Conversation

@devlikebear

Copy link
Copy Markdown
Owner

Summary

  • Make every AI surface follow the selected app language (Korean/English/Japanese): companion system+context prompts, inline editor AI, contextual edit, Fact Book prompts, tool status text, apply results, and query outputs
  • Translate canonical outline node labels (부/장/씬/권/화) in AI prompts and the workspace UI (Arc 1 / Episode 1 / 第1巻 / 第1話)
  • Add English/Japanese intent-detection keywords so non-Korean requests classify (scene write/rewrite, direct apply, research) like Korean ones
  • Frontend context-checklist section labels translated by stable section id (ko/en/ja)
  • Summarizer prompts now follow the manuscript's own language (background job)
  • Bump version to 0.9.1

Verification

  • Engine: full go test ./... green, incl. new en/ja prompt tests and node.DisplayLabel tests
  • Frontend: tsc clean, 281 vitest tests green
  • Manually verified in the release build: English UI → English companion replies + English context labels; Japanese UI → Japanese inline-AI prose, Japanese Fact Book candidates, 第1巻/第1話 labels

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.
@sonarqubecloud

sonarqubecloud Bot commented Jul 5, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
9.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@devlikebear
devlikebear merged commit 23e0bb3 into main Jul 5, 2026
4 of 5 checks passed
@devlikebear
devlikebear deleted the feat/companion-language-aware branch July 5, 2026 08:49
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