Skip to content

Commit

Permalink
i18n: better fallbacks #1876
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico Hoffmann committed Aug 23, 2019
1 parent 28331d4 commit f4cd604
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Toolkit/I18n.php
Expand Up @@ -116,7 +116,7 @@ public static function translate($key, $fallback = null, string $locale = null)
return $key[$locale];
}
if (is_array($fallback)) {
return $fallback[$locale] ?? null;
return $fallback[$locale] ?? $fallback['en'] ?? reset($fallback);
}
return $fallback;
}
Expand Down

0 comments on commit f4cd604

Please sign in to comment.