Vendetta/babel: Difference between revisions
Created Babel page. links and api are placeholder. |
updated to include current v1.2.0 api, work in progress |
||
Line 14: | Line 14: | ||
== For users == | == For users == | ||
Babel can be installed like any | Babel can be installed like any LME plugin. By default, it internally only supports EN, ES, FR, and PT languages. These languages can be easily expanded with additional addons. Plugins must also support the language being used, but this can likewise be expanded easily. | ||
Once added to your game, verify it is enabled. The first time it is ever run, it will try to default to the user's selected game locale, or use english. To select another language to use in Babel and all supported plugins, open the configuration interface with the command /babel, or by using the config option in your LME manager; the language options will be visible in a drop-down. | Once added to your game, verify it is enabled. The first time it is ever run, it will try to default to the user's selected game locale, or use english. To select another language to use in Babel and all supported plugins, open the configuration interface with the command /babel, or by using the config option in your LME manager; the language options will be visible in a drop-down. | ||
== | == Modding usage == | ||
Babel | <usage> | ||
== Modding API == | |||
{| class="wikitable" | |||
|- | |||
! Function || Input arguments || Output values || Description | |||
|- | |||
| add_translation || babel.add_translation(string file_path, string lang_code) || returns nil || Registers a new language to be used with Babel's interface and language selector. | |||
|- | |||
| register_custom_lang || babel.register_custom_lang(string file_path, string lang_code) || returns nil || v1.0.x name of the 'add_translation' function. This keyword will be deprecated eventually. | |||
|- | |||
| add_new_lang || babel.add_new_lang(*type shelf_reference, string file_path, string language_code || return boolean status || Registers an additional translation 'book' to an existing 'shelf', providing new translations. Usually used as a way for mods using Babel to allow external additions to their supported languages | |||
|- | |||
| register || babel.register(string folder_path, table language_code_list) || return *type shelf_reference || Creates a new shelf and preloads it with translation 'books' provided by the language code list. | |||
|- | |||
| fetch || babel.fetch(*type shelf_reference, number string_id, string default_text) || return string output_text || Looks up and provides the translation for the provided line number. | |||
|- | |||
| get_user_lang || babel.get_user_lang (nil) || return string user_locale || Returns the language code the user has selected. If no locale is set by the user, the game locale will be passed. | |||
|- | |||
| get_langs_on_shelf || babel.get_langs_on_shelf (*type shelf_reference) || return table existing_language_codes || Returns the language codes supported by the provided shelf reference. If the shelf reference is nil, Babel's own language support is provided instead. | |||
|- | |||
| get_lang_flag || babel.get_lang_flag (string lang_code) || return string file_path || Returns a country or language flag image file associated with the provided language, if one exists. | |||
|- | |||
| get_config || babel.get_config (string option_to_retrieve) || return string option_current_value || Gets the current configuration setting for the specified value | |||
|- | |||
| set_config || babel.set_config (string option_to_modify, string new_value) || return nil || Writes the new configuration value. Some changes may require the interface to reload. | |||
|} |
Revision as of 00:14, 13 March 2025
Babel is a lightweight library that helps plugins provide easy dictionary-based translation to their interfaces
If a mod provides a table of translations for a provided language and references each line by key, it can provide a language selection for the user. If the requested language module is not available for the given plugin, or if babel is not present, it falls back to the default language contained within the plugin. In this way, Babel is an optional feature for users, but a powerful benefit to multi-lingual players.
You can download this application at the following locations
These links are incorrect, and will be updated shortly!!!
NexusMods | v1.1.0 |
VOUPR | v1.1.0 |
Github | v1.1.0 (in-development) |
For users
Babel can be installed like any LME plugin. By default, it internally only supports EN, ES, FR, and PT languages. These languages can be easily expanded with additional addons. Plugins must also support the language being used, but this can likewise be expanded easily.
Once added to your game, verify it is enabled. The first time it is ever run, it will try to default to the user's selected game locale, or use english. To select another language to use in Babel and all supported plugins, open the configuration interface with the command /babel, or by using the config option in your LME manager; the language options will be visible in a drop-down.
Modding usage
<usage>
Modding API
Function | Input arguments | Output values | Description |
---|---|---|---|
add_translation | babel.add_translation(string file_path, string lang_code) | returns nil | Registers a new language to be used with Babel's interface and language selector. |
register_custom_lang | babel.register_custom_lang(string file_path, string lang_code) | returns nil | v1.0.x name of the 'add_translation' function. This keyword will be deprecated eventually. |
add_new_lang | babel.add_new_lang(*type shelf_reference, string file_path, string language_code | return boolean status | Registers an additional translation 'book' to an existing 'shelf', providing new translations. Usually used as a way for mods using Babel to allow external additions to their supported languages |
register | babel.register(string folder_path, table language_code_list) | return *type shelf_reference | Creates a new shelf and preloads it with translation 'books' provided by the language code list. |
fetch | babel.fetch(*type shelf_reference, number string_id, string default_text) | return string output_text | Looks up and provides the translation for the provided line number. |
get_user_lang | babel.get_user_lang (nil) | return string user_locale | Returns the language code the user has selected. If no locale is set by the user, the game locale will be passed. |
get_langs_on_shelf | babel.get_langs_on_shelf (*type shelf_reference) | return table existing_language_codes | Returns the language codes supported by the provided shelf reference. If the shelf reference is nil, Babel's own language support is provided instead. |
get_lang_flag | babel.get_lang_flag (string lang_code) | return string file_path | Returns a country or language flag image file associated with the provided language, if one exists. |
get_config | babel.get_config (string option_to_retrieve) | return string option_current_value | Gets the current configuration setting for the specified value |
set_config | babel.set_config (string option_to_modify, string new_value) | return nil | Writes the new configuration value. Some changes may require the interface to reload. |