public function get($offset, $default = null)
{
$res = Arr::get($this->_data, $offset, $default);
- if (is_array($res) && isset($res[App::getLocale()])) {
+
+ // Get the translated value if the array contains a key matching the locale.
+ // We have to check if the key exists because the actual value may be null.
+ // Using isset() on the locale key would give a false negative if the value is null.
+ if (is_array($res) && array_key_exists(App::getLocale(), $res)) {
$res = $res[App::getLocale()];
}
+ if (!$res) {
+ return $default;
+ }
+
return $res;
}