Skip to content

Translate remaining untranslated NetHack messages into Japanese - #64

Closed
kafuji wants to merge 22 commits into
JamesIV4:mainfrom
kafuji:claude/japanese-localization-completion-e5995e
Closed

kafuji wants to merge 22 commits into
JamesIV4:mainfrom
kafuji:claude/japanese-localization-completion-e5995e

Conversation

@kafuji

@kafuji kafuji commented Nov 1, 2026

Copy link
Copy Markdown

Summary

  • Adds ~1,800 Japanese renderings to src/i18n/data/nethack5-source-ja.json for message formats that were still shown in English, including assembled messages such as Kaablamm! You hear an explosion in the distance! and The flute toots.
  • Fixes half-translated output (e.g. Somehow, the jackalの攻撃はwildlyに…): when an earlier generic rule leaves English words, later translation layers are tried and the one with the least English wins; JNetHack is likewise preferred over a curated rendering that kept English
  • A single unknown lowercase word captured by a template (e.g. a hallucinatory colour) is now treated as English
  • Adds scripts/i18n/extract-source-messages.mjs and an opt-in test (src/i18n/source-message-coverage.test.ts, enabled by NH_MESSAGE_SAMPLES) that lists NetHack source messages still displayed in English; usage is in src/i18n/data/README.md

Detection

Every pline-family call in the NetHack 3.6.7 and 5.0 sources was turned into sample messages and run through presentGameMessage. Flagged formats went from 768 → 435 (5.0) and 721 → ~350 (3.6.7); the remainder were reviewed by hand and are mostly nonsense samples from guessed arguments, fully generic formats (%s %s.), or debug output.

Testing

  • tsc --noEmit passes; new regression tests in message-presentation-guard.test.ts
  • Full vitest run: 7 failures. 6 fail identically on main without this change (help-text CRLF, constructor lookup, two assembled-message cases, prompt test). The 7th (platform.test.ts VR quit) is unrelated to i18n and was not compared against main.
  • Not checked in the running game

🤖 Generated with Claude Code

claude and others added 22 commits October 30, 2026 18:54
- Update checker queries kafuji/nethack-3d-plus releases
- Vite GitHub Pages base follows the repository name
- README and privacy policy credit upstream and link to this fork

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
- Run tsc, vitest, i18n:check, and startup:check-rulesets on PRs and main
- Raise timeout for the slow blood-ground rasterizer test (~7s)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
- Mount fork-only strings under en.plus (src/plus/i18n/en.ts) and add ja
  translations in src/plus/i18n/ja.ts, merged on top of upstream ja.ts
- Translate 34 ja keys that were still English
- Externalize the Top Scores dialogs, timeline, and reports; localize
  English labels stored in score records at display time
- Localize tile context actions, message navigation labels, technique
  menu headers, tileset layout names, and a few engine messages
- i18n:check tolerates locales that have not translated plus.* yet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
- Startup Top Scores button, character sheet panel titles, solid color
  picker, technique menu counters, overwrite confirmation, Unwield label
- Floating XP / experience level labels above the player
- Client-generated window titles (message history, help files)
- Trap and hidden-find labels recorded by run telemetry

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
Review of ja.ts against JNetHack conventions: role is 職業, search is
探す, explore mode is 探検; fix mistranslations (legacy intro, autoopen,
tip, quiver, version-check status), untranslated tileset details, and a
button name mismatch in the save import notice. Fork strings now reuse
upstream stat names (腕力, 器用さ, 知性).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
- scripts/plus/extract-jnethack-texts.mjs pairs JNetHack and NetHack
  sources: 419 monster names, 682 object names/appearances by category,
  and 2782 message templates from JNetHack's /*JP*/ annotations
- src/plus/game-text: template matcher, doname-style object name
  translator (counters, BUC/erosion prefixes, worn/wielded suffixes),
  and hand-written rules for runtime-composed combat messages
- Applied only when displaying the message log, floating messages,
  prompts, menus, inventory, and info windows; parsers keep English
- Lazy-loaded; toggle under Options > Display when the UI is Japanese

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
- Extract JNetHack map feature/trap names (defsym.h), dungeon branch
  names (dungeon.lua), and role/rank/god names (role.c)
- Translate stairs/altar descriptions, monster-vs-monster attacks, and
  status bar title, location, hunger and encumbrance words
- Reject template matches whose captured text stays in English, and drop
  overly generic extracted formats, to avoid garbled output

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
…prompts

- Extract quest.lua texts (legacy intro, quest dialogue) and translate
  whole info windows; extract enlightenment attribute pairs for the
  end-of-game disclosure, plus yn_function/putstr/Strcpy prompts
- Hand-written JNetHack-style rules for getobj prompts, shop greetings,
  hunger, lifting, eating, wielding, pet kills and gold notices
