Add unit test for erroneous translations from Russian to English, and a quick/dirty fix (#2534)
* Add unit test for erroneous translations from Russian to English, and a quick/dirty fix * Additional translation unit tests with accented characters from Spanish, Bulgarian, Czech and Turkish * Update Change Log
This commit is contained in:
parent
6b746dc05f
commit
4d82df2bc6
|
|
@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
|||
|
||||
### Fixed
|
||||
|
||||
- Fix partial function name matching when translating formulae from Russian to English [Issue #2533](https://github.com/PHPOffice/PhpSpreadsheet/issues/2533) [PR #2534](https://github.com/PHPOffice/PhpSpreadsheet/pull/2534)
|
||||
- Various bugs related to Conditional Formatting Rules, and errors in the Xlsx Writer for Conditional Formatting [PR #2491](https://github.com/PHPOffice/PhpSpreadsheet/pull/2491)
|
||||
- Xlsx Reader merge range fixes.
|
||||
[Issue #2501](https://github.com/PHPOffice/PhpSpreadsheet/issues/2501)
|
||||
|
|
|
|||
|
|
@ -3161,10 +3161,10 @@ class Calculation
|
|||
if (self::$functionReplaceFromExcel === null) {
|
||||
self::$functionReplaceFromExcel = [];
|
||||
foreach (array_keys(self::$localeFunctions) as $excelFunctionName) {
|
||||
self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelFunctionName, '/') . '([\s]*\()/Ui';
|
||||
self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelFunctionName, '/') . '([\s]*\()/ui';
|
||||
}
|
||||
foreach (array_keys(self::$localeBoolean) as $excelBoolean) {
|
||||
self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelBoolean, '/') . '([^\w\.])/Ui';
|
||||
self::$functionReplaceFromExcel[] = '/(@?[^\w\.])' . preg_quote($excelBoolean, '/') . '([^\w\.])/ui';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3178,7 +3178,13 @@ class Calculation
|
|||
}
|
||||
}
|
||||
|
||||
return self::translateFormula(self::$functionReplaceFromExcel, self::$functionReplaceToLocale, $formula, ',', self::$localeArgumentSeparator);
|
||||
return self::translateFormula(
|
||||
self::$functionReplaceFromExcel,
|
||||
self::$functionReplaceToLocale,
|
||||
$formula,
|
||||
',',
|
||||
self::$localeArgumentSeparator
|
||||
);
|
||||
}
|
||||
|
||||
private static $functionReplaceFromLocale;
|
||||
|
|
@ -3190,10 +3196,10 @@ class Calculation
|
|||
if (self::$functionReplaceFromLocale === null) {
|
||||
self::$functionReplaceFromLocale = [];
|
||||
foreach (self::$localeFunctions as $localeFunctionName) {
|
||||
self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($localeFunctionName, '/') . '([\s]*\()/Ui';
|
||||
self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($localeFunctionName, '/') . '([\s]*\()/ui';
|
||||
}
|
||||
foreach (self::$localeBoolean as $excelBoolean) {
|
||||
self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($excelBoolean, '/') . '([^\w\.])/Ui';
|
||||
self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($excelBoolean, '/') . '([^\w\.])/ui';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,16 @@ return [
|
|||
'nl',
|
||||
'=CONCATENATE("""Hello ", B1, """,", " I said.")',
|
||||
],
|
||||
[
|
||||
'=ЕСЛИ(1;1;1)',
|
||||
'ru',
|
||||
'=IF(1,1,1)',
|
||||
],
|
||||
[
|
||||
'=ИСКЛИЛИ(1;1)',
|
||||
'ru',
|
||||
'=XOR(1,1)',
|
||||
],
|
||||
[
|
||||
'=TEKST.SAMENVOEGEN(JAAR(VANDAAG());
|
||||
" is ";
|
||||
|
|
@ -45,4 +55,24 @@ return [
|
|||
)
|
||||
)',
|
||||
],
|
||||
'Spanish with accented character' => [
|
||||
'=AÑO(B1)',
|
||||
'es',
|
||||
'=YEAR(B1)',
|
||||
],
|
||||
'Bulgarian with accent and period' => [
|
||||
'=ПОЛУЧИТЬ.ДАННЫЕ.СВОДНОЙ.ТАБЛИЦЫ(B1)',
|
||||
'bg',
|
||||
'=GETPIVOTDATA(B1)',
|
||||
],
|
||||
'Czech with accent and period' => [
|
||||
'=DSMODCH.VÝBĚR(B1)',
|
||||
'cs',
|
||||
'=DSTDEV(B1)',
|
||||
],
|
||||
'Turkish with accent and period' => [
|
||||
'=İŞGÜNÜ.ULUSL(B1)',
|
||||
'tr',
|
||||
'=WORKDAY.INTL(B1)',
|
||||
],
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in New Issue