30 if (
sep != boost::string_ref::npos )
81 std::string
ret(
lc._l.name() );
112 if (
sep != boost::string_ref::npos )
118 {
return code_r.find_first_of(
"@." ); }
131 using CodeMap = std::unordered_map<IdString, LC>;
148 boost::string_ref::size_type
sep =
str.find(
'_' );
149 if (
sep == boost::string_ref::npos )
181 : _str( CodeMaps::withoutTrash(
str_r ) )
185 : _str( CodeMaps::withoutTrash(
str_r ) )
189 : _str( CodeMaps::withoutTrash(
str_r ) )
200 {
return CodeMaps::instance().language(
_str ); }
203 {
return CodeMaps::instance().country(
_str ); }
206 {
return CodeMaps::instance().
name(
_str ); }
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
Country codes (iso3166-1-alpha-2).
std::string name() const
Return the translated country name; if unknown the country code.
Access to the sat-pools string space.
static const IdString Null
No or Null string ( Id 0 ).
static const IdString Empty
Empty string.
Language codes (iso639_2/iso639_1).
static const LanguageCode enCode
Last resort "en".
'Language[_Country]' codes.
Locale fallback() const
Return the fallback locale for this locale, if no fallback exists the empty Locale::noCode.
CountryCode country() const
The county part.
static const Locale enCode
Last resort "en".
std::string name() const
Return the translated locale name.
LanguageCode language() const
The language part.
static const Locale noCode
Empty code.
Locale()
Default Ctor: noCode.
static Locale bestMatch(const LocaleSet &avLocales_r, Locale requested_r=Locale())
Return the best match for Locale requested_r within the available avLocales_r.
static ZConfig & instance()
Singleton ctor.
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
std::unordered_set< Locale > LocaleSet
LC(const LanguageCode &l_r, const CountryCode &c_r)
LC(const LanguageCode &l_r)
CodeMaps()
Ctor initializes the code maps.
static IdString combineLC(const LanguageCode &language_r, const CountryCode &country_r)
Return IdString from language/country codes.
LanguageCode language(IdString index_r)
const LC & getIndex(IdString index_r)
Return LC for index_r, creating it if necessary.
Locale fallback(IdString index_r)
std::string name(IdString index_r)
CountryCode country(IdString index_r)
static IdString withoutTrash(boost::string_ref code_r)
static IdString withoutTrash(const char *code_r)
Return IdString without trailing garbage.
static IdString withoutTrash(IdString code_r)
Return IdString without trailing garbage.
static CodeMaps & instance()
The singleton.
static IdString withoutTrash(const std::string &code_r)
Return IdString without trailing garbage.
static boost::string_ref::size_type trashStart(IdString code_r)
static boost::string_ref::size_type trashStart(boost::string_ref code_r)
std::unordered_map< IdString, LC > CodeMap