Merge lang/i18nerror 25a57c09: English left is an error under a lang line; ludic.ui's own words are keys; reseeded

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-30 02:49:43 +03:00
commit e2aa928e95
18 changed files with 3667 additions and 3585 deletions

View file

@ -236,6 +236,12 @@ function ui_tr(ui_st: UiState, s: string) -> string {
if ui_st.ui_be != null and ui_st.ui_be.translate != null { return ui_st.ui_be.translate(s) }
return s
}
# ludic.ui's own words by key (ui.* in the program's en.po); a program with no translator bound has
# no languages, and draws `plain`
function ui_tk(ui_st: UiState, k: Key, plain: string) -> string {
if ui_st.tr_no or ui_st.ui_be == null or ui_st.ui_be.translate == null { return plain }
return ui_st.ui_be.translate(string(k))
}
function ui_sound(ui_st: UiState, name: string) -> void {
if ui_st.ui_be != null and ui_st.ui_be.sound != null { ui_st.ui_be.sound(name) }
}

View file

@ -41,7 +41,7 @@ function ct_key_pressed_away(ui_st: mut UiState, hit: UiNode) -> void {
if ui_st.ct_capture != "" and (hit == null or hit.key != ui_st.ct_capture) { ui_st.ct_capture = "" }
}
function ct_key_text(ui_st: UiState, n: UiNode) -> string {
if ui_st.ct_capture == n.key { return ui_tr(ui_st, "press a key...") }
if ui_st.ct_capture == n.key { return ui_tk(ui_st, k"ui.press_key", "press a key...") }
if Value.kind(ui_attr(n, "shown")) != 0 { return ui_tr(ui_st, ui_attr_text(n, "shown")) }
let v = Value.as_int(ui_attr(n, "value"))
if v >= UI_MOUSE_LEFT and v <= UI_MOUSE_MIDDLE { return ct_mouse_name(ui_st, v) }

View file

@ -16,7 +16,7 @@ function ct_key_mouse(ui_st: mut UiState, root: UiNode) -> bool {
return true
}
function ct_mouse_name(ui_st: UiState, v: int) -> string {
if v == UI_MOUSE_RIGHT { return ui_tr(ui_st, "Right click") }
if v == UI_MOUSE_MIDDLE { return ui_tr(ui_st, "Middle click") }
return ui_tr(ui_st, "Left click")
if v == UI_MOUSE_RIGHT { return ui_tk(ui_st, k"ui.right_click", "Right click") }
if v == UI_MOUSE_MIDDLE { return ui_tk(ui_st, k"ui.middle_click", "Middle click") }
return ui_tk(ui_st, k"ui.left_click", "Left click")
}