ludic.i18n: a line bracketed inside another (bytes 29 .. 30) is made by L itself - each bracket outermost in, a key whole through keyed() so its escaped arguments stay whole, and a split on 31 never inside a bracket (a game's txt_key puts its nested line raw); a stray bracket draws nothing. The game's tx_L did this alone, so L in a test or anywhere else drew the brackets (26.9's move, made now). nest_test holds it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-30 01:39:44 +03:00
parent d703d79feb
commit 81e1f7d8e6
5 changed files with 129 additions and 4 deletions

View file

@ -1,8 +1,10 @@
# translate.ludic - what the game draws, in the language in use: a key (keyed_render.ludic); else, the old
# English form, exact, else a pattern, else padding taken off, else a paragraph a sentence at a time
export function L(i18n_st: mut I18nState, s: string) -> string {
if kx_mixed(s) { return kx_line(i18n_st, s) }
if i18n_is_key(s) { return keyed(i18n_st, s) }
let mixed = kx_mixed(s)
if i18n_is_key(s) and not mixed { return keyed(i18n_st, s) } # a key whole: its arguments are made in it
if kx_nested(s) { return kx_nest_line(i18n_st, s) }
if mixed { return kx_line(i18n_st, s) }
if not i18n_st.on { return s }
let ci = Dict.get_or(i18n_st.cache, s, -1)
if ci >= 0 { return i18n_st.cache_out[ci] }