Fix for language picker to use new individual language files

This commit is contained in:
Andy Miller
2015-12-18 17:28:31 -07:00
parent ba1c1c2347
commit 853d934c5e

View File

@@ -689,9 +689,19 @@ class Admin
public static function adminLanguages()
{
$languages = [];
$lang_data = Yaml::parse(file_get_contents(__DIR__ . '/../languages.yaml'));
foreach ($lang_data as $lang => $values) {
$path = Grav::instance()['locator']->findResource('plugins://admin/languages');
/** @var \DirectoryIterator $directory */
foreach (new \DirectoryIterator($path) as $file) {
if ($file->isDir() || $file->isDot()) {
continue;
}
$lang = basename($file->getBasename(), '.yaml');
$languages[$lang] = LanguageCodes::getNativeName($lang);
}
return $languages;
}