Skip to content

docs: add a fork guide for target languages, prompts and backends - #44

Merged
0xra0 merged 1 commit into
mainfrom
docs/forking-guide
Aug 1, 2026
Merged

0xra0 merged 1 commit into
mainfrom
docs/forking-guide

Conversation

@0xra0

@0xra0 0xra0 commented Aug 1, 2026

Copy link
Copy Markdown
Owner

What

A new FORKING.md for people who fork this editor to add their own target language, their own translation voice, or their own quality checks — and which of those need a fork at all.

Why

Adding a translation target language touches about eight tables, and every one of them is a dict.get() with a fallback. A fork that registers the code and stops gets a working picker and silently worse output, with nothing logged:

>>> EncodingConverter.get_encodings_for_locale("cs")
('utf-8', 'windows-1252')      # wrong — Czech is Central European
>>> EncodingConverter.get_encodings_for_locale("czech")
('utf-8', 'windows-1250')      # the entry that exists
>>> default_style_rule("cs")
'Write natural, polished cs appropriate to…'   # the bare code as the name

Czech is the worked example precisely because the repo is already half-wired for it (spell_checker.LANG_TO_DICT and quality_checker._LATIN_SCRIPT_TARGETS know cs; a cs_CZ UI translation ships), so it shows both what you add and what quietly defaults to something wrong.

Contents

  1. What doesn't need a fork — Prompt Editor, glossary, protected terms, player gender, Modelfiles, themes, BSE_CONFIG_DIR
  2. Adding a target language — the one-line minimum, then _LANG_DISPLAY, _TARGET_STYLE, ENCODING_PAIRS, _GENDERED_TARGETS, the four-file word-list procedure, spell check, QC wiring, optional language-specific checkers, font/width verification, and a 10-row checklist
  3. Custom prompts — the three layers with no code, then the full assembly order of to_system_prompt() and how to add a PROMPT_DIALS entry
  4. Adding a backend — the worker signal interface and where routing happens
  5. Other extension points — themes, _FIELD_DEFS, string categories, lore RAG, new settings
  6. Keeping a fork mergeable — every step in §2 is an entry in an existing table, never a modified line

Two findings worth flagging on their own:

  • Prompt rule 3(a) ships ~30 Ukrainian bracket-token examples ([Lie]→[Збрехати], …) to every target — ask for German and the model still sees a wall of Cyrillic. Documented so a fork knows to swap them.
  • The Prompt Editor's language combo is built from _LANG_DISPLAY, not SUPPORTED_LANGUAGES, so a language added only to the latter cannot be given a custom Rule 1 through the UI.

Interface language vs translation target

These were easy to confuse, so both files now open by naming the distinction, and TRANSLATING.md's ambiguous "Adding a new language" heading is now "Adding a new interface language" (its in-page anchor updated to match).

Verification

Every factual claim was checked against the live modules with a 32-assertion script rather than written from memory — symbol names, fallback values, which sets gate which check, and the get_prompt_customizations() == ({}, "", {}) contract. docs/forking.rst follows the contributing.rst convention (summarise and link out rather than keep a second copy that drifts); Sphinx builds clean under -W.

No Python changed.

🤖 Generated with Claude Code

Adding a translation target language is an entry in about eight tables, and
every one of them is a `dict.get()` with a fallback — so a fork that registers
the code and stops gets a working picker and silently worse output, with
nothing logged. FORKING.md documents each table in the order it bites, using
Czech as the worked example because the repo is already half-wired for it
(spell_checker and _LATIN_SCRIPT_TARGETS know `cs`; a cs_CZ UI ships), which is
what makes the silent defaults visible:

  get_encodings_for_locale("cs")    -> ('utf-8', 'windows-1252')   wrong
  get_encodings_for_locale("czech") -> ('utf-8', 'windows-1250')   the entry
  default_style_rule("cs")          -> "...polished cs..."         bare code

Also covered: the Prompt Editor's three layers and how to_system_prompt()
assembles them (including that rule 3(a) ships ~30 Ukrainian bracket-token
examples to *every* target, which a non-Ukrainian fork should swap); the worker
signal interface for a new backend; themes, plugin field types and new
settings; and which tests catch a language change — notably that
test_download_lang_dicts.py derives its coverage from the checker modules, so a
word-list checker without a downloader entry fails the suite.

Documentation of the app's own UI locales stays in TRANSLATING.md. The two were
easy to confuse, so both files now open by naming the distinction, and the
ambiguous "Adding a new language" heading there is now "Adding a new interface
language" (in-page anchor updated with it).

docs/forking.rst follows the contributing.rst convention: summarise and link
out rather than keep a second copy that drifts. Sphinx builds clean under -W.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@0xra0
0xra0 merged commit f444a1a into main Aug 1, 2026
6 checks passed
@0xra0
0xra0 deleted the docs/forking-guide branch August 1, 2026 18:34
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