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