20 #ifndef HEADER_TINYGETTEXT_LANGUAGE_HPP 21 #define HEADER_TINYGETTEXT_LANGUAGE_HPP 24 #include <unordered_map> 42 const std::string& country = std::string(),
43 const std::string& modifier = std::string());
61 explicit operator bool()
const {
return language_spec != NULL; }
78 std::string
str()
const;
std::string get_name() const
Returns the human readable name of the Language.
Definition: language.cpp:528
bool operator==(const Language &rhs) const
Definition: language.cpp:563
std::string get_country() const
Returns the country code (i.e.
Definition: language.cpp:510
size_t operator()(const Language &v) const
Definition: language.hpp:93
std::string get_modifier() const
Returns the modifier of the language (i.e.
Definition: language.cpp:519
Lightweight wrapper around LanguageSpec.
Definition: language.hpp:31
const LanguageSpec * language_spec
Definition: language.hpp:34
static Language from_spec(const std::string &language, const std::string &country=std::string(), const std::string &modifier=std::string())
Create a language from language and country code: Example: Languge("de", "DE");.
Definition: language.cpp:370
Definition: language.hpp:91
bool operator!=(const Language &rhs) const
Definition: language.cpp:569
Language()
Create an undefined Language object.
Definition: language.cpp:459
std::string get_language() const
Returns the language code (i.e.
Definition: language.cpp:501
std::string str() const
Returns the Language as string in the form of an environment variable: {language}_{country}modifier}...
Definition: language.cpp:537
Definition: language.cpp:31
Definition: dictionary.hpp:29
static int match(const Language &lhs, const Language &rhs)
Compares two Languages, returns 0 on missmatch and a score between 1 and 9 on match, the higher the score the better the match.
Definition: language.cpp:465
static Language from_env(const std::string &env)
Create a language from an environment variable style string (e.g de_DE.UTF-8)
Definition: language.cpp:420
friend bool operator<(const Language &lhs, const Language &rhs)
Definition: language.hpp:87
static Language from_name(const std::string &str)
Create a language from language and country code: Example: Languge("deutsch"); Example: Languge("de_D...
Definition: language.cpp:414