ludic.i18n: keys (phase 26.1) - en.po as the base, tr/trf/trn marked strings made into text by L, keyed plurals, the fallback to English then the key ([[key]] loud in a dev build), the English form beside it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 23:16:12 +03:00
parent 82c652ca31
commit f0096aec87
10 changed files with 355 additions and 4 deletions

View file

@ -3,6 +3,7 @@ export function i18n_use(i18n_st: mut I18nState, code: string) -> void {
if i18n_st.codes == null { i18n_init(i18n_st) }
i18n_st.on = false
i18n_st.cur = "en"
kc_clear(i18n_st)
var k = i18n_index(i18n_st, code)
let forced = I18nWorld.forced()
if len(forced) > 0 { k = i18n_index(i18n_st, forced) }
@ -36,6 +37,7 @@ export function i18n_use(i18n_st: mut I18nState, code: string) -> void {
@alloc_ok("on a language change: the language's messages read in")
export function i18n_load_text(i18n_st: mut I18nState, text: string) -> void {
let es = i18n_parse(text)
kc_clear(i18n_st)
i18n_st.exact = Dict.new()
i18n_st.out = new []string
i18n_st.cache = Dict.new()
@ -82,6 +84,7 @@ export function i18n_load_text(i18n_st: mut I18nState, text: string) -> void {
# English again: nothing loaded, nothing translated
export function i18n_off(i18n_st: mut I18nState) -> void {
kc_clear(i18n_st)
i18n_st.on = false
i18n_st.cur = "en"
}