Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Calculation/Calculation.php
public function setLocale($locale)
    {
        //    Identify our locale and language
        $language = $locale = strtolower($locale);
        if (strpos($locale, '_') !== false) {
            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
            self::$localeFunctions = [];
            self::$localeArgumentSeparator = ',';
            self::$localeBoolean = ['TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL'];
            //    Default is English, if user isn't requesting english, then read the necessary data from the locale files
            if ($locale != 'en_us') {
                //    Search for a file with a list of function names for locale
                $functionNamesFile = __DIR__ . '/locale/' . str_replace('_', DIRECTORY_SEPARATOR, $locale) . DIRECTORY_SEPARATOR . 'functions';
                if (!file_exists($functionNamesFile)) {
                    //    If there isn't a locale specific function file, look for a language specific function file
                    $functionNamesFile = __DIR__ . '/locale/' . $language . DIRECTORY_SEPARATOR . 'functions';
                    if (!file_exists($functionNamesFile)) {
                        return false;
                    }
                }
                //    Retrieve the list of locale or language specific function names
                $localeFunctions = file($functionNamesFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
                foreach ($localeFunctions as $localeFunction) {
                    list($localeFunction) = explode('##', $localeFunction); //    Strip out comments
                    if (strpos($localeFunction, '=') !== false) {
                        list($fName, $lfName) = explode('=', $localeFunction);
                        $fName = trim($fName);
                        $lfName = trim($lfName);
                        if ((isset(self::$phpSpreadsheetFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
                            self::$localeFunctions[$fName] = $lfName;
                        }
                    }
                }
                //    Default the TRUE and FALSE constants to the locale names of the TRUE() and FALSE() functions
                if (isset(self::$localeFunctions['TRUE'])) {
                    self::$localeBoolean['TRUE'] = self::$localeFunctions['TRUE'];
                }
                if (isset(self::$localeFunctions['FALSE'])) {
                    self::$localeBoolean['FALSE'] = self::$localeFunctions['FALSE'];
                }

                $configFile = __DIR__ . '/locale/' . str_replace('_', DIRECTORY_SEPARATOR, $locale) . DIRECTORY_SEPARATOR . 'config';
                if (!file_exists($configFile)) {
                    $configFile = __DIR__ . '/locale/' . $language . DIRECTORY_SEPARATOR . 'config';
                }
                if (file_exists($configFile)) {
                    $localeSettings = file($configFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
                    foreach ($localeSettings as $localeSetting) {
                        list($localeSetting) = explode('##', $localeSetting); //    Strip out comments
                        if (strpos($localeSetting, '=') !== false) {
                            list($settingName, $settingValue) = explode('=', $localeSetting);
                            $settingName = strtoupper(trim($settingName));
                            switch ($settingName) {
                                case 'ARGUMENTSEPARATOR':
                                    self::$localeArgumentSeparator = trim($settingValue);

                                    break;
                            }
                        }
                    }
                }
            }

            self::$functionReplaceFromExcel = self::$functionReplaceToExcel =
            self::$functionReplaceFromLocale = self::$functionReplaceToLocale = null;
            self::$localeLanguage = $locale;

            return true;
        }

        return false;
    }
public function setLocale($locale)
    {
        //    Identify our locale and language
        $language = $locale = strtolower($locale);
        if (strpos($locale, '_') !== false) {
            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
            self::$localeFunctions = [];
            self::$localeArgumentSeparator = ',';
            self::$localeBoolean = ['TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL'];
            //    Default is English, if user isn't requesting english, then read the necessary data from the locale files
            if ($locale != 'en_us') {
                //    Search for a file with a list of function names for locale
                $functionNamesFile = __DIR__ . '/locale/' . str_replace('_', DIRECTORY_SEPARATOR, $locale) . DIRECTORY_SEPARATOR . 'functions';
                if (!file_exists($functionNamesFile)) {
                    //    If there isn't a locale specific function file, look for a language specific function file
                    $functionNamesFile = __DIR__ . '/locale/' . $language . DIRECTORY_SEPARATOR . 'functions';
                    if (!file_exists($functionNamesFile)) {
                        return false;
                    }
                }
                //    Retrieve the list of locale or language specific function names
                $localeFunctions = file($functionNamesFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
                foreach ($localeFunctions as $localeFunction) {
                    list($localeFunction) = explode('##', $localeFunction); //    Strip out comments
                    if (strpos($localeFunction, '=') !== false) {
                        list($fName, $lfName) = explode('=', $localeFunction);
                        $fName = trim($fName);
                        $lfName = trim($lfName);
                        if ((isset(self::$phpSpreadsheetFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
                            self::$localeFunctions[$fName] = $lfName;
                        }
                    }
                }
                //    Default the TRUE and FALSE constants to the locale names of the TRUE() and FALSE() functions
                if (isset(self::$localeFunctions['TRUE'])) {
                    self::$localeBoolean['TRUE'] = self::$localeFunctions['TRUE'];
                }
                if (isset(self::$localeFunctions['FALSE'])) {
                    self::$localeBoolean['FALSE'] = self::$localeFunctions['FALSE'];
                }

                $configFile = __DIR__ . '/locale/' . str_replace('_', DIRECTORY_SEPARATOR, $locale) . DIRECTORY_SEPARATOR . 'config';
                if (!file_exists($configFile)) {
                    $configFile = __DIR__ . '/locale/' . $language . DIRECTORY_SEPARATOR . 'config';
                }
                if (file_exists($configFile)) {
                    $localeSettings = file($configFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
                    foreach ($localeSettings as $localeSetting) {
                        list($localeSetting) = explode('##', $localeSetting); //    Strip out comments
                        if (strpos($localeSetting, '=') !== false) {
                            list($settingName, $settingValue) = explode('=', $localeSetting);
                            $settingName = strtoupper(trim($settingName));
                            switch ($settingName) {
                                case 'ARGUMENTSEPARATOR':
                                    self::$localeArgumentSeparator = trim($settingValue);

                                    break;
                            }
                        }
                    }
                }
            }

            self::$functionReplaceFromExcel = self::$functionReplaceToExcel =
            self::$functionReplaceFromLocale = self::$functionReplaceToLocale = null;
            self::$localeLanguage = $locale;

            return true;
        }

        return false;
    }
public function setLocale ( $ locale ) { //    Identify our locale and language $ language = $ locale = strtolower ( $ locale ) ; if ( strpos ( $ locale , '_' ) !== false ) { 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 self :: $ localeFunctions = [ ] ; self :: $ localeArgumentSeparator = ',' ; self :: $ localeBoolean = [ 'TRUE' => 'TRUE' , 'FALSE' => 'FALSE' , 'NULL' => 'NULL' ] ; //    Default is English, if user isn't requesting english, then read the necessary data from the locale files if ( $ locale != 'en_us' ) { //    Search for a file with a list of function names for locale $ functionNamesFile = __DIR__ . '/locale/' . str_replace ( '_' , DIRECTORY_SEPARATOR , $ locale ) . DIRECTORY_SEPARATOR . 'functions' ; if ( ! file_exists ( $ functionNamesFile ) ) { //    If there isn't a locale specific function file, look for a language specific function file $ functionNamesFile = __DIR__ . '/locale/' . $ language . DIRECTORY_SEPARATOR . 'functions' ; if ( ! file_exists ( $ functionNamesFile ) ) { return false ; } } //    Retrieve the list of locale or language specific function names $ localeFunctions = file ( $ functionNamesFile , FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ) ; foreach ( $ localeFunctions as $ localeFunction ) { list ( $ localeFunction ) = explode ( '##' , $ localeFunction ) ; //    Strip out comments if ( strpos ( $ localeFunction , '=' ) !== false ) { list ( $ fName , $ lfName ) = explode ( '=' , $ localeFunction ) ; $ fName = trim ( $ fName ) ; $ lfName = trim ( $ lfName ) ; if ( ( isset ( self :: $ phpSpreadsheetFunctions [ $ fName ] ) ) && ( $ lfName != '' ) && ( $ fName != $ lfName ) ) { self :: $ localeFunctions [ $ fName ] = $ lfName ; } } } //    Default the TRUE and FALSE constants to the locale names of the TRUE() and FALSE() functions if ( isset ( self :: $ localeFunctions [ 'TRUE' ] ) ) { self :: $ localeBoolean [ 'TRUE' ] = self :: $ localeFunctions [ 'TRUE' ] ; } if ( isset ( self :: $ localeFunctions [ 'FALSE' ] ) ) { self :: $ localeBoolean [ 'FALSE' ] = self :: $ localeFunctions [ 'FALSE' ] ; } $ configFile = __DIR__ . '/locale/' . str_replace ( '_' , DIRECTORY_SEPARATOR , $ locale ) . DIRECTORY_SEPARATOR . 'config' ; if ( ! file_exists ( $ configFile ) ) { $ configFile = __DIR__ . '/locale/' . $ language . DIRECTORY_SEPARATOR . 'config' ; } if ( file_exists ( $ configFile ) ) { $ localeSettings = file ( $ configFile , FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ) ; foreach ( $ localeSettings as $ localeSetting ) { list ( $ localeSetting ) = explode ( '##' , $ localeSetting ) ; //    Strip out comments if ( strpos ( $ localeSetting , '=' ) !== false ) { list ( $ settingName , $ settingValue ) = explode ( '=' , $ localeSetting ) ; $ settingName = strtoupper ( trim ( $ settingName ) ) ; switch ( $ settingName ) { case 'ARGUMENTSEPARATOR' : self :: $ localeArgumentSeparator = trim ( $ settingValue ) ; break ; } } } } } self :: $ functionReplaceFromExcel = self :: $ functionReplaceToExcel = self :: $ functionReplaceFromLocale = self :: $ functionReplaceToLocale = null ; self :: $ localeLanguage = $ locale ; return true ; } return false ; }
Set the locale code.

@param string $locale The locale to use for formula translation, eg: 'en_us'

@return bool
Set the locale code .