29       boost::string_ref::size_type sep = 
trashStart( code_r );
 
   30       if ( sep != boost::string_ref::npos )
 
 
   50          ret = 
IdString( std::string(language_r) + 
"_" + country_r.
c_str() );
 
   57          ret = 
IdString( 
"_" + std::string(country_r) );
 
 
   80      const LC & lc( 
getIndex( index_r ) );
 
   81      std::string ret( lc._l.name() );
 
 
   93      static const IdString special( 
"pt_BR" );
 
   95      if ( index_r == special ) 
 
   99        const LC & lc( 
getIndex( index_r ) );
 
 
  111      boost::string_ref::size_type sep = 
trashStart( code_r );
 
  112      if ( sep != boost::string_ref::npos )
 
  113        code_r = code_r.substr( 0, sep );
 
 
  117    static boost::string_ref::size_type 
trashStart( boost::string_ref code_r )
 
  118    { 
return code_r.find_first_of( 
"@." ); }
 
 
  131    using CodeMap = std::unordered_map<IdString, LC>;
 
  145        CodeMap::value_type newval( index_r, LC() );
 
  147        boost::string_ref 
str( index_r.
c_str() );
 
  148        boost::string_ref::size_type sep = 
str.find( 
'_' );
 
  149        if ( sep == boost::string_ref::npos )
 
  154          std::string dup( 
str );
 
  160        it = 
_codeMap.insert( std::move(newval) ).first;
 
 
 
  181  : 
_str( CodeMaps::withoutTrash( str_r ) )
 
 
  185  : 
_str( CodeMaps::withoutTrash( str_r ) )
 
 
  189  : 
_str( CodeMaps::withoutTrash( str_r ) )
 
 
  193  : 
_str( CodeMaps::combineLC( language_r, country_r ) )
 
 
  200  { 
return CodeMaps::instance().language( 
_str ); }
 
 
  203  { 
return CodeMaps::instance().country( 
_str ); }
 
 
  206  { 
return CodeMaps::instance().
name( 
_str ); }
 
 
  215    if ( ! avLocales_r.empty() )
 
  219      for ( ; requested_r; requested_r = requested_r.
fallback() )
 
  221        if ( avLocales_r.count( requested_r ) )
 
 
Country codes (iso3166-1-alpha-2).
std::string name() const
Return the translated country name; if unknown the country code.
const char * c_str() const
Access to the sat-pools string space.
const char * c_str() const
Conversion to const char *
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.
Locale textLocale() const
The locale for translated texts zypp uses.
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