- Stop substituting translated verb phrases into templates and drop
  extracted templates that ignore their arguments, avoiding mistranslation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
Integrates the Japanese localization, sound and BGM work from main.

- Game text now uses three tiers: main's curated translations, then the
  JNetHack-derived translator as a fallback (messages, prompts, items,
  player titles, locations, quest windows), then unreviewed Nehww
  references marked 参考訳. JNetHack punctuation is normalized to 、。
- Conflicting UI files take main's implementation; the separate game text
  toggle is removed since translation follows the interface language
- Drop fork ja overrides that main already reworded, and unused strings
- Remove accidentally committed Node compile caches and ignore them
- Add the 18 sound-effect and music strings main added in English to the
  es, fr, ko, pt-br, ru and zh-cn locales so i18n:check passes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
Set up fork, CI, and Japanese localization (UI + in-game text)
- Add disclosure rules for background, basics, status and skill lines
  (rank/role, alignment and mission, opposed deities, HP/Pw/XP, score,
  autopickup, wielding, skills, piety, handedness, wallet, hunger, load,
  magic cancellation), reusing the curated role/rank/deity/skill names
- Extract enl_msg()/you_*() pairs generically into sentence templates for
  both tenses, including contracted negatives
- Extract sentence-like entries from literal message tables inside
  #if 0 /*JP*/ blocks (e.g. slime/stoning texts), and keep JNetHack
  translations that fold a body_part() argument into the text
- Fix #if 0 block matching that could span into the next block
- Align fork Top Scores role names with the curated vocabulary

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
Translate end-of-game disclosure and more JNetHack message tables
…exts

- Extractor expands ternary-chosen messages and arguments into paired
  variants (by condition), inlines literal %s arguments, and matches
  wrapped arguments both ways; templates grow from 3156 to 4628
- Extract humanoid body part names and use them for possessive messages
- Rules for monster weapon swings and for monster resistance gains and
  trap escapes, which JNetHack itself leaves untranslated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
Sound effects
- Nine procedural sounds for events upstream left without assets:
  explosion, ray/wand bolt, wand fizzle, potion shatter, scroll read,
  trap triggered, teleport, prayer and shop bell. They use the existing
  synth: builtin sources, so sound packs can still override them
- Message-log triggers for each, with tests, and labels in all locales

Background music
- Region-aware track preferences from the status line's dungeon name
  (Mines/Sokoban/Quest/Ludios/Gehennom/endgame); the playing track
  crossfades when the region changes
- Random starting track per mood when no region preference applies
- Stingers: a short lament on game over, and a small fanfare when
  entering a new branch, with the music ducked underneath

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
- MusicStatusEffectChain sits after the music mix: modulated delay
  (vibrato/wobble), distortion, low-pass, tremolo and stereo panner,
  plus playback-rate drift for file tracks
- Confused: pitch and pan wander irregularly; stunned: wider, faster
  sways with tremolo; hallucinating: wobbly vibrato and distortion;
  blind: slightly muffled; deaf: heavily muffled and quiet; turning to
  stone: slower and darker. Effects combine by strongest parameter
- Status bits come from the condition mask for each runtime and are
  forwarded only when they change; works with the procedural fallback

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
More game text translation, synthesized event sounds, regional and status-colored BGM
- Reject translations that still contain a 3+ word English run copied
  from the original (e.g. a pattern capturing "your displaced image and
  misses you" as a monster), falling through to JNetHack or the original
- Menu rows in question dialogs also try message translations, so
  options like "All types" and "Items of unknown Bless/Curse status"
  are shown in Japanese; tile tooltips keep their stricter behavior
- Translate quoted speech by its inner text, priest names
  ("the priestess of <deity>"), temple entry lines, and formats whose
  %s glues to the next word ("moving %sfaster") with small adverbs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0151xkPns3FZDoHATwhZvNjP
Fix mixed-language and untranslated game text from play reports
- Add ~1,800 renderings to nethack5-source-ja.json for message formats
  found by running every pline-family call in the NetHack 3.6.7 and 5.0
  sources through the display translation, including assembled messages
  such as "Kaablamm!  You hear an explosion in the distance!" and
  "The flute toots."
- Let a later translation layer win when an earlier generic rule kept
  English words ("Somehow, the jackal" read as a monster), and prefer
  JNetHack over a curated rendering that still has English left
- Treat a single unknown lowercase word captured by a template as English
- Add scripts/i18n/extract-source-messages.mjs and an opt-in coverage
  test that lists source messages still shown in English

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kafuji

kafuji commented Nov 1, 2026

Copy link
Copy Markdown
Author

Opened against the wrong repository by mistake; sorry for the noise.

@kafuji kafuji closed this Nov 1, 2026
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.

2 participants