BuildingElementStringTable
Script for BuildingElementStringTable
BuildingElementStringTable
Canonical path: BuildingElementStringTable.BuildingElementStringTable
Bases: BuildingElementStringTableBase
Definition of class StringTable
__init__
Initialization of class StringTable
Parameters:
-
path
(str
) –path of according .py file. The file name will be set internally to _xyz.xml
-
numeric
(bool
) –the string table will be created only from numeric (123..) text ids or not numeric text ids (e_THE_VALUE)
-
lang
(str
) –language shortcut
-
force_lang_name
(bool
, default:False
) –force global table with language specific key (useful when working with more language mutations at once)
add_entry
Creates an string table entry
Parameters:
-
val_number
(str
) –index number in the list
-
val_str
(str
) –string value
Returns:
-
bool
–True for success
-
bool
–False if number already exists
get_entry
Returns a string table entry
Parameters:
-
str_val_number
(Union[str, int]
) –value or number of the string
Returns:
-
Tuple[str, bool]
–(string entry, True/False for success)
get_key
Returns the key for a string table entry
Parameters:
-
entry
(str
) –entry to search corresponding key
Returns:
-
Optional[str]
–Key, None if not found
get_string
Get a string from the table
Parameters:
-
string_id
(str
) –String ID (if empty, take it from {...} part of the string
-
default_string
(str
) –Default string in case of no existing ID
Returns:
-
str
–String from the ID if exist, default string otherwise