Logo Search packages:      
Sourcecode: schroot version File versions  Download package

bool keyfile::get_locale_string ( std::string const &  group,
std::string const &  key,
std::string &  value 
) const

Get a localised key string value.

Parameters:
group the group the key is in.
key the key to get.
value the string to store the key's localised value in.
Returns:
true if the key was found, otherwise false (in which case value will be unchanged).

Definition at line 144 of file sbuild-keyfile.cc.

References get_value().

Referenced by get_locale_string(), and sbuild::chroot::set_keyfile().

{
  std::string localename = std::locale("").name();
  std::string::size_type pos;
  bool status = false;

  // Strip off any charset.
  if ((pos = localename.find_first_of('.')) != std::string::npos)
    localename = localename.substr(0, pos);
  status = get_locale_string(group, key, localename, value);

  // Strip off territory.
  if (status == false &&
      (pos = localename.find_first_of('_')) != std::string::npos)
    {
      localename = localename.substr(0, pos);
      status = get_locale_string(group, key, localename, value);
    }

  // Fall back to non-localised version.
  if (status == false)
    status = get_value(group, key, value);

  return status;
}


Generated by  Doxygen 1.6.0   Back to index