Translations
Localization of translations.
The module contains the following variables:
CURRENT_LOCALE
- Code of current language.DEFAULT_LOCALE
- Language code by default.LANGUAGES
- List of codes supported by languages.gettext
- The object of the current translator.ngettext
- The object of the current translator.
The module contains the following functions:
change_locale
- To change the current language and translation object.
CKEditor supported languages:
af | ar | ast | az | bg | ca | cs | da | de | de_ch | el | en | en_au | en_gb | eo | es | et | eu | fa | fi | fr | gl | gu | he | hi | hr | hu | id | it | ja | km | kn | ko | ku | lt | lv | ms | nb | ne | nl | no | oc | pl | pt | pt_br | ro | ru | si | sk | sl | sq | sr | sr_latn | sv | th | tk | tr | tt | ug | uk | vi | zh | zh_cn
add_languages(default_locale, languages)
¶
Add languages.
Source code in src\ramifice\utils\translations.py
change_locale(lang_code)
¶
Change current language.
Examples:
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lang_code
|
str
|
Language code. |
required |
Returns:
Type | Description |
---|---|
None
|
Object |
Source code in src\ramifice\utils\translations.py
get_custom_translator(lang_code)
¶
Get an object of translation for the desired language, for custom project.
Examples:
>>> from ramifice import translations
>>> gettext = translations.get_custom_translator("en").gettext
>>> msg = gettext("Hello World!")
>>> print(msg)
Hello World!
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lang_code
|
str
|
Language code. |
required |
Returns:
Type | Description |
---|---|
Any
|
Object of translation for the desired language. |
Source code in src\ramifice\utils\translations.py
get_ramifice_translator(lang_code)
¶
Get an object of translation for the desired language, for Ramifice.
Examples:
>>> from ramifice import translations
>>> _ = translations.get_ramifice_translator("en").gettext
>>> msg = _("Hello World!")
>>> print(msg)
Hello World!
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lang_code
|
str
|
Language code. |
required |
Returns:
Type | Description |
---|---|
Any
|
Object of translation for the desired language. |