Skip to content

Formulas in Polish: names, separators, booleans, errors and table specifiers - #674

Closed
brzuchal wants to merge 24 commits into
storytold:mainfrom
brzuchal:formula-pl
Closed

brzuchal wants to merge 24 commits into
storytold:mainfrom
brzuchal:formula-pl

Conversation

@brzuchal

@brzuchal brzuchal commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Polish formula entry and display, as a dialect for the formula languages from #443. With the interface in Polski, =JEŻELI(PRAWDA;SUMA(1,5;2,25);#N/D) and =suma.jeżeli(A1:A3;">1") work as typed, and files keep canonical English formulas.

Draft, stacked on two open PRs, as suggested by @quantmind-br in #430 (comment):

Once both are on main, only the last commit (63d19b8) is new. I'll rebase whenever needed.

Where the words come from

Question 1 in #430 (which sources are acceptable) is still open for the maintainers, so here is exactly what was done:

  • Observed in a licensed Excel for the web with a Polish interface and regional format, on 2026-10-12, in synthetic workbooks written for this purpose. Every function GridCraft knows was entered in canonical form (once plain, once with _xlfn.), and FORMULATEXT showed how Polish Excel displays it. This gave all 514 functions: 429 with a Polish name, 85 that keep the English one.
  • Also observed: separators (=SUMA(1;2), =1,5+1, {1\2\3}, {1;2;3}), booleans, the errors #ZERO!, #DZIEL/0!, #ARG!, #ADR!, #NAZWA?, #LICZBA!, #N/D, #OBL!, #ROZLANIE!, and the specifiers #Wszystko, #Dane, #Nagłówki, #Sumy.
  • From Microsoft's pl-pl help pages, not observed: #POBIERANIE_DANYCH and #Ten wiersz (Excel shows the @ short form).
  • Not used: LibreOffice, Gnumeric or HyperFormula translations.
  • Not committed: any file produced by Excel.

Two things the observation showed that the help pages get wrong or leave open:

  • Polish Excel shows #N/D, while the pl-pl ERROR.TYPE page prints #N/D!.
  • It keeps LAMBDA, LET, MAP, REDUCE, SCAN, MAKEARRAY and BYCOL in English while translating BYROW as WIERSZAMI. The table follows what Excel does.

JIS, EUROCONVERT and ADD2 are unknown to Excel for the web and keep their English names.

I am a native Polish speaker. The table was built with Claude (AI agent) from the observations above; no second native speaker has reviewed it yet.

Tests

  • crates/formula/tests/localized_input.rs: Pl in LOCALIZED. New Polish entry/display cases cover IF/VLOOKUP/#N/D, arrays with \, a table specifier with ;, IFERROR/XLOOKUP and ILE.WIERSZY(Tabela1[#Wszystko]), plus lower-case suma.jeżeli/fałsz/złącz.tekst. The round-trip and table checks pick up Pl through FormulaLocale::ALL.
  • crates/calc: formula_language_tables_only_name_functions_the_engine_knows passes with the Polish table.
  • crates/ui-egui/tests/formula_locale.rs: the i18n: add Polish (pl) interface #650 test that pinned Polish to canonical English is now polish_interface_enters_and_shows_polish_formulas.

