Internationalization and Translations
Route all user-visible strings through the i18n system in src/i18n/.
Adding a language constant
- Define it in
src/i18n/constants.tsinUPPER_SNAKE_CASE, built from a namespace prefix and key:
export const CONTEXTMENU_ITEMS_ROW_ABOVE = `${CM_ALIAS}.insertRowAbove`;
- Add the phrase to every language file in
src/i18n/languages/(20+ locales, e.g.en-US.ts,de-DE.ts), translated: a phrase a file lacks falls back to English, so a translated grid reads it in another language (WCAG 3.1.2).src/i18n/__tests__/languageCompleteness.unit.tsfails on a file that lacks a phraseen-USholds, holds an empty one, or uses a placeholder the English phrase does not have. Each file imports constants as* as C:
[C.CONTEXTMENU_ITEMS_ROW_ABOVE]: 'Insert row above',
Pluralizable strings use an array: ['Remove row', 'Remove rows'].
- A new language file also needs the barrel export in
src/i18n/languages/index.ts.
Consuming translations
import * as C from '../../i18n/constants';
const label = this.hot.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ROW_ABOVE);
RTL
layoutDirection: 'rtl'. Use logical CSS properties (inset-inline-start in place of left). Test with ar-AR or fa-IR.
IME
Editors handle compositionstart, compositionupdate, compositionend for CJK input; leave composition state untouched when changing editor behavior.
Locale-aware casing
Lowercase cell data with localeLowerCase(value, locale) from src/helpers/string.ts, in place of String.prototype.toLocaleLowerCase (ESLint no-restricted-syntax enforces it). It keeps Turkish/Azeri/Lithuanian special casing, takes the fast toLowerCase() path elsewhere, and does not throw on an invalid locale tag.