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());
78 std::string
str()
const;
Lightweight wrapper around LanguageSpec.
Definition: language.hpp:32
std::string str() const
Returns the Language as string in the form of an environment variable: {language}_{country}modifier}.
Definition: language.cpp:541
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:418
bool operator!=(const Language &rhs) const
Definition: language.cpp:573
std::string get_modifier() const
Returns the modifier of the language (i.e.
Definition: language.cpp:523
const LanguageSpec * language_spec
Definition: language.hpp:34
std::string get_country() const
Returns the country code (i.e.
Definition: language.cpp:514
bool operator==(const Language &rhs) const
Definition: language.cpp:567
static Language from_env(const std::string &env)
Create a language from an environment variable style string (e.g de_DE.UTF-8@modifier)
Definition: language.cpp:424
std::string get_name() const
Returns the human readable name of the Language.
Definition: language.cpp:532
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,...
Definition: language.cpp:469
Language()
Create an undefined Language object.
Definition: language.cpp:463
friend bool operator<(const Language &lhs, const Language &rhs)
Definition: language.hpp:87
std::string get_language() const
Returns the language code (i.e.
Definition: language.cpp:505
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:374
bool operator<(const Language &lhs, const Language &rhs)
Definition: language.hpp:87
Definition: language.cpp:31
Definition: language.hpp:92
size_t operator()(const Language &v) const
Definition: language.hpp:93