diff --git a/src/PhpSpreadsheet/Calculation/CalculationLocale.php b/src/PhpSpreadsheet/Calculation/CalculationLocale.php index 027ffe0ce..40092b679 100644 --- a/src/PhpSpreadsheet/Calculation/CalculationLocale.php +++ b/src/PhpSpreadsheet/Calculation/CalculationLocale.php @@ -63,6 +63,11 @@ class CalculationLocale extends CalculationBase $filename = substr($filename, strlen($localeFileDirectory)); if ($filename != 'en') { self::$validLocaleLanguages[] = $filename; + $subdirs = glob("$localeFileDirectory$filename/*", GLOB_ONLYDIR) ?: []; + foreach ($subdirs as $subdir) { + $subdirx = basename($subdir); + self::$validLocaleLanguages[] = "{$filename}_{$subdirx}"; + } } } } diff --git a/tests/PhpSpreadsheetTests/Calculation/CalculationCoverageTest.php b/tests/PhpSpreadsheetTests/Calculation/CalculationCoverageTest.php index 28a41897c..9a81d180b 100644 --- a/tests/PhpSpreadsheetTests/Calculation/CalculationCoverageTest.php +++ b/tests/PhpSpreadsheetTests/Calculation/CalculationCoverageTest.php @@ -124,10 +124,23 @@ class CalculationCoverageTest extends TestCase $spreadsheet->disconnectWorksheets(); } + protected static int $winMinPhpToSkip = 80300; + + protected static int $winMaxPhpToSkip = 80499; + + protected static string $winIndicator = 'WIN'; + // separate process because it sets its own handler #[Attributes\RunInSeparateProcess] public function testExceptionHandler(): void { + if ( + strtoupper(substr(PHP_OS, 0, 3)) === self::$winIndicator + && PHP_VERSION_ID >= self::$winMinPhpToSkip + && PHP_VERSION_ID <= self::$winMaxPhpToSkip + ) { + self::markTestSkipped('Mysterious problem on Windows with Php8.3/4 only'); + } $this->expectException(CalcException::class); $this->expectExceptionMessage('hello'); $handler = new ExceptionHandler(); diff --git a/tests/PhpSpreadsheetTests/Writer/Html/BetterBooleanTest.php b/tests/PhpSpreadsheetTests/Writer/Html/BetterBooleanTest.php index e033c8ab4..e1d48d678 100644 --- a/tests/PhpSpreadsheetTests/Writer/Html/BetterBooleanTest.php +++ b/tests/PhpSpreadsheetTests/Writer/Html/BetterBooleanTest.php @@ -59,6 +59,18 @@ class BetterBooleanTest extends Functional\AbstractFunctional $sheet->getCell('G1')->setValue('=1+2'); $reloaded = $this->writeAndReload($spreadsheet, 'Html'); + $falseTrue = Calculation::getInstance($spreadsheet)->getFalseTrueArray(); + $countPortTrue = 0; + $portTrue = 'VERDADEIRO'; + $portFalse = 'FALSO'; + $countArray = count($falseTrue[1]); + for ($i = 0; $i < $countArray; ++$i) { + if ($falseTrue[1][$i] === $portTrue) { + ++$countPortTrue; + self::assertSame($portFalse, $falseTrue[0][$i]); + } + } + self::assertSame(2, $countPortTrue, '1 for pt, 1 for pt-br'); $spreadsheet->disconnectWorksheets(); $rsheet = $reloaded->getActiveSheet(); diff --git a/tests/data/Calculation/Translations.php b/tests/data/Calculation/Translations.php index ce5370f39..1f932b975 100644 --- a/tests/data/Calculation/Translations.php +++ b/tests/data/Calculation/Translations.php @@ -13,6 +13,21 @@ return [ 'pt_br', '=DAYS360(DATE(2010,2,5),DATE(2010,12,31),TRUE)', ], + 'Portuguese No Country' => [ + '=DIA.SEMANA(10000)', + 'pt', + '=WEEKDAY(10000)', + ], + 'Portuguese Unknown Country' => [ + '=DIA.SEMANA(10000)', + 'pt_xx', + '=WEEKDAY(10000)', + ], + 'Portuguese Brazil' => [ + '=DIA.DA.SEMANA(10000)', + 'pt_br', + '=WEEKDAY(10000)', + ], [ '=ДНЕЙ360(ДАТА(2010;2;5);ДАТА(2010;12;31);ИСТИНА)', 'ru',