Languages
Language ¶
The class reflects the file with the translation.
Parameters
Parameter | Default | Description |
---|---|---|
language_filepath
str
|
required | The path to the file with the translation. |
Raises
Type | Description |
---|---|
FileNotFoundError
|
It is called if the file with the translation does not exist. |
author
property
¶
The author of the translation taken from the translation file.
Returns
Type | Description |
---|---|
str
|
The author's nickname. |
author_url
property
¶
loaded
property
¶
If True
, then the file with the translation is fully loaded in memory.
Returns
Type | Description |
---|---|
bool
|
If loaded, then |
mark
property
¶
The name of the file without an extension.
Returns
Type | Description |
---|---|
str
|
The name of the file without the extension. |
name
property
¶
title
property
¶
The name of the translation language taken from the file.
Returns
Type | Description |
---|---|
str
|
The purpose of the language. |
words
property
¶
get ¶
Getting a line feed.
Parameters
Parameter | Default | Description |
---|---|---|
key
str
|
required | The key to the variable with the translation, which is registered in the file with the translation. |
default
Optional[str]
|
None
|
The default value. Defaults to None. |
Raises
Type | Description |
---|---|
LanguageNotLoadedError
|
It is called if the translation file is not fully loaded into memory. |
Returns
Type | Description |
---|---|
Optional[str]
|
Optional[str]: The translated string. |
LanguageLoader ¶
The loader of files with translation.
Parameters
Parameter | Default | Description |
---|---|---|
langs_dirpath
str
|
required | The path to the folder with the translation files. |
main_lang_mark
str
|
required | The name of the file with the main translation without the extension. |
default_lang_mark
str
|
'en-eng'
|
The name of the file with the default translation without an extension. Defaults to "en-eng". |
Raises
Type | Description |
---|---|
FileNotFoundError
|
Called if the file with the default translation without the extension could not be found. |
alangs
property
¶
Additional languages, for example, translation of plugins.
Returns
Type | Description |
---|---|
A list with an additional translation. |
default_lang
property
¶
An image of the Language
class reflecting the uploaded file with the default translation.
Returns
Type | Description |
---|---|
Language
|
The translation. |
default_lang_mark
property
¶
The name of the file with the default translation without an extension.
Returns
Type | Description |
---|---|
str
|
The file name without an extension. |
langs
property
¶
main_lang
property
¶
main_lang_mark
property
¶
The name of the file with the main translation without the extension.
Returns
Type | Description |
---|---|
str
|
The file name without an extension. |
name
property
¶
The path to the folder with the translation files.
Returns
Type | Description |
---|---|
str
|
The full path to the file. |
get ¶
First, it tries to get the translation from the file with the main translation, if it failed, it tries to get it from the file with the default translation, if it failed again, it tries to get them from additional languages (self.alangs
). If in the end None is still output, then returns the string "<LTNF>"
, that is, the Language Text Not Found
.
Parameters
Parameter | Default | Description |
---|---|---|
key
str
|
required | The key to the variable with the translation, which is registered in the file with the translation. |
Returns
Name | Type | Description |
---|---|---|
str |
str
|
The translated string. |
merge ¶
Adding additional languages (self.alangs
).
Parameters
Parameter | Default | Description |
---|---|---|
ll
LanguageLoader
|
required | The image of the |