ludic.i18n: an English value in a key's hole gets the old English lookup (exact, pattern, sentence) while the game still hands English into holes - until its code and data are keys (phase 26.9), where it does nothing; keys_test holds it (exact, a pattern, no line, a number untouched)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-30 00:19:46 +03:00
parent 9391695fce
commit f0cf85943f
2 changed files with 18 additions and 2 deletions

View file

@ -21,7 +21,7 @@ program I18nKeysTest {
function tt() -> string {
var s = "msgid \"\"\nmsgstr \"\"\n\"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : 2);\\n\"\n\n"
s = s + po_line("pause.resume", "Devam") + po_line("hud.day", "{1}. Gun") + po_line("species.elk.a_name", "bir geyik")
s = s + po_line("catch.saw", "{2} saatinde {1} gordun.") + po_line("Settings", "Ayarlar")
s = s + po_line("catch.saw", "{2} saatinde {1} gordun.") + po_line("Settings", "Ayarlar") + po_line("Day {1}", "{1}. gun")
return s + plural("pack.items", "{1} esya", "{1} esyaa", "{1} esyalar")
}
function start (i18n_st: mut I18nState) -> void {
@ -74,4 +74,13 @@ program I18nKeysTest {
expect(L(i18n_st, tr(k"pause.resume")) == "Devam")
expect(not i18n_is_key("Settings") and i18n_is_key(i18n_key("x")) and i18n_is_key(i18n_key_plural("x")))
}
test "an English value handed into a key's hole still gets its old English line, until it is a key itself" (i18n_st: mut I18nState) {
start(i18n_st)
expect(L(i18n_st, trf(k"catch.saw", "Settings", "5:30", "", "")) == "You saw Settings at 5:30.")
i18n_load_text(i18n_st, tt())
expect(L(i18n_st, trf(k"catch.saw", "Settings", "5:30", "", "")) == "5:30 saatinde Ayarlar gordun.") # exact
expect(L(i18n_st, trf(k"catch.saw", "Day 3", "5:30", "", "")) == "5:30 saatinde 3. gun gordun.") # a pattern
expect(L(i18n_st, trf(k"catch.saw", "Nowhere known", "7", "", "")) == "7 saatinde Nowhere known gordun.") # no line: as it is
}
}