Skip to content

feat(html): type and show function names in the language of the document - #1242

Merged
andiwand merged 2 commits into
mainfrom
feat/formula-localized-names
Oct 24, 2026
Merged

andiwand merged 2 commits into
mainfrom
feat/formula-localized-names

Conversation

@andiwand

@andiwand andiwand commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

The last of the spreadsheet leftovers: localized function names, for input and display, as agreed. A German user types =SUMME(A1;B1), the file states SUM, and the cell opens as =SUMME(A1;B1). It is rebased on main with #1240 and #1241.

What

  • Data. tools/formula/generate_function_names.py writes formula_function_names.cpp from the LibreOffice translations (source/<language>/formula/messages.po, MPL-2.0) at a pinned commit, as tools/pdf does for its data. It keeps the entries of RID_STRLIST_FUNCTION_NAMES for the functions the evaluator implements: 1526 names in the 16 languages of number_format::boolean_words. The cache tools/formula/po/ is ignored. Excel's names can differ from LibreOffice's, so the table follows LibreOffice.
  • Mapping. formula::localized_functions(formula, locale) and english_functions(formula, locale) work on the text:
    • A name counts when it stands ahead of (, outside a text and a quoted sheet name.
    • The parser reads only ASCII letters in a name, so ZÄHLENWENN could not be mapped on the tree.
    • The language comes from the locale: pt-BR has its own table, and no maps to nb.
    • The match ignores the case of ASCII letters only, so zählenwenn does not match ZÄHLENWENN.
  • Round trip. For every function the evaluator implements, in all 16 languages, the name a cell opens with maps back to the same function. A translated name can be the English name of another function, such as Danish TIME for HOUR, but then that function shows translated too (TID). No two functions share a translated name. An English name typed into such a language reads as LibreOffice reads it there: TIME is HOUR in Danish.
  • Module and page. toFile and toInput take the locale of the page (data-odr-locale). An xlsx states none, so it stays English.

Test

  • FormulaWriter.a_function_name_takes_the_language_of_the_document: German and French, English input that stays, a name in a text and in a quoted sheet name that stays, a language without a table, and no.
  • formula.test.mjs: toFile and toInput in German, Austrian German and French, and in Japanese, which keeps English. The node suite passes (82 tests).
  • formula-input.html (32 checks): the German page opens a formula cell as =SUMME(A1;B1)*1,5 and =STABW.S(…), and =summe(A1;B1)*1,5 typed in lower case writes of:=SUM([.A1];[.B1])*1.5.
  • Native: the html, formula, recalculation and edit suites pass. All 19 sheet pages pass headless.

andiwand and others added 2 commits October 24, 2026 19:23
- `formula::localized_functions` and `english_functions` turn the names of
  a formula into the ones LibreOffice shows in the language of a locale and
  back. A name counts ahead of `(`, outside a text and a quoted sheet name.
  The match ignores the case of ASCII letters.
- `tools/formula/generate_function_names.py` writes the table from the
  LibreOffice translations at a pinned commit: 1526 names of the functions
  the evaluator implements, in the 16 languages of the boolean words.
- `toFile` and `toInput` of the module take the locale of the page, so a
  German user types `=SUMME(A1;B1)`, the file states `SUM`, and the cell
  opens as `=SUMME(A1;B1)`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017QtawyvLP2SCnoBtnVfFed
- `localized_functions` and `english_functions` are defined as
  `formula::…` in the reopened `odr::internal`, as AGENTS.md asks, so a
  signature that drifts from the header fails to compile.
- The design doc wraps its paragraph on function names.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YHNzLmVv1mFWfPitHASucN
@andiwand
andiwand force-pushed the feat/formula-localized-names branch from 1dd496a to 3a30b8f Compare October 24, 2026 17:26
@andiwand
andiwand merged commit 8bb2f1b into main Oct 24, 2026
21 of 23 checks passed
@andiwand
andiwand deleted the feat/formula-localized-names branch October 24, 2026 17:28
andiwand added a commit that referenced this pull request Oct 24, 2026
The brotli'd `odr-core.wasm` grew slowly to the 1.5 M ratchet. The
last green commit on main (5ae95b9) measures 1,573,966 bytes locally,
so no single change crossed it. Main now measures 1,590,514 bytes,
and the localized function names (#1242) add about 16 K.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017QtawyvLP2SCnoBtnVfFed
andiwand added a commit that referenced this pull request Oct 24, 2026
The brotli'd `odr-core.wasm` grew slowly to the 1.5 M ratchet. The
last green commit on main (5ae95b9) measures 1,573,966 bytes locally,
so no single change crossed it. Main now measures 1,590,514 bytes,
and the localized function names (#1242) add about 16 K.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017QtawyvLP2SCnoBtnVfFed
andiwand added a commit that referenced this pull request Oct 24, 2026
The brotli'd `odr-core.wasm` grew slowly to the 1.5 M ratchet. The
last green commit on main (5ae95b9) measures 1,573,966 bytes locally,
so no single change crossed it. Main now measures 1,590,514 bytes,
and the localized function names (#1242) add about 16 K.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

1 participant