SpreadsheetGrid
Guides

English and text

Make the grid's texts English or change some of them with localeText (bars, menus, filters, tool panel, find, accessible names, validation messages)

Every text the grid shows by itself comes from localeText. The default is Japanese. For English, pass localeTextEn from the entry @ishibashi0112/spreadsheet-grid/locales/en (@ishibashi0112/spreadsheet-grid-solid/locales/en for the Solid version). The English texts are a separate entry, so they aren't in the JS of apps that stay in Japanese.

Demo (switching Japanese / English)

Rows 200 of 200Columns 5 of 5Sort: Unit price (descending)
#
Part no.
1
P-1018
2
P-1108
3
P-1198
4
P-1035
5
P-1125
6
P-1052
7
P-1142
8
P-1069
9
P-1159
10
P-1086
11
P-1176
12
P-1013
13
P-1103
14
P-1193
15
P-1030
16
P-1120
17
P-1047
18
P-1137
19
P-1064
20
P-1154
21
P-1081
Total
Count200
Rows 200 of 200Columns 5 of 5
Cell —Range —0 cells / 0 rows0 columns
  • The switch above changes the top and bottom bars, the column menu (⋮ on a header), column filters, the tool panel, find in cells (Ctrl/Cmd+F), the total row, selection aggregates (select 2 or more cells) and the quantity validation message (hover a marked cell).
  • Column headers and values are your data, so the demo prepares them per language. The grid doesn't translate them.

Usage

import { SpreadsheetGrid } from '@ishibashi0112/spreadsheet-grid';
import { localeTextEn } from '@ishibashi0112/spreadsheet-grid/locales/en';

<SpreadsheetGrid rows={rows} columns={columns} localeText={localeTextEn} />

To change only some, pass only the keys you want to change. Keys you don't pass stay at the default (Japanese). To change part of the English, layer over localeTextEn.

// stay in Japanese, change only the text shown when there are no rows
<SpreadsheetGrid localeText={{ noRows: 'データがありません' }} … />

// English, changing only how the row count is phrased
<SpreadsheetGrid localeText={{ ...localeTextEn, rowCount: 'Showing {shown} of {total}' }} … />

Next.js (App Router)

React onlyThis is about Next.js server components. SSR in the Solid version renders the same component on the server and in the browser, so you can pass localeTextEn as is (SSR).

localeTextEn contains functions (phrasing that changes with numbers), so it can't be passed as props from server components (opening the page gives a 500, and static pages stop the build; type checks pass, so you won't notice when writing it). Import it in the 'use client' file that draws the grid, and pass only the language from the server.

// app/orders/orders-grid.tsx
'use client';
import { SpreadsheetGrid } from '@ishibashi0112/spreadsheet-grid';
import { localeTextEn } from '@ishibashi0112/spreadsheet-grid/locales/en';

export function OrdersGrid({ lang, rows }: { lang: 'ja' | 'en'; rows: Order[] }) {
  return <SpreadsheetGrid rows={rows} columns={columns} localeText={lang === 'en' ? localeTextEn : undefined} />;
}

// app/orders/page.tsx (server component)
<OrdersGrid lang="en" rows={rows} />

How texts are written

  • In strings, {name} parts are replaced with values ({shown} / {total} in rowCount and so on; the names you can use are written in the descriptions in the key list).
  • For languages whose phrasing changes with numbers, a value can be a function too. The function receives values and returns a string. Build tables containing functions outside the component, or wrap them in useMemo (functions are compared by reference, so creating a new function on every render redraws every part that uses texts each time). In the Solid version the component body runs only once, so building it in the body is fine.
// build once outside the component
const localeText = {
  ...localeTextEn,
  filterColumns: ({ count }: { count: number }) => (count === 1 ? '1 column' : `${count} columns`),
};
  • Weekdays (calendarWeekdays; 7 starting from Sunday) and months (calendarMonths; 12 starting from January) are arrays.
  • Writing localeText={{ … }} inline doesn't rebuild anything while the contents (strings, arrays, function references) are the same.
  • When you place another grid inside a detail row card and so on, pass localeText to that grid too (it doesn't inherit the outer grid's texts).

What changes and what doesn't

What changes:

  • The top and bottom bars (counts, filter / sort summaries, the cell address, selection aggregates), filter chips
  • The column menu, column filters (condition names, the date calendar, option lists), the tool panel, find in cells, the fill handle button
  • Group rows, the total row label, the text shown when there are no rows, serverSide loading / failure bars
  • Accessible names (aria-label and so on) and tooltips, and messages of built-in validation (number min / max / integer)

What doesn't:

  • Text you pass, such as column headers and values, and the output of valueFormatter / renderCell
  • How dates are written (yyyy/mm/dd) and how numbers are written (no separators in count numbers and so on)
  • Development console warnings. They are 2 lines, Japanese and English, regardless of language (not shown in production)

Props that pass texts (noRowsText / noMatchingRowsText / globalFilterPlaceholder / totalRow.label) win when given. When the fill handle continues weekdays or months, English weekdays / months (Mon / January and so on) continue just like Japanese.

AI bar (Filter with words)

For GridAskBar / useGridAsk of Filter with words (createGridAsk in the Solid version), pass gridAskLocaleTextEn from the same entry to localeText.

import { gridAskLocaleTextEn, localeTextEn } from '@ishibashi0112/spreadsheet-grid/locales/en';

<GridAskBar grid={gridRef} columns={columns} ask={ask} localeText={gridAskLocaleTextEn} />
<SpreadsheetGrid ref={gridRef} columns={columns} rows={rows} localeText={localeTextEn} />

Key list

The list of keys with their default (Japanese) and English values is in the API reference.

If you maintain a table for another language yourself, check the keys added in the changelog when you upgrade. Keys you haven't added show the default (Japanese) (1.0.2 added enterDate / filterExcludedValues / the AI bar's sortUnreadable; only for filterExcludedValues, if you translated filterExcluded, that count text is used).

From core (@ishibashi0112/spreadsheet-grid-core) too, you can read the default tables (DEFAULT_GRID_LOCALE_TEXT and so on) and the English tables (localeTextEn / gridAskLocaleTextEn).

On this page