Skip to main content

Localization

Every string the grid writes on its own — visible text, aria-labels, tooltips, placeholders, menu items, filter operators, screen-reader announcements, keyboard shortcut labels and default column headers — is one key of GridLocaleText. Translate them with a localeText map, or in code with getLocaleText.

Translating with localeText​

import { createGrid, type GridLocaleText } from "@agility-workbench/grid";

const de: Partial<GridLocaleText> = {
rowsPerPage: "Zeilen pro Seite",
page: "Seite",
pageOfTotalOption: "{page} von {total}",
sortAscending: "Aufsteigend sortieren",
sortDescending: "Absteigend sortieren",
selectAll: "(Alle auswählen)",
blanks: "(Leer)",
rowsSelectedOne: "{count} Zeile ausgewählt",
rowsSelectedOther: "{count} Zeilen ausgewählt",
};

createGrid(host, { columnDefs, rowData, pagination: true, localeText: de });
<Grid columnDefs={columnDefs} data={rows} localeText={de} />
<awb-grid [columnDefs]="columnDefs" [rowData]="rows" [localeText]="de" />

The map is partial: a key you leave out keeps its English default. The keys are typed, so a misspelt key is a compile error.

  • Placeholders. Strings with variables carry {name} placeholders ("Page {page} of {total}"). Keep the names; move them wherever the sentence needs them.
  • Plurals. A count-dependent string has two keys, …One and …Other (rowsSelectedOne / rowsSelectedOther). The grid picks …One when the count is exactly 1. That is enough for any language with one singular and one plural form.
  • Dedicated options win. loadingMessage, noRowsMessage, pivotNoValuesMessage, pivotEmptyMessage, paginationUnknownTotalTooltip, filterParams.miniFilterPlaceholder, paginationControls.aggregateScope.unavailableMessage, groupTotalRowLabel and a column's own label override the matching keys (loading, noRows, …).

Translating in code with getLocaleText​

getLocaleText is called for every string. It receives the key, the text the grid would otherwise use (your localeText entry or the English default, with its placeholders still in) and the placeholder values. Whatever it returns is interpolated afterwards, and it wins over localeText.

Use it for plural rules with more than two forms, ICU messages, or a translation library:

const plural = new Intl.PluralRules("pl");
const rowsSelected = {
one: "{count} wiersz zaznaczony",
few: "{count} wiersze zaznaczone",
many: "{count} wierszy zaznaczonych",
other: "{count} wiersza zaznaczonego",
};

createGrid(host, {
columnDefs,
rowData,
localeText: pl, // the plain strings
getLocaleText: ({ key, defaultValue, variableValues }) => {
if (key === "rowsSelectedOne" || key === "rowsSelectedOther") {
return rowsSelected[plural.select(Number(variableValues?.count))];
}
return defaultValue;
},
});

With a library such as i18next, map the grid's keys into a namespace and fall back to the default:

getLocaleText: ({ key, defaultValue, variableValues }) =>
i18next.t(`grid.${key}`, { defaultValue, ...variableValues }),

The resolver applies {placeholder} interpolation after the callback, so the callback may return text with placeholders still in it or fully formatted text.

Reusing the grid's strings in your own components​

api.getLocaleText(key, variableValues?) resolves a key exactly as the grid does, so a custom header component, cell renderer or menu item can say "Sort Ascending" in the grid's language:

const api = createGrid(host, {
columnDefs: [
{
key: "region",
label: "Region",
columnMenu: ({ items }) => [
...items,
{ id: "csv", label: api.getLocaleText("exportAsCsv"), onClick: () => api.exportDataAsCsv() },
],
},
],
rowData,
localeText: de,
});

class MyHeader {
init(params) {
this.eGui.title = params.api.getLocaleText("shortcutSortColumn");
}
}

For a …One / …Other pair, pick the key from the count and pass { count }.

Switching language​

localeText and getLocaleText are creation-only: the grid reads them once. To switch language, create the grid again — in React, change the key of <Grid>; in Angular, re-render <awb-grid> (for example inside an @if or @for keyed by the locale); with createGrid, destroy() and create it again. The bindings warn in development if either changes on a mounted grid.

