Load locales clean folder path (#875)

* Fix locale folder path when reading locale list

* Ensure / directory separaor isn't left against locale name
This commit is contained in:
Mark Baker 2019-02-08 21:08:55 +01:00 committed by GitHub
parent bf00f0cc5f
commit 11575ef3c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -2207,8 +2207,8 @@ class Calculation
private static function loadLocales() private static function loadLocales()
{ {
$localeFileDirectory = __DIR__ . '/locale/'; $localeFileDirectory = __DIR__ . '/locale/';
foreach (glob($localeFileDirectory . '/*', GLOB_ONLYDIR) as $filename) { foreach (glob($localeFileDirectory . '*', GLOB_ONLYDIR) as $filename) {
$filename = substr($filename, strlen($localeFileDirectory) + 1); $filename = substr($filename, strlen($localeFileDirectory));
if ($filename != 'en') { if ($filename != 'en') {
self::$validLocaleLanguages[] = $filename; self::$validLocaleLanguages[] = $filename;
} }
@ -2413,7 +2413,6 @@ class Calculation
if (strpos($locale, '_') !== false) { if (strpos($locale, '_') !== false) {
list($language) = explode('_', $locale); list($language) = explode('_', $locale);
} }
if (count(self::$validLocaleLanguages) == 1) { if (count(self::$validLocaleLanguages) == 1) {
self::loadLocales(); self::loadLocales();
} }