module I18n:sig..end
Internationalization.
This module provide ways to automatically translate strings into the user's language. The translations are grouped by contexts (predefined contexts correspond to Bogue's modules); this allows different translations for the same English word, depending on the context. If a translation is not found in the current context, all contexts will be examined.
Example for a one-time translation of the string "save as" in the File context:
module I = I18n.File
print_endline (I.gettext "save as")
Example for declaring a cached translated variable s to be re-used several times:
module I = I18n.File
let s = I.tt "save as" in
print_endline (I.tf s)
...

LANGUAGE=zh BOGUE_LABEL_FONT="/usr/share/fonts/opentype/noto/NotoSerifCJK-Regular.ttc"
type locale = {
|
language : |
|
country : |
}
val get_locales : unit -> locale listReturn the list of preferred locales as detected from the user's OS.
module type ContextInit =sig..end
Functions available in every context.
Translation files are located in the locales directory of Bogue's
share directory. See Where are
the config files?. They are called "locale_ll_CC.conf" where ll
is the language code and CC the country code, for instance
"locale_fr_FR.conf". They can also be called simply "locale_ll.conf"
for translations which follow the language's main dialect.
We don't use the traditional ".po" syntax: for simplicity, the syntax of the translation files is the one of Bogue's configuration files: each translation is written on a new line of the form
English text = Translated text
for instance
Save as = Enregistrer sous
The strings (English and translated) should not contain any equal ('=') char. There is a special syntax for contexts: the line
__CONTEXT = Context name
indicates that the following translations should apply to the context
called "Context name", up until a new __CONTEXT line.
val save_locale : ?domain:string -> locale -> unitSave the translation file for the given locale (including all contexts,
and all user additions made with add_translation). The file is saved in
the domain (= application) directory, which must be found under a
"share" directory, as given by the function
Theme.find_share domain ".".
If this dir is not found, the locale is saved in the current
directory.
module File:sig..end
module Menu:sig..end
module Popup:sig..end
module Text_input:sig..end