mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-10-08 04:46:26 +00:00
5b7fce9286
Fix #3819. Excel can add these prefixes (basically invisible to end-user). Formula translation in PhpSpreadsheet fails when dealing with these unexpected prefixes, and, even if it handled it correctly, the unexpected prefixes confuse the users. I have changed to strip those prefixes when translating to a locale. This is probably not perfect, but is almost certainly good enough. I could easily add the same change when translating from a locale to English, but I don't think there's a good use case for that, so am opting not to do so for now. The documentation mentions `translateFormulaToLocale` and `translateFormulaToEnglish`. Neither of these exist; both names are preceded by an underscore. I have changed the code to match the documentation rather than vice versa, retaining deprecated versions of the underscored routines which merely invoke the non-underscored routines.
106 lines
2.5 KiB
PHP
106 lines
2.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
return [
|
|
[
|
|
'=DAGEN360(DATUM(2010;2;5);DATUM(2010;12;31);WAAR)',
|
|
'nl',
|
|
'=DAYS360(DATE(2010,2,5),DATE(2010,12,31),TRUE)',
|
|
],
|
|
[
|
|
'=DIAS360(DATA(2010;2;5);DATA(2010;12;31);VERDADEIRO)',
|
|
'pt_br',
|
|
'=DAYS360(DATE(2010,2,5),DATE(2010,12,31),TRUE)',
|
|
],
|
|
[
|
|
'=ДНЕЙ360(ДАТА(2010;2;5);ДАТА(2010;12;31);ИСТИНА)',
|
|
'ru',
|
|
'=DAYS360(DATE(2010,2,5),DATE(2010,12,31),TRUE)',
|
|
],
|
|
[
|
|
'=TEKST.SAMENVOEGEN(A1; " "; B1)',
|
|
'nl',
|
|
'=CONCATENATE(A1, " ", B1)',
|
|
],
|
|
[
|
|
'=TEKST.SAMENVOEGEN("""Hello "; B1; ""","; " I said.")',
|
|
'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 ";
|
|
ALS(
|
|
DAGEN(DATUM(JAAR(VANDAAG())+1; 1; 1); DATUM(JAAR(VANDAAG()); 1; 1)) = 365;
|
|
"NOT a Leap Year";
|
|
"a Leap Year"
|
|
)
|
|
)',
|
|
'nl',
|
|
'=CONCATENATE(YEAR(TODAY()),
|
|
" is ",
|
|
IF(
|
|
DAYS(DATE(YEAR(TODAY())+1, 1, 1), DATE(YEAR(TODAY()), 1, 1)) = 365,
|
|
"NOT a Leap Year",
|
|
"a Leap Year"
|
|
)
|
|
)',
|
|
],
|
|
'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)',
|
|
],
|
|
[
|
|
'=STØRST(ABS({2,-3;-4,5}); ABS{-2,3;4,-5})',
|
|
'nb',
|
|
'=MAX(ABS({2,-3;-4,5}), ABS{-2,3;4,-5})',
|
|
],
|
|
'not fooled by *RC' => [
|
|
'=3*RC(B1)',
|
|
'fr',
|
|
'=3*RC(B1)',
|
|
],
|
|
'handle * for ROW' => [
|
|
'=3*LIGNE(B1)',
|
|
'fr',
|
|
'=3*ROW(B1)',
|
|
],
|
|
'handle _xlfn' => [
|
|
'=MAXWENNS(C5:C10; C5:C10; "<30")',
|
|
'de',
|
|
'=_xlfn.MAXIFS(C5:C10, C5:C10, "<30")',
|
|
],
|
|
'handle _xlfn and _xlws' => [
|
|
'=ФИЛЬТР(A5:D20;C5:C20=H2;"")',
|
|
'ru',
|
|
'=_xlfn._xlws.FILTER(A5:D20,C5:C20=H2,"")',
|
|
],
|
|
];
|