mirror of
https://github.com/storytold/gridcraft.git
synced 2026-11-10 12:29:58 -06:00
* M12.AR6: honour the B1/B2 calendar prefixes in number formats (Hijri for B2) * M12.AR6: match Excel's B1/B2 behaviour measured in review Changes from a reviewer's Excel run (TEXT and Range.NumberFormat): - A [$-...] locale tag before B2 keeps the date Gregorian (prefix still hidden); B2[$-401] stays Hijri. - Any other unquoted B and digit (B3dd, dd/mm/yyyyB2, dd B2 mm), and B2 before a number format (B20.00), make the code invalid: TEXT gives #VALUE!, a cell shows General, as for a code over 255 characters. - Under B2, ddd and dddd show the Arabic weekday name (full name for both). - Serial 60 has no Hijri date: TEXT gives #VALUE!, a cell shows ####. - Serial 0 shows as serial 1 (29/08/1317). Also fixes a break from merging main: days_from_civil now returns 0 for day 0 and 29 February 1900, which sent serials 0 and 60 to 1970 (23/10/1389) under B2. The Hijri day count no longer passes those dates. Docs: localization-parity states the behaviour, including the one measured case not matched (mmmm next to dddd prints the weekday in Excel). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * M12.AR6: Hijri leap year in cycle year 15, not 16, as Excel shows A reviewer compared Excel's B2yyyy-mm-dd on 43,512 serials with this formula: it disagreed by one day on 1,372, all in cycle years 15 and 16, and moving the leap year from 16 to 15 left no disagreement. The leap years are now 2, 5, 7, 10, 13, 15, 18, 21, 24, 26 and 29 (still 10,631 days a cycle). The count of leap years before a year becomes (4 + 11y) div 30; it differs from the old (3 + 11y) div 30 only when y = 16 (mod 30), which is exactly the move from 16 to 15. The inverse's year estimate can now be one year off at a boundary and is corrected by one step. Tests: Excel values for 2 March 2005 (1426-01-21) and 29 January 2006 (1426-12-29) plus the 1425/1426 year boundaries they imply, the reviewer's other anchors, and exhaustive checks: year, month and 30-year cycle lengths for Hijri years 1 to 10,000; day -> Hijri -> day round trip and day-by-day succession for every day from 1 Muharram 1 AH to one cycle past 31 December 9999; every 1900-system serial 1 to 2,958,465 (except 60). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * M12.AR6: match B1/B2 details checked in Excel 16.0 build 20527 Compared GridCraft with Excel 16.0 (build 20527, en-US) through COM: TEXT with B2dd/mm/yyyy on every serial from 1 to 2,958,465 (no difference), and about 1,750 format/value pairs through both a cell's NumberFormat and TEXT. Fixed what differed and is in scope: - Two-word Hijri month names use a no-break space (U+00A0), as Excel does. - B1 before a number format is rejected like B2 (B10.00, B1#,##0). - Prefix runs: a repeated prefix is accepted (B2B2, B2b2, [Red]B2B2, B1B1); a mixed one (B1B2, B2B1), more digits (B12, B21, B02), a prefix after a tag or space (B2[Red]B2, B2 B2) and an escaped \B2 are rejected. - Serial 60 under B2 is #VALUE! for any date or clock part (hh:mm, ss, AM/PM), not only date parts; [h] and literal-only sections still show. Regression tests use the Excel values (all 12 month and 7 weekday names, the accepted and rejected codes, serial 60). Not changed, listed in the docs: Excel's weekday/month-name mix-ups when ddd(d) and mmm(m) share a B2 section, weekday-only B2 sections (real weekday for serials 0-59, #VALUE! for the last days of 9999), and Buddhist-year b/bb/bbbb tokens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com> Co-authored-by: FredApps <FredApps@users.noreply.github.com>
158 lines
18 KiB
Markdown
158 lines
18 KiB
Markdown
# Localization parity
|
||
|
||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-27 · **Change:** minor (number formats honour the `B1`/`B2` calendar prefixes, checked against Excel; earlier: missing translations are listed by `cargo xtask i18n-report` and never fail a check; Arabic text sorts by its letters, not its vowel marks); previously minor (AutoFit estimates Arabic text width from measured glyph widths); previously minor (missing translations are listed by `cargo xtask i18n-report` and never fail a check; Arabic text sorts by its letters, not its vowel marks) · **Target:** Microsoft Excel (Microsoft 365), Excel for Mac 16.113.4
|
||
|
||
Per-language status against Excel, which ships its UI in dozens of languages (Windows language
|
||
packs cover 100+), with localized function names, argument separators, number and date formats,
|
||
right-to-left sheets and full complex-script support. Part of
|
||
[target-app-parity.md](target-app-parity.md). **Localization: ~10% ready, 100–165 h** (estimated).
|
||
|
||
## Where we are (measured from source on `main`, after the 2026-10-10 merges)
|
||
|
||
- **A first catalog exists, for the ribbon only.** `crates/ui-egui/src/i18n.rs` (merged 10-10 in
|
||
#31, #104, #82; German added 10-11) adds an interface-language preference that defaults to the
|
||
system language (closes #20) and a View-tab switcher, with English-keyed lookup tables:
|
||
Japanese 268 labels, Simplified Chinese, Korean, Russian, Brazilian Portuguese, German and Czech 266
|
||
each. The tables are used by
|
||
the ribbon, sheet tabs and widgets (`ribbon.rs`, `tabs.rs`, `widgets.rs`), the Format Cells
|
||
dialog, every dialog title and the shared OK/Cancel buttons; the other dialogs, menus,
|
||
context menus, task panes, status messages and command labels are still English literals.
|
||
Untranslated labels fall back to English.
|
||
- **Function help** (the argument hint, autocomplete, Insert Function and the Formulas-tab
|
||
menus) follows the interface language through per-language tables keyed by the catalog's
|
||
English text (`i18n/<lang>_functions.rs`): descriptions, and argument names from which the
|
||
hint is assembled with the formula syntax's function name and separator. Spanish translates
|
||
the 10 common functions it had help for (SUM, AVERAGE, IF…); other languages show the English
|
||
help.
|
||
- **A first catalog exists.** `crates/ui-egui/src/i18n.rs` (merged 10-10 in #31, #104, #82; German
|
||
added 10-11) adds an interface-language preference that defaults to the system language (closes
|
||
#20) and a View-tab switcher, with English-keyed lookup tables: Simplified Chinese, Korean,
|
||
Russian, German and Czech 266–518 labels each, Brazilian Portuguese and Japanese 943 each. The
|
||
tables are used by the ribbon, sheet tabs and widgets (`ribbon.rs`, `tabs.rs`, `widgets.rs`), the
|
||
Format Cells dialog, every dialog title and the shared OK/Cancel buttons; Japanese and Portuguese
|
||
also cover the other dialog labels, message boxes, Backstage/File-view items, template names and
|
||
native menus (Japanese, 10-17: `i18n/ja.rs` keeps the shared 398-label core and adds 545 of those
|
||
strings). The remaining menus, context menus, task panes, status messages, command labels and
|
||
function descriptions are still English literals. Untranslated labels fall back to English.
|
||
- **About 2,200 user-visible strings** in all (heuristic source scan: ~1,700 UI and command
|
||
strings plus ~500 function descriptions), so the ribbon-only languages cover **~12%** and
|
||
Japanese and Portuguese **~43%** (measured count / estimated total).
|
||
- **en-US only formulas and formats.** Function names, `,` argument separator, `.` decimal
|
||
separator, en-US number and date formats (`crates/numfmt` says "en-US only"). Users ask for
|
||
localized function names and `;` separators (#45). German with localized numbers and formulas
|
||
is in PR #163 (open). The `B1` (Gregorian) and `B2` (Hijri) calendar prefixes that Arabic
|
||
Excel writes at the start of a format section are hidden; under `B2` the year, month number,
|
||
day, month names and weekday names (Arabic; `mmm` and `ddd` show the full name) count in the
|
||
tabular Hijri calendar (leap years 2, 5, 7, 10, 13, 15, 18, 21, 24, 26 and 29 of each 30-year
|
||
cycle). Checked against Excel 16.0 (build 20527, en-US) on every serial from 1 to 2,958,465
|
||
and about 1,700 format/value pairs: a `[$...]` locale or currency tag before `B2` keeps the
|
||
date Gregorian; a repeated prefix (`B2B2`) is accepted; any other `B` and digit (`B3`,
|
||
`B12`, `B1B2`, `dd B2`, `\B2`), or a prefix before a number format (`B10.00`), is
|
||
rejected (`TEXT` gives `#VALUE!`, a cell shows General); serial 60 shows `#VALUE!` under `B2`
|
||
for any date or clock part; two-word month names use a no-break space. Differs from Excel:
|
||
in a `B2` section with a weekday and a month name, Excel prints the weekday for
|
||
`mmmm`/`mmmmm` after `ddd`/`dddd`, and the weekday numbered by the month (Saturday from
|
||
month 7) for `ddd`/`dddd` after `mmm`/`mmmm`; a `B2` section showing only the weekday uses
|
||
the real weekday for serials 0–59 and gives `#VALUE!` for the last days of 9999. Excel's
|
||
Buddhist-year `b`/`bb`/`bbbb` tokens are not supported.
|
||
- **Script support.** System-font fallback for CJK, Thai and Hebrew landed in #38 (closes #32;
|
||
#142 is still open pending confirmation). Native CJK fallback also probes Flatpak's read-only
|
||
`/run/host/fonts`, `/run/host/local-fonts` and `/run/host/user-fonts` layouts, so installed
|
||
Noto CJK and WenQuanYi faces can render Chinese without a broad filesystem grant. This does
|
||
not change the installed-font catalogue or add bundled fonts. Lao falls back to Lao Sangam MN / Lao MN (macOS),
|
||
Leelawadee UI / DokChampa (Windows) or Noto Sans Lao / Phetsarath OT (Linux). There is no complex-text shaping: Arabic and
|
||
Devanagari don't join or reorder, and there is no bidirectional layout. **Sheet Right-to-Left**
|
||
(`view.rightToLeft`, Page Layout › Sheet Options, XLSX `rightToLeft`, `.xls` WINDOW2 fRightToLeft) mirrors the grid (#146):
|
||
column A and the row headers on the right, the vertical scrollbar on the left; hit-testing,
|
||
arrow keys, editor, popups and floating objects follow; text stays left-to-right inside its box
|
||
(no bidi), and the sheet tabs, horizontal scrollbar and printing/PDF are not mirrored yet.
|
||
Text boxes and shapes keep their paragraphs' right-to-left direction (`a:pPr rtl`) through XLSX
|
||
save, though GridCraft still draws that text left to right. IME input goes
|
||
through egui/winit and is unverified for Chinese, Japanese and Korean.
|
||
- **Names in any script.** Defined names (Define Name, Create from Selection) are limited to
|
||
255 characters, counted as characters rather than UTF-8 bytes, so a 255-letter Arabic name is
|
||
accepted as in Excel. Sheet names already counted characters (31).
|
||
- **PDF export** uses only the 14 standard PDF fonts: non-Latin text cannot export.
|
||
|
||
## Languages
|
||
|
||
UI strings translated are measured counts against the ~2,200 estimate. Estimates to `full`
|
||
include the rest of the catalog work below (10–20 h, counted once), localized function names,
|
||
separators, number/date formats, machine translation with agent review, and script work.
|
||
|
||
| Language | Code | UI strings translated | Dialogs / tooltips / help | Script support | Native review | Status | Estimate to full |
|
||
|---|---|---|---|---|---|---|---|
|
||
| English | en | ~2,200 / ~2,200 (100%, source) | yes | Latin: yes | yes | full | — |
|
||
| Simplified Chinese (Mandarin) | zh-Hans | 266 (~12%) | no | CJK system-font fallback (#38); IME unverified; PDF can't export | no | menus only | 8–13 h |
|
||
| Spanish | es | 0 (0%) | no | Latin: yes | no | none | 6–10 h |
|
||
| Hindi | hi | 0 (0%) | no | Devanagari: **no shaping** | no | none | 12–18 h |
|
||
| Arabic | ar | 0 (0%) | no | **no shaping, no RTL UI**; Sheet Right-to-Left mirrors the grid (#146) | no | none | 25–35 h |
|
||
| French | fr | 0 (0%) | no | Latin: yes | no | none | 6–10 h |
|
||
| Portuguese | pt-BR | 943 (~43%) | dialogs and tooltips (dialogs take effect with #669) | Latin: yes | no | menus, File view, dialogs | 2–4 h |
|
||
| Indonesian | id | 0 (0%) | no | Latin: yes | no | none | 5–8 h |
|
||
| Japanese | ja | 268 (~12%) | no | CJK system-font fallback; IME unverified; no furigana display, but phonetic runs (ふりがな) survive an XLSX open + save | no | menus only | 8–12 h |
|
||
| Japanese | ja | 943 (~43%) | dialogs and messages | CJK system-font fallback; IME unverified; no furigana display | no | menus, File view, dialogs, messages | 3–5 h |
|
||
| Japanese | ja | 268 (~12%) | no | CJK system-font fallback; the theme's East Asian typeface (`<a:ea>`) survives open + save (rendering does not use it yet); IME unverified; no furigana display | no | menus only | 8–12 h |
|
||
| German | de | 266 (~12%) | no | Latin: yes | no | menus only | 4–8 h |
|
||
| Italian | it | 971 (~44%) | dialogs, tooltips, pivot pane | Latin: yes | no | menus, File view, dialogs, pivot pane | 3–5 h |
|
||
| Korean | ko | 266 (~12%) | no | Hangul via the CJK fallback; IME unverified | no | menus only | 6–10 h |
|
||
| Vietnamese | vi | 0 (0%) | no | Latin with stacked diacritics: unverified | no | none | 6–10 h |
|
||
| Turkish | tr | 382 (~17%) | no | Latin: yes | yes | menus only | 4–8 h |
|
||
|
||
Other shipped languages: Russian (ru), German (de), Czech (cs), French (fr) and Turkish (tr), menus only.
|
||
| Vietnamese | vi | 398 (~18%) | no | Latin with stacked diacritics: unverified | no | menus, File view | 5–9 h |
|
||
Other shipped languages: Russian (ru) and German (de), 266 labels each (~12%), menus only; Dutch (nl), 518 labels (~24%): ribbon, context menus, File view, dialog titles and the Options page.
|
||
|
||
**Total:** catalog work 10–20 h + languages 92–144 h ≈ **100–165 h**. Parallelizes almost fully
|
||
once the catalog covers dialogs and commands. **Needs a human:** native-speaker review of every
|
||
language (none so far) and of localized function names.
|
||
|
||
## Infrastructure (do first)
|
||
|
||
1. Extend the catalog from the ribbon to every user-visible string (dialogs, menus, task panes,
|
||
status and error messages, command labels, function descriptions). A string a catalog lacks
|
||
shows in English and never fails a check: `cargo xtask i18n-report` lists the missing strings
|
||
per language, and `cargo xtask ci` runs it first. Language switching and the system-language default already exist (#31).
|
||
2. Locale-aware formulas: localized function-name tables and separators at the formula-bar
|
||
boundary only (files keep en-US invariant names), locale number and date formats, list
|
||
separators in CSV.
|
||
3. Text shaping and fallback: a shaping engine for grid, editor and PDF text (Arabic, Devanagari,
|
||
Thai), system font fallback for CJK, bidirectional runs, right-to-left sheet tabs and printing;
|
||
embedded subset fonts in PDF.
|
||
|
||
## Revision history
|
||
|
||
| Date | Change | Summary |
|
||
|---|---|---|
|
||
| 2026-10-27 | minor | Number formats honour the `B1`/`B2` calendar prefixes: never shown; `B2` renders year, month, day and Arabic month and weekday names in the tabular Hijri calendar (1 Jan 2001 = 6 Shawwal 1421; leap years 2, 5, 7, 10, 13, 15, 18, 21, 24, 26 and 29 of the 30-year cycle, which is what Excel shows). Checked against Excel 16.0 (build 20527, en-US) on every serial and about 1,700 format/value pairs: a locale or currency tag before `B2` keeps the date Gregorian, a misplaced `B` and digit or a prefix before a number format is rejected, serial 60 has no Hijri date, serial 0 shows as serial 1, two-word month names use a no-break space. Not matched: Excel's weekday/month-name mix-ups in one `B2` section and its weekday-only quirks |
|
||
| 2026-10-27 | minor | AutoFit column width, wrapped-row height and PivotTable column fit estimate Arabic letters at ~0.48 em (measured 0.36–0.53 em shaped, Noto Sans/Naskh Arabic and DejaVu Sans) instead of 1 em, Arabic-Indic digits as wide as ASCII digits, and give vowel marks and direction marks no width; vowelled Arabic no longer fits ~3.5× too wide |
|
||
| 2026-10-23 | minor | Missing translations are reported, never a failure: `cargo xtask i18n-report` prints, per language, the strings other catalogs translate and it lacks (plus Spanish function help rows keyed by English the function catalog no longer has) and always passes; `cargo xtask ci` runs it first. Coverage and per-language parity tests and tests of one language's exact wording are gone; UI tests take the expected text from the catalog. Duplicate-key, placeholder, context-prefix and line-shape checks stay |
|
||
| 2026-10-21 | minor | Romanian interface (`ro`, Română): 970 labels covering every key of the other catalogs (`crates/ui-egui/src/i18n/ro.rs`), `ro-*` system locales, the View-tab switcher and `app.language.set`; context keys show no prefix (File › Options test). English formulas and formats; AI-assisted draft pending native-speaker review |
|
||
| 2026-10-20 | minor | Japanese: furigana (`rPh` phonetic runs and `<phoneticPr>` in `xl/sharedStrings.xml`) is no longer deleted by an open + save; it is kept on the workbook and written back (a `<phoneticPr>` without runs is kept too, while duplicate texts with different readings keep only the first, reported on open). Display of the readings is still missing (`crates/xlsx/src/tests/phonetic_tests.rs`) |
|
||
| 2026-10-20 | minor | Japanese catalog (`i18n/ja.rs`) covers every key the Brazilian Portuguese catalog translates: the 398-label shared core moved verbatim plus 545 dialog, message, Backstage and menu strings — 943 keys, ~12% → ~43%. A test parses `pt.rs`'s source, so the two catalogs can't drift apart again. Portuguese re-measured at 943 (was 923) |
|
||
| 2026-10-20 | minor | Dutch (nl) interface catalog (`i18n/nl.rs`, 518 labels, ~24%): the shared key set every language must cover (ribbon, context menus, File view, dialog titles, Options page), matching the German, French and Czech catalogs; `nl-NL`, `nl-BE` locale tags resolve to Dutch |
|
||
| 2026-10-20 | minor | XLSX: a theme's per-script typefaces (`<a:font script="Arab">`, Hebr, Jpan…) are kept through open + save, so Arabic Excel's theme fonts for shapes, charts and theme-font cells survive a GridCraft save |
|
||
| 2026-10-20 | trivial | XLSX: a workbook theme's major/minor East Asian (`<a:ea>`) and complex-script (`<a:cs>`) typefaces are kept through open + save, so a Japanese workbook keeps its theme's East Asian font; rendering does not resolve them yet (follow-up) |
|
||
| 2026-10-19 | minor | Text order (Sort, SORT/SORTBY, `<`/`>`, approximate MATCH/XLOOKUP, `"<x"` criteria) compares letters first: Arabic vowel and Quranic marks, tatweel and invisible format characters (bidi marks, embeddings and isolates, ZWJ/ZWNJ, BOM, soft hyphen) no longer decide where text sorts, and Arabic-Indic digits sort as digits. Text with the same letters then sorts letter by letter, unmarked before marked, marks in Excel's order (sukun before shadda) and digits ASCII, Arabic-Indic, Extended Arabic-Indic; checked against Excel 16.0 build 20527 (en-US). Equality is unchanged |
|
||
| 2026-10-19 | minor | XLSX fonts retain charset and family metadata so systems can select a substitute font with the intended script when the named font is unavailable |
|
||
| 2026-10-19 | minor | Arabic CSV and text imports decode Windows-1256 text; Arabic shaping and bidirectional UI remain unsupported |
|
||
| 2026-10-19 | minor | Defined-name length counts characters, not bytes: Arabic names up to 255 letters are accepted, and Create from Selection keeps long Arabic headers |
|
||
| 2026-10-19 | minor | Table names are limited to 255 Unicode characters |
|
||
| 2026-10-19 | minor | Right-to-left sheets in legacy `.xls` files (common in older Arabic workbooks) open right-to-left |
|
||
| 2026-10-19 | trivial | Text boxes and shapes keep right-to-left paragraph direction (`a:pPr rtl`) on XLSX save, so Excel-authored Arabic and Hebrew text boxes reopen right to left |
|
||
| 2026-10-19 | minor | Save as Web Page and copied HTML mark right-to-left sheets `dir="rtl"`, let General-aligned Arabic and Hebrew text align by its own direction (`dir="auto"`), and keep numbers on right-to-left sheets left to right and on the left |
|
||
| 2026-10-19 | minor | French and Serbian kept the context in three `context\|label` translations ("Options\|Général", "Opcije\|Opšte" for `Options\|General`; also `Options\|Save`, `Sheet Options\|View`). `tr` shows a found translation as it is, so File › Options headings and the Sheet Options "View" checkboxes showed the prefix. Fixed; a test checks that no catalog shows a `\|` |
|
||
| 2026-10-17 | minor | Vietnamese catalog (`i18n/vi.rs`, every key in the master table); `vi` locale tags resolve to Vietnamese |
|
||
| 2026-10-17 | minor | Lao text falls back to an installed Lao face (`sys-lao`) instead of tofu boxes |
|
||
| 2026-10-15 | minor | Function help in the interface language: argument hints, autocomplete, Insert Function (search, categories) and the Formulas-tab menus read per-language tables of descriptions and argument names keyed by the catalog's English text; Spanish keeps its 10 functions in the new format |
|
||
| 2026-10-15 | minor | Italian catalog (`i18n/it.rs`, 971 entries, ~44%): every key the Brazilian Portuguese catalog translates plus the PivotTable Fields pane strings; `it` locale tags (it-IT, it-CH…) resolve to Italian. Labels follow Excel's Italian terminology; native-speaker review still pending |
|
||
| 2026-10-14 | minor | CJK fallback probes the read-only Flatpak host font mounts with the existing distribution layouts and TTC locale indices; no new sandbox permissions or bundled fonts |
|
||
| 2026-10-12 | minor | Turkish ribbon catalog (`i18n/tr.rs`, 382 labels); `tr` locale tags (tr-TR, tr_TR…) resolve to Turkish |
|
||
| 2026-10-12 | minor | Format Cells looks up its tabs, labels, options and note through `Language::tr` (Fill tab keyed `Format Cells\|Fill`); dialog titles and OK/Cancel too. Labels already in a table (Number, Currency, Fill…) show translated; the rest fall back to English until the tables add them |
|
||
| 2026-10-12 | minor | Brazilian Portuguese catalog (`i18n/pt.rs`) grows from 377 to 923 entries: every key the other catalogs translate, including the dialog strings #669 starts looking up (~42%) |
|
||
| 2026-10-11 | minor | German ribbon catalog (`i18n/de.rs`, 266 labels, ~12%); `de` locale tags (de-DE, de-AT, de-CH…) resolve to German. PR #163 (localized German formulas/numbers) still open |
|
||
| 2026-10-11 | minor | Sheet Right-to-Left mirrors the grid (#146) |
|
||
| 2026-10-11 | minor | Czech (cs) ribbon table: 266 labels (~12%), menus only |
|
||
| 2026-10-10 | minor | Re-measured after #31, #104, #82, #38 merged: ribbon translated into ja, zh, ko, pt-BR and ru (266–268 labels, ~12%), system-language default, CJK/Thai/Hebrew font fallback; ~10% ready, 100–165 h |
|
||
| 2026-10-10 | major | Created: English only, no catalog, ~2,200 strings, script-support gaps, open language PRs |
|