Numbers and dates​

Formatting is separate from translation. Number, currency and date cells follow the column's formatterOptions — locale (default "en-US"), currency, format and the number options — and the set filter's tree layout names its months in that locale too:

{ key: "amount", type: ColumnType.CURRENCY, formatterOptions: { locale: "de-DE", currency: "EUR" } }

What stays as written​

  • Text your application supplies — column labels, menu items, filterOptions labels, cell values and formatted values.
  • Messages for developers: console warnings and the errors passed to onError.
  • Keyboard key names in menu accelerators and the shortcut table (Ctrl+C, Esc), which follow the platform's convention.
  • Export file names (grid-all.csv) and the Excel sheet name (Export).
  • The blank-value group key (Blanks) used by row grouping and pivot column headers, which is also the group's identity; the set filter's (Blanks) row is translatable (blanks).

All keys​

KeyEnglish default
loadingLoading data...
noRowsNo rows to show
pivotNoValuesChoose Aggregate on a column to add values
pivotEmptyAdd row groups, column labels or values to build the pivot
hierarchyNavigationModeHierarchy navigation mode
gridNavigationModeGrid navigation mode
noRowsMatchSearchNo rows match "{text}"
noRowsMatchFiltersNo rows match the current filters
findNoMatchesNo matches
findMatchOfTotalMatch {index} of {total}
rowsPerPageRows per page
pagePage
firstPageFirst page
previousPagePrevious page
nextPageNext page
lastPageLast page
pageOfTotalOption{page} of {total}
pageCountUnknown{count}+
pageOfTotalPage {page} of {total}
pageOfAtLeastTotalPage {page} of at least {total}
pageOfAtLeastTotalWithHintPage {page} of at least {total}. {hint}
paginationUnknownTotalMore rows may exist on the server; the total updates as they load
aggregateAggregate
aggregateScopeNoneNone
aggregateScopeCurrentPageCurrent page
aggregateScopeEntireDatasetEntire dataset
hideAggregateRowHide aggregate row
moreFooterControlsMore footer controls
moreFooterControlsAggregationOnMore footer controls (aggregation on)
newPivotSheetNew pivot sheet
aggregateScopeEntireDatasetUnavailableEntire-dataset totals need a server aggregation source: the data source's getAggregates, or serverSideAggregationSource.
aggAvgShortAvg
changeAggregationChange {column} aggregation. Current function: {aggregate}
changeAggregationTooltip{aggregate} — change aggregation function
grandTotalGrand Total
groupTotalTotal {group}
pivotTotalTotal
aggCountCount
aggDistinctCountDistinct Count
aggSumSum
aggAvgAverage
aggMinMin
aggMaxMax
aggMedianMedian
aggFirstFirst
aggLastLast
viewsViews
savedViewsSaved views
savedViewNamedSaved view: {name}
noSavedViewsNo saved views
saveCurrentViewMenuSave current view…
updateViewUpdate “{name}”
renameViewMenuRename “{name}”…
deleteViewMenuDelete “{name}”…
saveCurrentViewSave current view
renameViewRename view
viewNameView name
deleteViewConfirmDelete “{name}”?
deleteViewMessageThis removes the view from the application-owned list.
viewNamedView: {name}
exportTableExport table
exportExport
exportSelectionSelection
exportEntireTableEntire table
exportCsvCSV
exportExcelExcel
exportTableAsCsvTable as CSV
exportTableAsExcelTable as Excel
togglePivotModeToggle pivot mode
pivotPivot
pivotModePivot mode
pivotModeOnPivot mode on
pivotModeOffPivot mode off
moreToolbarActionsMore toolbar actions
moreToolbarActionsActiveMore toolbar actions (active)
moreActionsMore actions
searchSearch
searchHighlightingSearch — highlighting “{term}”
searchFilteringSearch — filtering by “{term}”
columnsEllipsisColumns…
groupedByGrouped by
sortBySort by
groupedByCountGrouped by ({count})…
sortByCountSort by ({count})…
sectionSummary{caption} {count}
sectionSummaryEditorOne{caption} {count} column — open the editor
sectionSummaryEditorOther{caption} {count} columns — open the editor
sectionSummaryEditorEmpty{caption} — open the editor
moreGroupingLevelsOne{count} more grouping levels — open the grouping editor
moreGroupingLevelsOther{count} more grouping levels — open the grouping editor
moreSortColumnsOne{count} more sort columns — open the sort editor
moreSortColumnsOther{count} more sort columns — open the sort editor
rowGroupingRow grouping
columnSortingColumn sorting
rowGroupingOrderRow grouping order
columnSortPriorityColumn sort priority
addGroupAdd group
addSortAdd sort
addGroupEditor+ Add group
addSortEditor+ Add sort
clearRowGroupingClear row grouping
clearGroupingClear grouping
clearAllSortingClear all sorting
clearSortingClear sorting
reorderHintHorizontalUse Left and Right arrows to reorder.
reorderHintVerticalUse Up and Down arrows to reorder.
groupChip{column}, grouping level {index} of {total}. {hint}
sortChipAscending{column}, sort priority {index} of {total}, ascending. {hint}
sortChipDescending{column}, sort priority {index} of {total}, descending. {hint}
removeFromRowGroupingRemove {column} from row grouping
removeFromSortingRemove {column} from sorting
sortDirectionFixedAscending{column} sort direction is fixed to ascending
sortDirectionFixedDescending{column} sort direction is fixed to descending
sortColumnAscendingSort {column} ascending
sortColumnDescendingSort {column} descending
cancelCancel
saveSave
deleteDelete
columnsColumns
columnManagementColumn management
pivotSetupPivot setup
openColumnPanelOpen column panel
closeColumnPanelClose column panel
searchColumnsSearch columns
searchColumnsPlaceholderSearch columns…
allColumnsAll columns
allMatchingColumnsAll matching columns
modifiedModified
resetLayoutReset layout
columnLayoutResetColumn layout reset
pinnedLeftPinned left
pinnedRightPinned right
noColumnsNo columns
noMatchingColumnsNo matching columns
columnsHiddenOne{count} column hidden
columnsHiddenOther{count} columns hidden
columnsShownOne{count} column shown
columnsShownOther{count} columns shown
matchingColumnsHiddenOne{count} matching column hidden
matchingColumnsHiddenOther{count} matching columns hidden
matchingColumnsShownOne{count} matching column shown
matchingColumnsShownOther{count} matching columns shown
expandColumnGroupExpand {group}
collapseColumnGroupCollapse {group}
showColumnShow {column}
hideColumnHide {column}
columnHidden{column} hidden
columnShown{column} shown
pinColumnPin {column}
unpinnedUnpinned
pinLeftOptionPin left
pinRightOptionPin right
columnPinnedLeft{column} pinned left
columnPinnedRight{column} pinned right
columnUnpinned{column} unpinned
moveItemUpMove {item} up
moveItemDownMove {item} down
movedToPosition{item} moved to position {position} of {total}
groupRoleGroup
groupRoleNumberedGroup {index}
pivotRolePivot
pivotRoleNumberedPivot {index}
removeFromRowGroupsRemove {column} from row groups
removeFromPivotColumnsRemove {column} from pivot columns
removeAggregateFromColumnRemove {aggregate} aggregate from {column}
removedFromRowGroups{column} removed from row groups
removedFromPivotColumns{column} removed from pivot columns
aggregateChangedTo{column} aggregate changed to {aggregate}
aggregateRemovedFrom{aggregate} aggregate removed from {column}
rowGroupsWellRow groups
columnLabelsWellColumn labels
valuesWellValues
addRowGroupAdd row group
addPivotColumnAdd pivot column
addValueAdd value
valueEntry{column} — {aggregate}
wellEmptyNone
wellOrder{well} order
removeFromWellRemove {item} from {well}
movedToPositionInWell{item} moved to position {position} of {total} in {well}
noColumnsToAddNo columns available to add
aggregateFunctionForAggregate function for {column}
dropToSectionEndDrop here to move branch to section end
searchPlaceholderSearch…
findPlaceholderFind…
searchAllColumnsSearch all columns
findInAllColumnsFind in all columns
clearSearchClear search
searchOptionsSearch options
closeSearchClose search
closeSearchHintClose (Esc)
previousMatchPrevious match
nextMatchNext match
previousMatchHintPrevious match (Shift+Enter)
nextMatchHintNext match (Enter)
findMatchesOne{count} match
findMatchesOther{count} matches
findUnavailableServerSideHighlighting matches is not available when rows load from the server
findUnavailablePivotHighlighting matches is not available while the grid is pivoted
matchModeLabelMatch
matchAllWordsAll words
matchExactPhraseExact phrase
matchWholeCellWhole cell
matchCaseMatch case
behaviorFilterRowsFilter rows
behaviorHighlightMatchesHighlight matches
anchorLabelAnchor
anchorRightRight
anchorLeftLeft
keepFilterWhenClosedKeep filter when closed
activeSearchPillActive search — click to edit
sheetsSheets
addPivotSheetAdd pivot sheet
pivotSheetsUnsupportedPivot sheets need the client-side row model without tree data
dataSheetNameData
pivotSheetNamePivot {index}
sheetCopyName{name} (copy)
renameSheetRename sheet {name}
renameRename
changeColorChange color
duplicateDuplicate
sheetColorNoneNone
sheetColorCustomCustom…
lastSheetCannotBeDeletedThe last sheet cannot be deleted
sheetActionsSheet actions
sheetColorRedRed
sheetColorOrangeOrange
sheetColorAmberAmber
sheetColorLimeLime
sheetColorGreenGreen
sheetColorTealTeal
sheetColorCyanCyan
sheetColorBlueBlue
sheetColorIndigoIndigo
sheetColorVioletViolet
sheetColorPinkPink
sheetColorGrayGray
sortAscendingSort Ascending
sortDescendingSort Descending
clearSortClear Sort
clearSortsClear Sorts
hideColumnMenuHide Column
hideColumnsMenuHide Columns
pinColumnMenuPin Column
pinColumnsMenuPin Columns
pinLeftPin Left
pinRightPin Right
unpinColumnUnpin Column
unpinColumnsUnpin Columns
manageColumnsManage columns…
clearSelectionClear Selection
columnsCount{count} columns
showSparklinesShow Sparklines
barSparklinesBar Sparklines
lineSparklinesLine Sparklines
areaSparklinesArea Sparklines
aggregateNumericAggregate (numeric)
aggregateStringAggregate (string)
clearAggregationClear Aggregation
clearAggregationsClear Aggregations
exportAsCsvExport as CSV
exportAsExcelExport as Excel
ungroupUngroup
ungroupAllUngroup All
groupingGrouping
groupByColumnGroup by Column
groupByColumnsGroup by Columns
replaceExistingGroupingReplace Existing Grouping
addToExistingGroupingAdd to Existing Grouping
removeColumnFromGroupingRemove Column from Grouping
removeColumnsFromGroupingRemove Columns from Grouping
clearAllGroupingClear All Grouping
pivotOnColumnPivot on Column
pivotOnColumnsPivot on Columns
replaceExistingPivotReplace Existing Pivot
addToExistingPivotAdd to Existing Pivot
removeColumnFromPivotRemove Column from Pivot
removeColumnsFromPivotRemove Columns from Pivot
exitPivotModeExit Pivot Mode
cutCut
copyCopy
copyWithHeadersCopy with Headers
pastePaste
fillDownFill down
fillRightFill right
fillAsCopyInsteadCopy cells instead
fillAsSeriesInsteadFill series instead
exportWithRowGroupsExport with row groups
exportLeafRowsExport leaf rows
exportGroupHeadingNotInRangeThe group heading column is not part of the selected range.
insertInsert
insertRowAbove1 row above
insertRowBelow1 row below
pinRowPin row
pinRowsPin rows
unpinRowUnpin row
unpinRowsUnpin rows
pinToTopPin to top
pinToBottomPin to bottom
menuMenu
submenuSubmenu
cellMenuCell menu
columnMenuColumn menu
columnMenuMultipleColumn menu, {count} columns
rowNumberRow number
selectAllRowsSelect all rows
deselectAllRowsDeselect all rows
groupColumnGroup
hierarchyColumnHierarchy
sparklineColumnSparkline
filterEqualEqual
filterNotEqualNot equal
filterGreaterThanGreater than
filterGreaterThanOrEqualGreater than or equal
filterLessThanLess than
filterLessThanOrEqualLess than or equal
filterBetweenBetween
filterNotBetweenNot between
filterContainsContains
filterExcludesExcludes
filterStartsWithStarts with
filterEndsWithEnds with
filterIsBlankIs blank
filterIsNotBlankIs not blank
filterNotInNot in
filterDialogFilter {column}
filterJoinAndAND
filterJoinOrOR
filterValueFilter value
filterAnyAny
filterTrueTrue
filterFalseFalse
clearFilterValueClear
filterApplyapply
filterCancelcancel
filterClearclear
filterResetreset
selectAll(Select All)
blanks(Blanks)
selectAllValuesSelect all values
includeBlankValuesInclude blank values
filterValuesFilter values
setFilterSearchPlaceholderType to filter values
setFilterSearchPlaceholderWithExampleType to filter values, e.g. {example}
setFilterLoadingLoading data…
setFilterLoadErrorError loading values
setFilterLoadFailedFailed to load values
setFilterRowCountUnitOnerow
setFilterRowCountUnitOtherrows
filledCellsOneFilled {count} cell
filledCellsOtherFilled {count} cells
filledCellsAsCopiesOneFilled {count} cell as copies
filledCellsAsCopiesOtherFilled {count} cells as copies
filledCellsAsSeriesOneFilled {count} cell as a series
filledCellsAsSeriesOtherFilled {count} cells as a series
fillNothingNoEditableCellsNothing to fill: no editable cells
fillNothingNoAdjacentDataNothing to fill: no data beside the selection
rowsSelectedOne{count} row selected
rowsSelectedOther{count} rows selected
columnsSelectedOne{count} column selected
columnsSelectedOther{count} columns selected
rangeSelected{rows} by {columns} selected
rangeRowsOne{count} row
rangeRowsOther{count} rows
rangeColumnsOne{count} column
rangeColumnsOther{count} columns
selectionClearedSelection cleared
sortingClearedSorting cleared
sortedBySorted by {columns}
sortedBySeparator, then
sortedColumnAscending{column} ascending
sortedColumnDescending{column} descending
loadingAnnouncementLoading data
rowsLoadedOne{count} row loaded
rowsLoadedOther{count} rows loaded
selectEditorLoadingLoading…
ratingValue{value} of {max}
shortcutQuickFilterQuick filter
shortcutNextSheetNext sheet
shortcutPreviousSheetPrevious sheet
shortcutOpenColumnMenuOpen column menu
shortcutOpenColumnFilterOpen column filter
shortcutExtendColumnSelectionLeftExtend the column selection left
shortcutExtendColumnSelectionRightExtend the column selection right
shortcutExtendColumnSelectionFirstExtend the column selection to the first column
shortcutExtendColumnSelectionLastExtend the column selection to the last column
shortcutFirstColumnFirst column
shortcutLastColumnLast column
shortcutPreviousColumnPrevious column
shortcutNextColumnNext column
shortcutEnterRowsEnter the rows
shortcutSelectColumnSelect column
shortcutSortColumnSort column
shortcutSwitchTreeNavigationModeSwitch tree navigation mode
shortcutTreeNavigationTree navigation
shortcutToggleRowSelectionToggle row selection
shortcutSelectRowSelect row
shortcutOpenActionFrameOpen the cell's action frame
shortcutEditCellEdit cell
shortcutSelectAllCellsSelect all cells
shortcutCopyCopy
shortcutCutCut
shortcutPastePaste
shortcutFillDownFill down
shortcutFillRightFill right
shortcutUndoUndo
shortcutRedoRedo
shortcutClearCellsClear cell contents
shortcutMoveToHeaderMove to the column header
shortcutTypeToEditStart editing by typing
shortcutMoveUpMove up
shortcutMoveDownMove down
shortcutMoveLeftMove left
shortcutMoveRightMove right