# ports.ludic - what the languages ask the game: where a player's own .po files are, a code that # overrides the choice (a test in a language), and the overlay's font atlas, which is the game's export port I18nWorld { mod_dir: fn() -> string = fn i18n__no_dir # "" is no mod folder forced: fn() -> string = fn i18n__no_code # "" is the code asked for font_ready: fn() -> bool = fn i18n__no # is there an overlay to load a font into set_font: fn(string) -> bool = fn i18n__no_font # load this atlas directory; false if it could not } function i18n__no_dir() -> string { return "" } function i18n__no_code() -> string { return "" } function i18n__no() -> bool { return false } function i18n__no_font(dir: string) -> bool { return false } export state I18nState { lang_dir: string = "assets/lang" font_default: string = "assets/kit/font" on: bool = false # a language other than English is drawing cur: string = "en" codes: []string = null # every language found, "en" first names: []string = null paths: []string = null fonts: []string = null # a font atlas directory, "" for the game's own font_now: string = "" exact: Dict = null # msgid -> index into out out: []string = null plural: Dict = null # a plural msgid (the singular) -> index into forms / 3 forms: []string = null # three forms per entry, "" where the file has fewer plural_rule: int = 0 # PL_* tabs: []I18nTables = null # by language: its lookups once read, kept for the next switch base_exact: Dict = null # en.po, under every language: a key -> index into base_out base_out: []string = null base_plural: Dict = null # a plural key -> index into base_forms / 3 base_forms: []string = null base_rule: int = 0 base_tried: bool = false kc: Dict = null # a marked string (key and args) -> index into kc_out, in this language kc_out: []string = null loud: bool = false # a developer's build: a key en.po lacks draws as [[key]], said once said: Dict = null } # where the shipped languages are (a directory with languages.txt and .po), and the atlas a # language with no X-Font draws in export function i18n_config(i18n_st: mut I18nState, dir: string, default_font: string) -> void { i18n_st.lang_dir = dir i18n_st.font_default = default_font i18n_st.codes = null }