19 #ifndef OPENXCOM_LANGUAGE_H
20 #define OPENXCOM_LANGUAGE_H
25 #include <yaml-cpp/yaml.h>
28 #include "../Savegame/Soldier.h"
32 enum TextDirection { DIRECTION_LTR, DIRECTION_RTL };
33 enum TextWrapping { WRAP_WORDS, WRAP_LETTERS };
37 class LanguagePlurality;
47 std::map<std::string, LocalizedText> _strings;
49 TextDirection _direction;
52 static std::map<std::string, std::wstring> _names;
53 static std::vector<std::string> _rtl, _cjk;
56 std::wstring loadString(
const std::string &s)
const;
63 static std::string
wstrToUtf8(
const std::wstring& src);
65 static std::string
wstrToCp(
const std::wstring &src);
67 static std::string
wstrToFs(
const std::wstring &src);
69 static std::wstring
utf8ToWstr(
const std::string& src);
71 static std::wstring
cpToWstr(
const std::string& src);
73 static std::wstring
fsToWstr(
const std::string &src);
75 static void replace(std::string &str,
const std::string &find,
const std::string &
replace);
77 static void replace(std::wstring &str,
const std::wstring &find,
const std::wstring &
replace);
79 static void getList(std::vector<std::string> &files, std::vector<std::wstring> &names);
83 std::string
getId()
const;
87 void toHtml(
const std::string &filename)
const;
Contains strings used throughout the game for localization.
Definition: Language.h:44
std::wstring getName() const
Gets the language's name.
Definition: Language.cpp:453
Language()
Creates a blank language.
Definition: Language.cpp:48
void load(const std::string &filename, ExtraStrings *extras)
Loads the language from a YAML file.
Definition: Language.cpp:374
static void getList(std::vector< std::string > &files, std::vector< std::wstring > &names)
Gets list of languages in the data directory.
Definition: Language.cpp:345
static std::string wstrToUtf8(const std::wstring &src)
Converts a wide-string to UTF-8.
Definition: Language.cpp:110
const LocalizedText & getString(const std::string &id) const
Get a localized text.
Definition: Language.cpp:464
static std::wstring utf8ToWstr(const std::string &src)
Converts a UTF-8 string to wide-string.
Definition: Language.cpp:209
TextDirection getTextDirection() const
Gets the direction of text in this language.
Definition: Language.cpp:573
void toHtml(const std::string &filename) const
Outputs the language to a HTML file.
Definition: Language.cpp:542
std::string getId() const
Gets the language's ID.
Definition: Language.cpp:444
static void replace(std::string &str, const std::string &find, const std::string &replace)
Replaces a substring.
Definition: Language.cpp:317
static std::string wstrToCp(const std::wstring &src)
Converts a wide-string to local-codepage string.
Definition: Language.cpp:167
TextWrapping getTextWrapping() const
Gets the wrapping of text in this language.
Definition: Language.cpp:583
static std::wstring fsToWstr(const std::string &src)
Converts a filesystem string to wide-string.
Definition: Language.cpp:302
static std::wstring cpToWstr(const std::string &src)
Converts a local-codepage string to wide-string.
Definition: Language.cpp:275
~Language()
Cleans up the language.
Definition: Language.cpp:98
static std::string wstrToFs(const std::wstring &src)
Converts a wide-string to filesystem string.
Definition: Language.cpp:193
This class is the interface used to find plural forms for the different languages.
Definition: LanguagePlurality.h:33
A string that is already translated.
Definition: LocalizedText.h:46
COPYING:
Definition: BaseInfoState.cpp:41