DocsGuides

Guides

Localization/i18n Guide

How to customize localization and translations (i18n) in Shadcn Table

Shadcn Table has full support for localization (i18n). Some locales are included by default, but if your language is not yet supported, you can still easily add your own custom translations to the localization table option.

Example

Relevant Table Options

Prop NameTypeDescription
localizationST_Localization

Built-in Locales

English ships with the table. Every other locale is its own registry item, shadcn-table-locale-<code>, installed on the same base path as the table:

pnpm dlx shadcn@latest add https://www.shadcn-table.com/r/base/shadcn-table-locale-de.json

Import ST_Localization_DE from @/components/ui/shadcn-table/shared/locales/de and pass localization={ST_Localization_DE} to useShadcnTable.

With the @shadcn-table namespace registered (see Registry addresses), pnpm dlx shadcn@latest add @shadcn-table/shadcn-table-locale-<code> picks the path from the project's style. GitHub fallback: anindosarker/shadcn-table/shadcn-table-base-locale-<code> (Base UI), anindosarker/shadcn-table/shadcn-table-radix-locale-<code> (Radix UI) and anindosarker/shadcn-table/shadcn-table-aria-locale-<code> (React Aria).

If your language is not yet supported, please consider making a PR to add it to the library! See here on GitHub. Add the same file to every base, under registry/radix/, registry/base/ and registry/aria/.

Built-in Locale Examples

Scroll and find your language below to see an example of how to use it.

Storybook

Custom Non-Built-In Translations

If you want to use a language that is not included in the library, you can still easily add your own custom translations to the localization table option.

const table = useShadcnTable({
  columns,
  data,
  localization: {
    language: 'pt', // BCP 47 language tag for number formatting
    actions: 'Ações',
    and: 'e',
    cancel: 'Cancelar',
    changeFilterMode: 'Alterar o modo de filtro',
    changeSearchMode: 'Alterar o modo de pesquisa',
    clearFilter: 'Limpar filtros',
    clearSearch: 'Limpar pesquisa',
    clearSort: 'Limpar classificações',
    clickToCopy: 'Clique para copiar',
    // ... and many more - see link below for full list of translation keys
  },
});

return <ShadcnTable table={table} />;

Keys for the Toolbar and Column Menu

The strings of the filter chips, the sort editor, the view settings panel, the column menu items, the locked column cue and the scroll cues (for example addFilter, clearFilters, addSort, deleteSort, sortsCount, viewSettings, resetView, rowNumbers, pinToStart, pinToEnd, hideThisColumn, fixedPosition, scrollLeft, scrollRight) are optional keys of ST_Localization. They ship with English values only. Every other built-in locale leaves them out, and the table falls back to the English text for any key a locale does not set, so a full locale object such as ST_Localization_DE keeps working and you can add just the new keys you want to translate:

import { ST_Localization_DE } from '@/components/ui/shadcn-table/shared/locales/de';

const table = useShadcnTable({
  columns,
  data,
  localization: {
    ...ST_Localization_DE,
    addFilter: 'Filter',
    resetView: 'Ansicht zurücksetzen',
  },
});

Where the new chrome words a label differently from an older key, it uses a new key and the older one stays: sortAscending and sortDescending beside sortByColumnAsc and sortByColumnDesc, pinToStart and pinToEnd beside pinToLeft and pinToRight, hideThisColumn beside hideColumn. Placeholders use the {name} style, as in sortsCount: '{n} sorts' and columnsShown: '{n} shown'.

For a full list of all available translation keys, see here. Please note that each localization object should include a language property containing a valid BCP 47 language tag to ensure proper number formatting.

If you end up fully translating ST into another language that is not yet supported, please consider making a PR to add it to the library so that everyone can use it!

On this page