@@ -1681,14 +1681,6 @@ class PHPExcel_Calculation {
1681
1681
1682
1682
1683
1683
private function __construct () {
1684
- $ localeFileDirectory = PHPEXCEL_ROOT .'PHPExcel/locale/ ' ;
1685
- foreach (glob ($ localeFileDirectory .'/* ' ,GLOB_ONLYDIR ) as $ filename ) {
1686
- $ filename = substr ($ filename ,strlen ($ localeFileDirectory )+1 );
1687
- if ($ filename != 'en ' ) {
1688
- self ::$ _validLocaleLanguages [] = $ filename ;
1689
- }
1690
- }
1691
-
1692
1684
$ setPrecision = (PHP_INT_SIZE == 4 ) ? 12 : 16 ;
1693
1685
$ this ->_savedPrecision = ini_get ('precision ' );
1694
1686
if ($ this ->_savedPrecision < $ setPrecision ) {
@@ -1703,6 +1695,16 @@ public function __destruct() {
1703
1695
}
1704
1696
}
1705
1697
1698
+ private static function _loadLocales () {
1699
+ $ localeFileDirectory = PHPEXCEL_ROOT .'PHPExcel/locale/ ' ;
1700
+ foreach (glob ($ localeFileDirectory .'/* ' ,GLOB_ONLYDIR ) as $ filename ) {
1701
+ $ filename = substr ($ filename ,strlen ($ localeFileDirectory )+1 );
1702
+ if ($ filename != 'en ' ) {
1703
+ self ::$ _validLocaleLanguages [] = $ filename ;
1704
+ }
1705
+ }
1706
+ }
1707
+
1706
1708
/**
1707
1709
* Get an instance of this class
1708
1710
*
@@ -1883,6 +1885,9 @@ public function setLocale($locale='en_us') {
1883
1885
list ($ language ) = explode ('_ ' ,$ locale );
1884
1886
}
1885
1887
1888
+ if (count (self ::$ _validLocaleLanguages ) == 1 )
1889
+ self ::_loadLocales ();
1890
+
1886
1891
// Test whether we have any language data for this language (any locale)
1887
1892
if (in_array ($ language ,self ::$ _validLocaleLanguages )) {
1888
1893
// initialise language/locale settings
0 commit comments