string getSystemLanguage()

Current system language.

string getCurrentLanguage()

Current application language by langlocal settings.

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_US, en_GB, eo, fr_CA, ru_RU, etc.), first locale is en_US 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_US, en_GB, eo, fr_CA, ru_RU, etc.), first locale is en_US 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_US": "One", "eo": "Unu"},{"en_US": "Two", "eo": "Du"}] Translations must contain "en_US" 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_US": "One", "eo": "Unu"},{"en_US": "Two", "eo": "Du"}] Translations must contain "en_US" always.

Parameters

json

Filled JSON object with translations.

language

A new current language (system language by default).

void chooseLanguage(string language)

This function allows to choose current locale for application.

string s_(string englishString)

This function returns string corresponding to the English (en_US) version, according to the current localization selected.

The module implements the simplest system for creating language localizations.

Public imports