Skip to content

Formulas in Polish on the formula dialects - #1678

Draft
brzuchal wants to merge 16 commits into
storytold:mainfrom
brzuchal:formula-pl-dialects
Draft

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

Conversation

@brzuchal

Copy link
Copy Markdown
Contributor

Polish formulas, rebuilt on the formula dialects. This replaces #674.

Stacked. This depends on two open PRs and stays a draft until both merge:

Only two commits are new here: afd2688 merges #650 into #1522's branch, and c80635e adds Polish.

Why a new PR

#674 was built on #443, which @quantmind-br has closed and split into #1522 (the mechanism) and one PR per language. Moving #674 onto #1522 would mean rewriting a branch with an open PR, which I don't do. I started a clean branch from #1522 instead, in the same shape as the German one: one input/pl.rs, one FormulaLocale variant, one arm in Language::formula_locale, and its tests. #674's discussion (the review against Microsoft's pl-pl pages and my recheck in Excel) stays there for reference.

What it adds

  • crates/formula/src/input/pl.rs, unchanged from Formulas in Polish: names, separators, booleans, errors and table specifiers #674: 429 function names, ; arguments, decimal comma, \ and ; in array constants, PRAWDA/FAŁSZ, the ten error values and the five table specifiers. The header lists the sources: observed black-box in a licensed Excel for the web with a Polish interface, in synthetic workbooks, plus two Microsoft pl-pl pages for words that could not be observed. No file produced by Excel is in the repository.
  • FormulaLocale::Pl and Language::Pl => FormulaLocale::Pl.
  • crates/formula/tests/polish_input.rs: entry and display both ways, English names and lower case accepted, MAP and BYCOL kept in English while BYROW is WIERSZAMI, PERCENTOF shown as ODSETEK, English separators rejected.
  • polish_interface_enters_and_shows_polish_formulas replaces the test that pinned the English fallback for the Polish interface.
  • A Polish row in docs/formula-input.md, plus ROADMAP.md and docs/localization-parity.md.

Checks

cargo fmt --all --check, cargo test --workspace and cargo clippy -p gridcraft-formula -p gridcraft-ui-egui --all-targets -- -D warnings pass on macOS with Rust 1.95. I'll run the full cargo xtask ci before marking it ready.

🤖 Generated with Claude Code

brzuchal and others added 16 commits October 12, 2026 08:50
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:
#	crates/ui-egui/src/control.rs
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 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>
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>
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>
A formula language becomes data: crates/formula/src/input/<language>.rs
holds its function names, booleans, error literals, structured-reference
specifiers and separators, and the lexer, parser and printer read every
language through that one Dialect table. Adding a language is one data
file and one FormulaLocale variant, with no new parsing code.

Spanish moves to it with the same ten names, and now also spells errors
(#¡VALOR!, #N/D) and table specifiers ([#Encabezados]) as Spanish Excel
does. Names, booleans and errors match case-insensitively in any script,
so local names may contain accents or Cyrillic. A worksheet function
passed by name (BYROW(A1:B3;SUMA)) is spelled like its call. The editor's
autocomplete, argument hints and Insert Function search take non-ASCII
names, and list local names in the order they are shown.

Part of storytold#430; the language tables follow in their own PRs.
- A function passed by name is not translated into a name a LET/LAMBDA
  binding or defined name holds: Spanish LET(SUM;42;ESERROR(SUMA)) keeps
  SUMA instead of reading back as the variable SUM.
- Table items after a space (Tabla1[ [#Datos];[a]]) are translated like
  unspaced ones; before, [#Datos] was taken for a column name.
- The evaluator compares LET/LAMBDA variable names ignoring case in any
  script, the rule the editor uses for shadowing, so
  LET(zählenwenn,LAMBDA(x,x*2),ZÄHLENWENN(3)) is 6, not #NAME?.
The Polish formula dialect needs the Polish interface language.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Polish dialect on the dialect tables from storytold#1522:
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.

The table is input/pl.rs from storytold#674 unchanged. Names
and words were observed in a licensed Excel for the web with a Polish
interface, in synthetic workbooks; ODSETEK, MAP and BYCOL were rechecked
on 2026-10-14 after a review against Microsoft's pl-pl pages. Sources are
listed in the file.

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

Copy link
Copy Markdown
Contributor

Heads-up @brzuchal: tonight's upstream merges (#1585 MEDIAN overflow, #1769) conflicted with formula-dialects in crates/calc/src/tests.rs and docs/function-parity.md, which is why this PR shows a conflict now. I merged upstream/main into formula-dialects with a normal merge commit (7b8573e3, no rewrite, full cargo xtask ci green) and #1522 is mergeable again.

To clear it here, a plain git merge quantmind-br/formula-dialects into your branch is enough: I checked that your head c80635ef merges with it cleanly, and the result merges cleanly into current main. No rebase needed.

webglobepl added a commit to webglobepl/gridcraft that referenced this pull request Oct 19, 2026
- All 434 functions whose Polish Excel name differs (was 102), in
  crates/formula/src/input/pl.rs. Names come from PhpSpreadsheet's
  pl table (MIT) cross-checked with a second independent table; where
  they disagree or are missing, Microsoft's pl-pl pages decide, and
  the names storytold#1678 observed in Excel for the web fill the rest.
- Polish error values on entry and display (#DZIEL/0!, #N/D, #ARG!,
  #ROZLANIE!, #OBL!...); #N/D! and English spellings stay accepted.
- Table specifiers (#Wszystko, #Dane, #Nagłówki, #Sumy, #Ten wiersz)
  with ';' between bracketed parts.
- A test checks every Polish name belongs to a known function and none
  shadows an English one.
webglobepl added a commit to webglobepl/gridcraft that referenced this pull request Oct 22, 2026
- FormulaLocale::Pl: all 434 functions whose Polish Excel name differs, in
  crates/formula/src/input/pl.rs. Names come from PhpSpreadsheet's pl table
  (MIT) cross-checked with a second independent table; where they disagree
  or are missing, Microsoft's pl-pl pages decide, and the names storytold#1678
  observed in Excel for the web fill the rest. Polish keeps MAX (only
  MAXIFS is MAKS.WARUNKÓW).
- PRAWDA/FAŁSZ, `;` argument and `\` array-column separators, decimal comma.
- Polish error values on entry and display (#DZIEL/0!, #N/D, #ARG!,
  #ROZLANIE!, #OBL!...); #N/D! and English spellings stay accepted.
- Table specifiers (#Wszystko, #Dane, #Nagłówki, #Sumy, #Ten wiersz) with
  ';' between bracketed parts.
- The locale tables are generalised (aliases()/boolean_names()) instead of
  hard-coding Spanish, and the parser keeps the locale instead of an `Es`
  flag; names are compared with the shared same_name, so `jeżeli` matches
  `JEŻELI` and a LET name `fałsz` is matched by `FAŁSZ`. Spanish behaviour
  is unchanged.
- Function help follows the interface language, as on main: Polish
  descriptions and argument names belong to the Polish catalog (storytold#1807).
- Tests: crates/formula/tests/polish_input.rs and
  crates/calc/tests/polish_function_names.rs (every Polish name belongs to a
  known function and none shadows an English one).
- Docs: ROADMAP.md and docs/localization-parity.md.

No interface language selects the locale yet; once a Polish catalog lands,
Language::formula_locale maps Pl to it.

This branch has not been deployed

No deployments
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