19 #ifndef OPENXCOM_LANGUAGE_H 20 #define OPENXCOM_LANGUAGE_H 25 #include <yaml-cpp/yaml.h> 27 #include "../Savegame/Soldier.h" 31 enum TextDirection { DIRECTION_LTR, DIRECTION_RTL };
32 enum TextWrapping { WRAP_WORDS, WRAP_LETTERS };
36 class LanguagePlurality;
46 std::map<std::string, LocalizedText> _strings;
48 TextDirection _direction;
51 static std::map<std::string, std::wstring> _names;
52 static std::vector<std::string> _rtl, _cjk;
55 std::wstring loadString(
const std::string &s)
const;
62 static std::string
wstrToUtf8(
const std::wstring& src);
64 static std::string
wstrToCp(
const std::wstring &src);
66 static std::string
wstrToFs(
const std::wstring &src);
68 static std::wstring
utf8ToWstr(
const std::string& src);
70 static std::wstring
cpToWstr(
const std::string& src);
72 static std::wstring
fsToWstr(
const std::string &src);
74 static void replace(std::string &str,
const std::string &find,
const std::string &
replace);
76 static void replace(std::wstring &str,
const std::wstring &find,
const std::wstring &
replace);
78 static void getList(std::vector<std::string> &files, std::vector<std::wstring> &names);
82 std::string
getId()
const;
86 void toHtml(
const std::string &filename)
const;
static void replace(std::string &str, const std::string &find, const std::string &replace)
Replaces a substring.
Definition: Language.cpp:318
static std::wstring cpToWstr(const std::string &src)
Converts a local-codepage string to wide-string.
Definition: Language.cpp:276
void toHtml(const std::string &filename) const
Outputs the language to a HTML file.
Definition: Language.cpp:543
static std::wstring utf8ToWstr(const std::string &src)
Converts a UTF-8 string to wide-string.
Definition: Language.cpp:210
std::string getId() const
Gets the language's ID.
Definition: Language.cpp:445
This class is the interface used to find plural forms for the different languages.
Definition: LanguagePlurality.h:32
void load(const std::string &filename, ExtraStrings *extras)
Loads the language from a YAML file.
Definition: Language.cpp:375
TextDirection getTextDirection() const
Gets the direction of text in this language.
Definition: Language.cpp:574
A string that is already translated.
Definition: LocalizedText.h:45
Language()
Creates a blank language.
Definition: Language.cpp:49
static std::string wstrToFs(const std::wstring &src)
Converts a wide-string to filesystem string.
Definition: Language.cpp:194
Contains strings used throughout the game for localization.
Definition: Language.h:42
static std::string wstrToCp(const std::wstring &src)
Converts a wide-string to local-codepage string.
Definition: Language.cpp:168
static std::string wstrToUtf8(const std::wstring &src)
Converts a wide-string to UTF-8.
Definition: Language.cpp:111
const LocalizedText & getString(const std::string &id) const
Get a localized text.
Definition: Language.cpp:465
static void getList(std::vector< std::string > &files, std::vector< std::wstring > &names)
Gets list of languages in the data directory.
Definition: Language.cpp:346
TextWrapping getTextWrapping() const
Gets the wrapping of text in this language.
Definition: Language.cpp:584
std::wstring getName() const
Gets the language's name.
Definition: Language.cpp:454
static std::wstring fsToWstr(const std::string &src)
Converts a filesystem string to wide-string.
Definition: Language.cpp:303
~Language()
Cleans up the language.
Definition: Language.cpp:99
COPYING:
Definition: BaseInfoState.cpp:41