Locale text
The map is in @ember-lattice/core (src/i18n/).
Context
AG Grid "Localisation" lets an app replace each string that the grid shows, through one map.
Lattice showed English text from many packages: aria labels, live-region messages, menus,
panels, filters, editors and the sheet UI. Some messages joined parts of sentences, and some
tested count === 1 for a plural. The column types of @ember-lattice/column-types already
take a locale, but the filters and the editors called them with no locale.
The map must reach ui, editing, charts, sheet, marquetry and later ember. These
packages share only two dependencies: @ember-lattice/core and @ember-lattice/ember. Another
agent edits ember now, and this change adds no package.json dependency.
Decision drivers
Not recorded in the original ADR.
Options considered
Not recorded in the original ADR.
Decision
- The map is in
@ember-lattice/core(src/i18n/). Core has no Ember components, but it already has the Glimmer-tag atoms of ADR 0001, so it can hold reactive state with no@ember/*import. Every Lattice package imports core, so there is no cycle.embercan use the same module in phase B. - One flat map with namespaced keys.
DEFAULT_LOCALE_TEXThas the English defaults. A key has the form<package>.<part>.<name>, for exampleui.columnMenu.sortAscending. A flat map makes a partial override simple, and the docs key table is one list.LatticeLocaleTextandLatticeLocaleKeycome from the map. - Named params, no joins. A param is
{name}.formatTextfills the params, and shows a number param in the locale. The typeLatticeLocaleParams<K>takes the param names from the English default, so TypeScript and Glint find a wrong param name, also in a template. Each message is one whole sentence. A date filter op has its own keys (ui.filter.dateOp.*), because "Equals" is "On" for a date. - Plurals use
Intl.PluralRules. A plural key has.oneand.otherforms. A locale can add.zero,.two,.fewand.many. A missing form falls back to.other. - One owner-scoped provider.
setLatticeLocale(owner, { text, locale })keeps the settings in aWeakMapfrom the owner to one atom.latticeLocale(owner, override?, locale?)reads them. A component givesgetOwner(this). A v2 addon cannot add a service to the app with no app config, so a service is not an option. The atom read consumes its tag, so a change of the settings renders each surface that read them again. The first read makes the atom, so a latersetLatticeLocalealso reaches a surface that rendered before it. - A
@localeTextarg overrides the owner text for one component. A component gives the arg to the parts that it renders (for exampleSideBartoColumnsPaneland the filters). A part with a fixed signature (a Formwright control, a grid slot) reads only the owner text. - Plain classes take the owner as an option.
EditControllertakesownerandlocaleText. Withoutowner, its messages are in English. The sheet surface gets alocalefunction fromLatticeSheet. The Marquetry sheet entry gives its own controller the owner. - The locale goes to the column types. A
@localearg (or thelocaleoption ofEditController) sets the locale of one component. Without it, the owner locale applies. The condition filter, the floating filter and the editor parse read typed text in this locale. The set filter and the editor options format values in it. The grid@localedefaults to the owner locale, and goes to the cell text, the total row and the group labels. - Marquetry reports are not locale text.
report('Cells outside the sheet: …')goes to the model that wrote the spec, not to the DOM.
Consequences
- An app sets the locale in one call. A test sets it on
this.owner. - A module-level constant cannot hold a label, because it does not react to a change of the locale. Such constants now hold keys, and a getter reads the text.
CONDITION_OPSholds op names only.conditionOpLabel(locale, kind, op)gives the label.typeOps(type)lost itskindparam.setEntries,parseFloating,parseTyped,valueParser,parserOfandsparklineLabeltake an optional locale param.EditControllerjoins its two paste sentences with a space. A language that needs another join can put both counts in one sentence only with a new key. Shortcut: two plural counts in one key need a message format (ICU). Add one if a translation needs it.formatTextshows a number param with the defaultIntl.NumberFormatoptions. A message that needs other options formats the number first and gives it as a string.- Phase B moved the strings of
emberto the map:grid.*(19 keys),list.loadingandboard.*(6 keys).LatticeGrid,LatticeListandLatticeBoardtake@localeText. The board gives it to its lanes. A board message is one whole sentence with{lane},{position}and{total}params, not a joined part. rowNumberColumnandselectionColumnare plain functions with no owner. They take alocaleoption (aLatticeLocale). Without it, their default header is in English.- The default validation messages of
Workbookare keys (sheet.validation.*). The model stays free of Ember:validateandsetInputtake an optionalLatticeLocale, and the sheet surface gives its own. Without it, the messages are in English, with numbers in the workbook locale. Marquetry gives no locale: its messages go to the model in a report (item 9). packages/themehas no text. The sort arrows ingrid.csshave empty alternative text, andaria-sortgives the state.- Limits: the row numbers and the lane counts show Latin digits in each locale. The header of
an auto column comes from the data key with English casing. A group label with no column
value shows
null, as before. - The guide page
features/locale.mdhas the key table, and a Vitest test (packages/core/tests/unit/locale-docs.test.ts) checks it against the map.
Confirmation
Not recorded in the original ADR.
Interview record
Each question of the interview with its answer and its source. A fact from the code or a document, a question that the author did not ask, and an assumption are rows too.
| Question | Answer | Source |
|---|---|---|
| Where does the text of this page come from? | From the Markdown file docs/adr/0024-locale-text.md at commit 4c77ac4. The text of each section is the text of the Markdown file. A section that the Markdown file does not have says so. | Document: docs/adr/0024-locale-text.md |
Changelog
| Date | Author | Change |
|---|---|---|
| 2026-12-02 | Joe Gaudet | Status in the Markdown file: accepted, 2026-12-02. Phase A and phase B are done. |
| 2026-12-03 | Joe Gaudet | Commit 7ce4af2: Lattice 1.0 (#1) |
| 2026-12-04 | Joe Gaudet (agent) | Converted from docs/adr/0024-locale-text.md to this page. The text is the text of the Markdown file. |
The adr skill of skillsaw wrote this page. The HTML in this file is the source of truth. The diagrams are the Mermaid sources in it.