Ran locally on Rust 1.95.0:

  • cargo test -p gridcraft-formula passes.
  • The calc test above passes.
  • cargo test -p gridcraft-ui-egui --test formula_locale --test interaction passes (11 + 25).
  • cargo fmt --all --check and cargo clippy -p gridcraft-formula --all-targets -- -D warnings are clean.
  • cargo test -p gridcraft-ui-egui --lib has one failure that is already on main: missing French: Different First Page (fix(i18n): French labels name unrelated actions and omit two required translations #529).

I did not run the full cargo xtask ci.

Not in this PR

quantmind-br and others added 6 commits October 11, 2026 19:29
…sh table

The interface language picks the formula language, as in Excel. Each language is a data
table in crates/formula/src/input/<lang>.rs (function names, booleans, errors, structured
reference specifiers and separators) behind one Dialect, so the lexer, parser and display
printer take no per-language code:

- es (424 names), de (403), pt-BR (412), ru (459), each entry with its source; Microsoft's
  localized pages are machine-translated, so a name needs two agreeing signals
- local error literals (#WERT!, #Н/Д, #¡VALOR!), longest match wins
- local table specifiers ([#Kopfzeilen], [#Эта строка]) and separators inside []
- German `.` between array columns; Russian `:` between array rows (no row ranges inside
  braces), merged with upstream trim references (A1.:.F10, 1.:3)
- LET/LAMBDA bindings and workbook names shadow local names case-insensitively in any script
- editor autocomplete and argument hints take Unicode names; Insert Function searches and
  sorts by the local name; help shows the local name with local separators
- Czech and French interfaces keep English formulas until they get a table

Files, clipboard, engine commands, CLI and MCP keep canonical English syntax.
A 381-entry table covering every key of the reference (Japanese) table,
registered as a Pl variant in the Language enum (name "Polski", code pl,
system tags pl-* / pl_*). Written from the meaning of the English labels;
no other product's localisation was consulted.

Formulas and number formats keep the canonical en-US locale; a test pins it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	docs/localization-parity.md
…cifiers

A Polish dialect for the formula languages from storytold#443: 429 function names,
`;` arguments, decimal comma, `\\` and `;` in array constants,
PRAWDA/FAŁSZ, the ten error values and the five structured-reference
specifiers. The Polish interface now enters and shows Polish formulas.

Names and words were observed in a licensed Excel for the web with a
Polish interface, in synthetic workbooks; #POBIERANIE_DANYCH and
#Ten wiersz come from Microsoft's pl-pl help pages. Sources are listed
in crates/formula/src/input/pl.rs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	crates/ui-egui/src/control.rs
# Conflicts:
#	ROADMAP.md
#	crates/ui-egui/src/control.rs
@brzuchal
brzuchal marked this pull request as ready for review October 12, 2026 16:25
@brzuchal
brzuchal marked this pull request as draft October 12, 2026 16:26
brzuchal and others added 16 commits October 12, 2026 20:30
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps both new interface languages: Serbian from main and Polish from
this branch (enum, ALL, names, codes, tags, lookup and tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps both calc tests, and maps Serbian to the canonical en-US formula
locale like Czech and French, since it has no function table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps both formula-locale tests and both localization-parity rows
(Polish ribbon catalog, Brazilian Portuguese dialog catalog).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main now has the Format Cells lookup (storytold#788) and six new reference keys
(the Page Setup margins); this adds their Polish entries and keeps both
localization-parity rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sh table

The interface language picks the formula language, as in Excel. Each language is a data
table in crates/formula/src/input/<lang>.rs (function names, booleans, errors, structured
reference specifiers and separators) behind one Dialect, so the lexer, parser and display
printer take no per-language code:

- es (424 names), de (403), pt-BR (412), ru (459), each entry with its source; Microsoft's
  localized pages are machine-translated, so a name needs two agreeing signals
- local error literals (#WERT!, #Н/Д, #¡VALOR!), longest match wins
- local table specifiers ([#Kopfzeilen], [#Эта строка]) and separators inside []
- German `.` between array columns; Russian `:` between array rows (no row ranges inside
  braces), merged with upstream trim references (A1.:.F10, 1.:3)
- LET/LAMBDA bindings and workbook names shadow local names case-insensitively in any script
- editor autocomplete and argument hints take Unicode names; Insert Function searches and
  sorts by the local name; help shows the local name with local separators
- Czech and French interfaces keep English formulas until they get a table

Files, clipboard, engine commands, CLI and MCP keep canonical English syntax.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main's Backstage Recent list added ten reference keys (Modified, Not
available, Just now, Yesterday and the {n} … ago forms).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A reference key main added; the catalog test requires it in Polish.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
storytold#443 was rebased onto main and now spells a function passed by name
(BYROW(…;SOMA), GROUPBY(…;SUMME)) in the formula language. This keeps
the Polish dialect next to it (enum, ALL, dialect lookup, tests), takes
the new argument translation, and adds Polish cases for it
(WIERSZAMI(…;SUMA), GRUPUJ.WEDŁUG(…;SUMA)). The calc test both sides
carried is kept once.
@yrrh

yrrh commented Oct 14, 2026

Copy link
Copy Markdown

I cross-checked the 429 names in pl.rs against Microsoft's own pl-pl documentation (the alphabetical function list plus each function's pl-pl page, fetched 2026-10-14). 392 match outright, and almost all of the remaining differences are inconsistencies inside Microsoft's pages rather than in this table (e.g. the IMCSC/IMSECH pages are titled CSC.LICZBA.ZESP but their syntax lines say CSC.LICZBY.ZESP, the *B variants only show up on the alphabetical list, and the dynamic-array pages mix English titles with Polish examples). So the table looks solid. Two entries are worth a second look in a desktop Polish Excel, because the docs disagree with what the table has:

Both are recent functions whose names Microsoft may have changed between the web and desktop builds, so the observation in Excel for the web might simply differ from the current desktop release. Not blocking, just flagging it for whoever can check against a desktop Excel 365 in Polish.

For what it's worth, the Polish names Microsoft documents for functions the engine doesn't have yet (WEŹDANETABELI, DANE.CZASU.RZECZ, OBRAZ, HISTORIA.AKCJI, PRZETŁUMACZ, WYKRYJJĘZYK, WYWOŁAJ, REJESTR.KOD) are correctly left out, given formula_language_tables_only_name_functions_the_engine_knows.

Microsoft's pl-pl pages name PERCENTOF PROCENT and MAP MAPUJ. Observed
again in Excel for the web (excel.cloud.microsoft) with a Polish
interface: ODSETEK, MAP and BYCOL calculate, and PROCENT, MAPUJ and
KOLUMNAMI are not functions there.
@brzuchal

Copy link
Copy Markdown
Contributor Author

@yrrh thanks for going through all 429 names against the pl-pl pages. That is a useful independent check.

I rechecked the flagged entries today in Excel for the web (excel.cloud.microsoft) with a Polish interface, in a fresh workbook. Excel confirms the table:

Canonical In the table Typed in Polish Excel for the web Result
PERCENTOF ODSETEK =ODSETEK(1;4) 0,25, with ODSETEK's Polish argument help ("podzbiór_danych; wszystkie_dane")
=PROCENT(1;4) #NAZWA?; autocomplete offers only PROCENT.POZYCJA (PERCENTRANK)
MAP MAP (English) =MAP(A1:A2;LAMBDA(x;x*2)) spills 2 and 8
=MAPUJ(…) not a function: no autocomplete, #NAZWA?
BYCOL BYCOL (English) =BYCOL(A1:A2;LAMBDA(x;SUMA(x))) 5
=KOLUMNAMI(…) not a function: no autocomplete, #NAZWA?

So for these three the pl-pl pages disagree with what Excel for the web accepts, and the table follows Excel. Your point about desktop builds still stands: I can't check a desktop Excel 365 in Polish. If someone can, a desktop/web difference would be worth knowing. a71220c records the recheck in the header of input/pl.rs.

The table itself comes only from observing Excel with FORMULATEXT, as the header of pl.rs describes, not from the documentation. Whether that kind of observation is an acceptable source is still the open question for the maintainers in #430.

Keeps both changes to function-parity.md's status line and both progress-log rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@brzuchal

Copy link
Copy Markdown
Contributor Author

Closing in favour of #1678.

@quantmind-br thanks for the heads-up and for the offer. #443, which this was built on, is closed and split, and moving this branch onto #1522 would mean a rebase and force-push of a branch with an open PR, which I avoid. So I started clean: #1678 is cut from formula-dialects (73609ed) with the Polish interface from #650 merged in, and adds Polish in the same shape as your German branch: one input/pl.rs (the table from here, unchanged), one FormulaLocale variant, one arm in Language::formula_locale, and its tests.

The review here (@yrrh's comparison with the pl-pl pages and my recheck of ODSETEK, MAP and BYCOL in Excel) stays as the record behind the table; the header of pl.rs points to it.

@brzuchal brzuchal closed this Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants