examples: text keys - lang/i18n (k"" and kn"" keys, == on them, a @Text Key field's derived key, @TextKey, a component's t('key', ...) and its one line of English left, en.po with a plural and descriptions, tr.po missing, fuzzy and extra) and rejected/i18n_keys (a key en.po lacks, a plural key without msgid_plural, a Key / string mix-up, a derived key en.po lacks, a template's missing t() key, hole counts and an undescribed split); their cases in ludic-dev test (added, not run)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 23:38:03 +03:00
parent 4988adb170
commit f9808e31ec
17 changed files with 243 additions and 0 deletions

View file

@ -0,0 +1,12 @@
# phase 26: a @Text Key field a row leaves out takes its derived key (things.axe.name), and en.po must
# have it; a @Text string field still holding English is a warning, counted as english_left
program DataMissing {
property Thing {
key: string = ""
@Text name: Key = null
@Text blurb: string = ""
}
registry Things of Thing as TH
def Things axe { blurb: "A sharp axe" }
entry { print(TH_COUNT) }
}

View file

@ -0,0 +1,11 @@
# phase 26: a key literal en.po does not have is refused, and so is a plural key (kn"...") whose
# en.po entry has no msgid_plural; trf given more values than the English has holes is a warning
program KeyMissing {
function tr(key: Key) -> string { return string(key) }
function trf(key: Key, a: string, b: string) -> string { return string(key) + a + b }
entry {
print(tr(k"pause.gone"))
print(tr(kn"pause.resume"))
print(trf(k"hud.day", "1", "2"))
}
}

View file

@ -0,0 +1,11 @@
# phase 26: a Key is not a string and a string is not a Key - text is made from a key, and a key is
# written k"..."; nor does a key join text with +
program KeyMixup {
function show(s: string) -> void { print(s) }
function name_of(k: Key) -> Key { return k }
entry {
show(k"pause.resume")
let k2 = name_of("Resume")
print(k2 + "!")
}
}

View file

@ -0,0 +1,18 @@
# The source language of the refused examples: two keys, and one English under two undescribed keys.
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
#. On the pause menu: returns to play.
msgid "pause.resume"
msgstr "Resume"
#. The day on the HUD. {1} = the day number
msgid "hud.day"
msgstr "Day {1}"
msgid "shop.close"
msgstr "Close"
msgid "map.close"
msgstr "Close"

View file

@ -0,0 +1,2 @@
# the key checks' refusals (key_missing, t_missing, key_mixup, data_missing): lang/en.po is the source
lang "lang" en

View file

@ -0,0 +1,4 @@
# Menu.ludic - t_missing.ludic's component: one key en.po lacks
component Menu {
prop day: int = 1
}

View file

@ -0,0 +1,5 @@
<div class="menu">
<p>{t('pause.resume')}</p>
<p>{t('menu.gone')}</p>
<p>{t('hud.day')}</p>
</div>

View file

@ -0,0 +1,7 @@
# phase 26: a template's t('key') is checked against en.po like a key literal - refused when en.po lacks
# it; t('hud.day') with no value for its {1} is a warning
import "ludic.ui"
program TMissing {
import "parts/Menu.ludic"
entry { print(1) }
}