void initLocalization(
in string[][] stringsWithLocalizations,
string language = ""
)
Initializes localization by a two-dimensional array of strings. Titles of columns (first line - index 0) must be locales in Linux style without encoding (en, en_GB, eo, fr_CA, ru_RU, etc.), first locale is en or en_* always.
Parameters
| stringsWithLocalizations | Two-dimensional array containing columns of strings in different languages. |
| language | New current language (system language by default). |
void initLocalizationWithCSV(string csvPath, string language = "")
Initializes localization by a CSV file with translations. Titles of columns (first line - index 0) must be locales in Linux style without encoding (en, en_US, eo, fr_CA, ru, ru_BY, etc.), first locale is en or en_* always.
Parameters
| csvPath | A path to a CSV file with translations. |
| language | A new current language (system language by default). |
void initLocalizationWithJSON(string jsonPath, string language = "")
Initializes localization by a JSON file with translations. The JSON file must contain array of objects with languages as keys and with text phrases as values.
Example
[{"en": "One", "eo": "Unu"},{"en": "Two", "eo": "Du"}] Translations must contain "en" or "en_*" always.
Parameters
| jsonPath | A path to a JSON file with translations. |
| language | A new current language (system language by default). |
void initLocalizationWithJSON(std.json.JSONValue json, string language = "")
Initializes localization by a std.json.JSON object with translations. The JSON object must contain array of objects with languages as keys and with text phrases as values.
Example
[{"en": "One", "eo": "Unu"},{"en": "Two", "eo": "Du"}] Translations must contain "en" or "en_*" always.
Parameters
| json | Filled JSON object with translations. |
| language | A new current language (system language by default). |
Public imports
Functions
| getSystemLanguage |
| getCurrentLanguage |
| initLocalization |
| initLocalizationWithCSV |
| initLocalizationWithJSON |
| chooseLanguage |
| s_ |
Classes
| LocalizationsTableException | Exception for incorrect localization tables. |
The module implements the simplest system for creating language localizations.