ludic/packages/ludic.i18n/translate.ludic

10 lines
627 B
Text

# translate.ludic - what the game draws, in the language in use: a key (keyed_render.ludic), a line with
# a key glued into it (mixed.ludic) or bracketed inside it (nest.ludic); anything else is drawn as it is -
# a player's name, a chat line, a number. English lives in en.po under keys, never looked up by its words
export function L(i18n_st: mut I18nState, s: string) -> string {
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) }
return s
}