Skip to content

M12: Swedish interface catalog and formula table (on #443) - #1472

Closed
sommestad wants to merge 9 commits into
storytold:mainfrom
sommestad:sv-formula-table
Closed

sommestad wants to merge 9 commits into
storytold:mainfrom
sommestad:sv-formula-table

Conversation

@sommestad

@sommestad sommestad commented Oct 15, 2026 •

Copy link
Copy Markdown

Adds Swedish (sv) as an interface language and a formula language, for #430 and #45.

This sits on top of #443 (same Dialect mechanism and the same wiring in input.rs, i18n.rs and the docs), so until that one is merged the diff here also shows its commits. Only the last two commits are new:

  • i18n: Swedish interface catalog (sv): crates/ui-egui/src/i18n/sv.rs with the 398 keys the German, French and Serbian catalogs share (ribbon, File view, dialog titles, Format Cells labels), Language::Sv ("Svenska", code sv, sv-SE/sv-FI tags resolve to it).
  • M12: Swedish formula table: crates/formula/src/input/sv.rs, FormulaLocale::Sv, tests and docs rows.

Where the Swedish words come from. Instead of the page vote alone, most of this table was read from a running Swedish Excel: a workbook with one call per function (=NAME($A$1,…), 512 functions from gridcraft-cli functions) was opened in Excel for Mac 16.114 with macOS region Sweden, and each cell's formula local was read back through AppleScript. That gives Excel's own spelling for 464 functions (351 of them differ from English and are in the table; 111 keep the English name, e.g. ABS, INDEX, MAX, TEXT). The same run gave the separators (; arguments, , decimal, \ array columns, ; array rows), SANT/FALSKT, seven error names (#DIVISION/0!, #SAKNAS!, #VÄRDEFEL!, #OGILTIGT!, #NAMN?, #SKÄRNING!, #REFERENS!) and the specifiers #Alla, #Data, #Rubriker, #Summor.

The 48 functions that build did not resolve (it shows them as _xlfn.…: the dynamic-array and Excel 2019+ set, XLOOKUP, LET, LAMBDA, FILTER, IFS, TEXTJOIN, TEXTSPLIT…) come from Microsoft Support's sv-se function pages with the same two-signal vote as the other tables; 9 entries are marked reviewed with their evidence (TEXTSPLIT=DELATEXT, TEXTBEFORE=TEXTFÖRE, TOCOL=TILLKOL, the FORECAST.* family). Those pages show the English name for FILTER, LET, LAMBDA, MAP, REDUCE, SCAN, BYROW, BYCOL, MAKEARRAY, ISOMITTED, IFS, MAXIFS, MINIFS, TEXTJOIN, VSTACK, HSTACK, TAKE, DROP, CHOOSEROWS, CHOOSECOLS, WRAPROWS, WRAPCOLS, GROUPBY, PIVOTBY, PERCENTOF, REGEXTEST, REGEXEXTRACT, REGEXREPLACE and TRIMRANGE, so they keep it. #SPILL!, #CALC!, #HÄMTAR_DATA and #Denna rad are from Microsoft pages / the other languages' pattern and are unverified in a running Excel; corrections are one-line edits.

Checks. cargo test -p gridcraft-formula (the Swedish rows in localized_input.rs are the Excel-observed spellings), cargo test -p gridcraft-ui-egui, cargo fmt, cargo clippy -D warnings, cargo xtask layers, cargo xtask wasm.

The interface catalog follows the Swedish Excel UI wording (Start, Infoga, Sidlayout, Formler, Data, Granska, Visa; Klistra in, Radbryt text, Villkorsstyrd formatering, …) rather than a machine translation of the English keys; it has not had a second native-speaker review yet, so the docs keep "Native review: no".

quantmind-br and others added 9 commits October 13, 2026 07:54
…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.
Français selects French formula syntax: 398 local function names from
Microsoft's fr-fr function pages (two agreeing signals per entry, 35
reviewed by hand), VRAI/FAUX, French errors and table specifiers, ';'
between arguments and array rows, ',' decimals and '.' between array
columns. Separators, SOMME, TEXTE, AUJOURDHUI, LIGNES, #VALEUR! and four
specifiers were observed in French Excel 2013 (storytold#191).
French Excel 2024 gives #NOM? for NBCARB, CHERCHEB and TROUVEB, the
names that were inferred from the base name + B pattern (storytold#191). The
French names are LENB (unchanged), CHERCHERB and TROUVERB, as in
Microsoft's French text-function reference, perfectxl and auditexcel.

Adds the functions added after the table was collected: the four ODD*
bond functions (PRIX/REND.PCOUPON/DCOUPON.IRREG) and the four
PREVISION.ETS* functions, each from the Microsoft fr-fr page and ledojo.
PERCENTOF and TRIMRANGE keep English: the two sources disagree.
…ables

Name the functions the four tables were missing, each from a Microsoft
page plus an independent reference (excel-translator, perfectxl, native
tutorials and user formulas); where they disagree the function keeps its
English name.

- de (413): UNREGER.KURS/REND, UNREGLE.KURS/REND, PROGNOSE.ETS*,
  PROZENTVON, ABSCHNBEREICH.
- es (434): PRECIO.PER.IRREGULAR.1/2, RENDTO.PER.IRREGULAR.1/2,
  PRONOSTICO.ETS, .CONFINT, .ESTACIONALIDAD, PORCENTAJEDE,
  RECORTAR.RANGO, TEXTOBAHT. FORECAST.ETS.STAT stays English (Microsoft's
  page gives both ESTADISTICA and STAT).
- pt-BR (420): PREÇOPRIMINC, LUCROPRIMINC, PREÇOÚLTINC, LUCROÚLTINC,
  PREVISÃO.ETS*, PORCENTAGEMDE, CONVERTEREURO. REGEXTEST and REGEXREPLACE
  stay English, as in Brazilian Excel, and REPLACEB is SUBSTITUIRB, not
  the pattern-guessed MUDARB.
- ru (471): ЦЕНАПЕРВНЕРЕГ, ДОХОДПЕРВНЕРЕГ, ЦЕНАПОСЛНЕРЕГ,
  ДОХОДПОСЛНЕРЕГ, ПРЕДСКАЗ.ETS*, ПРОЦЕНТ, УРЕЗДИАПАЗОН, ДОЛЛСША,
  БАТТЕКСТ. FORECAST.ETS.CONFINT keeps the Cyrillic Е Excel spells it with.

The remaining pattern-derived byte-function names (FINDENB, ERSETZENB,
PROCURARB, EXT.TEXTOB, ENCONTRARB) now cite two sources. The table test
types and shows every name back.
RedDevilMan retested 13 French names in French Excel 2024 (storytold#443):
PRENDRE, EXCLURE, ETENDRE, DANSCOL, ORGA.COLS, CENTILE.EXCLURE,
PREVISION.LINEAIRE, FILTRE, RECHERCHEX, TROUVERB, CHERCHERB, LENB and
URLENCODAGE all work. Record them in fr.rs and the French tests, with
the separators that Excel took from its Windows region.
RedDevilMan checked ESTVIDE, ESTERR, ESTERREUR, ESTLOGIQUE, ESTNA,
ESTNONTEXTE, NON, ORGA.LIGNES and BDLIRE in French Excel 2024 (storytold#443):
all work. Record them, and that TEXTE format codes followed that
Excel's English region (dd/mm/yyyy works, jj/mm/aaaa is #VALEUR!).
RedDevilMan switched only the Windows regional format of his French
Excel 2024 to French (France) (storytold#443): =SOMME(1,5;2) is 3,5,
=COLONNES({1.2.3}) is 3, confirming . between array columns, and TEXTE
takes jj/mm/aaaa and refuses dd/mm/yyyy.
Add `crates/ui-egui/src/i18n/sv.rs` with the 398 keys the German, French
and Serbian catalogs share (ribbon, File view, dialog titles, Format Cells
labels), following the wording of Swedish Excel, and `Language::Sv`
("Svenska", code `sv`); `sv-SE`, `sv-FI` and `sv_SE.UTF-8` tags resolve to
it.
Add `crates/formula/src/input/sv.rs` and `FormulaLocale::Sv`: 378 local
function names, `SANT`/`FALSKT`, the Swedish error names and table
specifiers, `;` between arguments, `,` as the decimal separator and `\`
between array columns. The interface language Svenska selects it.

351 of the names, the separators, the booleans, seven error names and
four table specifiers were read from Excel for Mac 16.114 with macOS
region Sweden, by opening a workbook with one call per function and
reading each cell's `formula local`. The functions that build does not
resolve (XLOOKUP, LET, LAMBDA, FILTER, TEXTSPLIT…), `#SPILL!`, `#CALC!`,
`#HÄMTAR_DATA` and `#Denna rad` come from Microsoft Support's sv-se pages
with the two-signal vote the other tables use; nine entries are marked
`reviewed` with their evidence.
@Harrison-Booth

Copy link
Copy Markdown
Contributor

Hi @sommestad, @davvarn: a heads-up from a housekeeping pass over the open PRs, so the Swedish work doesn't get done twice.

Besides this PR, these open PRs also touch Swedish translation:

What I checked: the open PR list of this repository today (titles, changed files, created and updated dates). I did not run or compare the catalogs themselves, so the overlap is by scope, not by line.

Could the authors agree between you on one PR to carry Swedish (the others could then close, or be cut down to what the first one lacks)? Whichever you pick is fine; this isn't a ranking. The maintainers decide what merges.

For reference: the shared translation catalogs live in https://github.com/storytold/craft-i18n. GridCraft's own catalogs haven't moved there yet, so for now interface translations still go in this repository (crates/ui-egui/src/i18n/).

@sommestad

Copy link
Copy Markdown
Author

Thanks, closing this as duplicate

@sommestad sommestad closed this Oct 27, 2026
@sommestad
sommestad deleted the sv-formula-table branch October 27, 2026 14:00
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