![]() |
OpenXcom
1.0
Open-source clone of the original X-Com
|
Contains strings used throughout the game for localization. More...
#include <Language.h>
Public Member Functions | |
| Language () | |
| Creates a blank language. More... | |
| ~Language () | |
| Cleans up the language. | |
| void | loadFile (const std::string &filename) |
| Loads the language from an external file. More... | |
| void | loadRule (const std::map< std::string, ExtraStrings *> &extraStrings, const std::string &id) |
| Loads the language from a ruleset file. More... | |
| std::string | getId () const |
| Gets the language's ID. More... | |
| std::string | getName () const |
| Gets the language's name. More... | |
| void | toHtml (const std::string &filename) const |
| Outputs the language to a HTML file. More... | |
| const LocalizedText & | getString (const std::string &id) const |
| Get a localized text. More... | |
| LocalizedText | getString (const std::string &id, unsigned n) const |
| Get a quantity-depended localized text. More... | |
| const LocalizedText & | getString (const std::string &id, SoldierGender gender) const |
| Get a gender-depended localized text. More... | |
| TextDirection | getTextDirection () const |
| Gets the direction of text in this language. More... | |
| TextWrapping | getTextWrapping () const |
| Gets the wrapping of text in this language. More... | |
Static Public Member Functions | |
| static void | getList (std::vector< std::string > &files, std::vector< std::string > &names) |
| Gets list of languages in the data directory. More... | |
Contains strings used throughout the game for localization.
Languages are just a set of strings identified by an ID string.
| OpenXcom::Language::Language | ( | ) |
Creates a blank language.
Initializes an empty language file.
| std::string OpenXcom::Language::getId | ( | ) | const |
Gets the language's ID.
Returns the language's locale.
|
static |
Gets list of languages in the data directory.
Gets all the languages found in the Data folder and returns their properties.
| files | List of language filenames. |
| names | List of language human-readable names. |
| std::string OpenXcom::Language::getName | ( | ) | const |
| const LocalizedText & OpenXcom::Language::getString | ( | const std::string & | id | ) | const |
Get a localized text.
Returns the localized text with the specified ID.
If it's not found, just returns the ID.
| id | ID of the string. |
| LocalizedText OpenXcom::Language::getString | ( | const std::string & | id, |
| unsigned | n | ||
| ) | const |
Get a quantity-depended localized text.
Returns the localized text with the specified ID, in the proper form for n.
The substitution of n has already happened in the returned LocalizedText. If it's not found, just returns the ID.
| id | ID of the string. |
| n | Number to use to decide the proper form. |
| const LocalizedText & OpenXcom::Language::getString | ( | const std::string & | id, |
| SoldierGender | gender | ||
| ) | const |
Get a gender-depended localized text.
Returns the localized text with the specified ID, in the proper form for the gender.
If it's not found, just returns the ID.
| id | ID of the string. |
| gender | Current soldier gender. |
| TextDirection OpenXcom::Language::getTextDirection | ( | ) | const |
Gets the direction of text in this language.
Returns the direction to use for rendering text in this language.
| TextWrapping OpenXcom::Language::getTextWrapping | ( | ) | const |
Gets the wrapping of text in this language.
Returns the wrapping rules to use for rendering text in this language.
| void OpenXcom::Language::loadFile | ( | const std::string & | path | ) |
Loads the language from an external file.
Loads a language file from an external path.
| path | Language file path. |
| void OpenXcom::Language::loadRule | ( | const std::map< std::string, ExtraStrings *> & | extraStrings, |
| const std::string & | id | ||
| ) |
Loads the language from a ruleset file.
Loads a language file from a mod's ExtraStrings.
| extraStrings | List of ExtraStrings. |
| id | Language ID. |
| void OpenXcom::Language::toHtml | ( | const std::string & | filename | ) | const |
Outputs the language to a HTML file.
Outputs all the language IDs and strings to an HTML table.
| filename | HTML file. |
1.8.14