public function getLocalizedString($name, $default = self::REQUIRED_OPTION)
{
assert('is_string($name)');
$ret = $this->getValue($name, $default);
if ($ret === $default) {
// the option wasn't found, or it matches the default value. In any case, return this value
return $ret;
}
$loc = $this->location . '[' . var_export($name, true) . ']';
if (is_string($ret)) {
$ret = array('en' => $ret);
}
if (!is_array($ret)) {
throw new Exception($loc . ': Must be an array or a string.');
}
foreach ($ret as $k => $v) {
if (!is_string($k)) {
throw new Exception($loc . ': Invalid language code: ' . var_export($k, true));
}
if (!is_string($v)) {
throw new Exception($loc . '[' . var_export($v, true) . ']: Must be a string.');
}
}
return $ret;
}