Localisation
Add text in any language in the Spreadsheet
CanvasGrid renders what you pass it as a fv (formatted value) of the CellData object.
Setting the Locale
If you are using useSpreadsheetState for state management of Spreadsheet, you can pass in a locale prop to configure date and number formatting for different regions.
Locale is auto-detected from Intl JavaScript object if not provided.
import { useSpreadsheetState } from "@rowsncolumns/spreadsheet-state"
const Spreadsheet = () => {
const { } = useSpreadsheetState({
locale: 'en-US'
})
}
export const App = () => {
<SpreadsheetProvider>
<Spreadsheet />
<SpreadsheetProvider>
}Switching Locale at Runtime
When users switch locales (e.g., from de-DE to en-US), all formatted values in the spreadsheet need to be regenerated to reflect the new locale's formatting rules.
The onChangeLocale function handles this automatically:
What Changes When Locale Switches
Decimal separator
Changes (e.g., . in en-US, , in de-DE)
Thousands separator
Changes (e.g., , in en-US, . in de-DE)
Currency symbol
Preserved (e.g., $ stays $, € stays €)
Currency position
Preserved (encoded in the number format pattern)
Numeric values
Preserved (only display formatting changes)
Date formats
Re-formatted according to locale conventions
Example: Number Formatting Across Locales
The same numeric value 1234567.89 displays differently based on locale:
en-US
1,234,567.89
de-DE
1.234.567,89
fr-FR
1 234 567,89
es-ES
1.234.567,89
pt-BR
1.234.567,89
Currency Formatting
When switching locales, currency symbols are preserved. Only the number formatting changes:
This matches the behavior of Google Sheets and Microsoft Excel.
Supported Locales
The spreadsheet supports any valid BCP 47 locale identifier. Common examples include:
European:
de-DE(German - Germany)fr-FR(French - France)es-ES(Spanish - Spain)it-IT(Italian - Italy)nl-NL(Dutch - Netherlands)pl-PL(Polish - Poland)pt-PT(Portuguese - Portugal)sv-SE(Swedish - Sweden)da-DK(Danish - Denmark)fi-FI(Finnish - Finland)nb-NO(Norwegian - Norway)
Americas:
en-US(English - United States)en-CA(English - Canada)fr-CA(French - Canada)es-MX(Spanish - Mexico)es-AR(Spanish - Argentina)pt-BR(Portuguese - Brazil)
Asia-Pacific:
ja-JP(Japanese - Japan)zh-CN(Chinese - China)ko-KR(Korean - Korea)hi-IN(Hindi - India)th-TH(Thai - Thailand)
Undo/Redo Support
Locale changes are recorded in the undo history. Users can undo a locale change to restore the previous formatted values.
Localising auto-generated names
Names that the spreadsheet generates on its own — new sheet titles ("Sheet1"), duplicated sheet titles ("Copy of Sheet1"), table titles ("Table 1"), pasted table titles ("Copy of Table 1") and generated table column names ("Column1") — can be localised with the generatedNames prop of useSpreadsheetState:
sheet
New sheets
Sheet{index}
sheetCopy
Duplicated sheets
Copy of {title}
table
New tables
Table {index}
tableCopy
Tables created by copy-paste
Copy of {title}
tableColumn
Table columns with no header value (create, insert, expand)
Column{index}
Every formatter is optional. Omitted formatters — or formatters returning undefined — fall back to the English defaults. Uniqueness is handled for you: if Столбец1 already exists, the next generated column becomes Столбец2, and duplicated sheet titles get a numeric suffix on collision.
Localising the UI
All built-in UI text is localised via component overrides: copy the default component's source (or write your own), translate the strings, and pass it as a prop. CanvasGrid accepts overrides for its embedded UI:
ContextMenu
Right-click context menu
CellEditor
Inline cell editor
FilterBox
Filter dropdown in table/filter headers
SelectionTitleComponent
Range title shown on named/table selections
PasteMenu
"Paste formatting / Split text to columns" menu after a paste
SuggestionAction
Agent suggestion approve/reject popover
HiddenRowMarkers
"Show row" markers for hidden rows
HiddenColumnMarkers
"Show column" markers for hidden columns
Other components such as SheetTabs, SheetSwitcher, Toolbar and FormulaBar are standalone — replace them with your own translated copies.
Last updated