diff --git a/Classes/PHPExcel/Calculation.php b/Classes/PHPExcel/Calculation.php index 2fc63e58..70f8d124 100644 --- a/Classes/PHPExcel/Calculation.php +++ b/Classes/PHPExcel/Calculation.php @@ -1681,14 +1681,6 @@ class PHPExcel_Calculation { private function __construct() { - $localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/'; - foreach (glob($localeFileDirectory.'/*',GLOB_ONLYDIR) as $filename) { - $filename = substr($filename,strlen($localeFileDirectory)+1); - if ($filename != 'en') { - self::$_validLocaleLanguages[] = $filename; - } - } - $setPrecision = (PHP_INT_SIZE == 4) ? 12 : 16; $this->_savedPrecision = ini_get('precision'); if ($this->_savedPrecision < $setPrecision) { @@ -1703,6 +1695,16 @@ class PHPExcel_Calculation { } } + private static function _loadLocales() { + $localeFileDirectory = PHPEXCEL_ROOT.'PHPExcel/locale/'; + foreach (glob($localeFileDirectory.'/*',GLOB_ONLYDIR) as $filename) { + $filename = substr($filename,strlen($localeFileDirectory)+1); + if ($filename != 'en') { + self::$_validLocaleLanguages[] = $filename; + } + } + } + /** * Get an instance of this class * @@ -1883,6 +1885,9 @@ class PHPExcel_Calculation { list($language) = explode('_',$locale); } + if (count(self::$_validLocaleLanguages) == 1) + self::_loadLocales(); + // Test whether we have any language data for this language (any locale) if (in_array($language,self::$_validLocaleLanguages)) { // initialise language/locale settings