Internationalisation
You can change the text in the paging panels and the default filters by providing a localeText or
a localeTextFunc to the gridOptions.
Using localeText
The example below shows all the text that can be defined.
localeText = {
// for filter panel
page: 'daPage',
more: 'daMore',
to: 'daTo',
of: 'daOf',
next: 'daNexten',
last: 'daLasten',
first: 'daFirsten',
previous: 'daPreviousen',
loadingOoo: 'daLoading...',
// for set filter
selectAll: 'daSelect Allen',
searchOoo: 'daSearch...',
blanks: 'daBlanc',
// for number filter and text filter
filterOoo: 'daFilter...',
applyFilter: 'daApplyFilter...',
equals: 'daEquals',
notEquals: 'daNotEqual',
// for number filter
lessThan: 'daLessThan',
greaterThan: 'daGreaterThan',
lessThanOrEqual: 'daLessThanOrEqual',
greaterThanOrEqual: 'daGreaterThanOrEqual',
inRange: 'daInRange',
// for text filter
contains: 'daContains',
notContains: 'daNotContains',
startsWith: 'daStarts dawith',
endsWith: 'daEnds dawith',
// the header of the default group column
group: 'laGroup',
// tool panel
columns: 'laColumns',
filters: 'laFilters',
rowGroupColumns: 'laPivot Cols',
rowGroupColumnsEmptyMessage: 'la drag cols to group',
valueColumns: 'laValue Cols',
pivotMode: 'laPivot-Mode',
groups: 'laGroups',
values: 'laValues',
pivots: 'laPivots',
valueColumnsEmptyMessage: 'la drag cols to aggregate',
pivotColumnsEmptyMessage: 'la drag here to pivot',
toolPanelButton: 'la tool panel',
// other
noRowsToShow: 'la no rows',
// enterprise menu
pinColumn: 'laPin Column',
valueAggregation: 'laValue Agg',
autosizeThiscolumn: 'laAutosize Diz',
autosizeAllColumns: 'laAutsoie em All',
groupBy: 'laGroup by',
ungroupBy: 'laUnGroup by',
resetColumns: 'laReset Those Cols',
expandAll: 'laOpen-em-up',
collapseAll: 'laClose-em-up',
toolPanel: 'laTool Panelo',
export: 'laExporto',
csvExport: 'la CSV Exportp',
excelExport: 'la Excel Exporto',
// enterprise menu pinning
pinLeft: 'laPin <<',
pinRight: 'laPin >>',
noPin: 'laDontPin <>',
// enterprise menu aggregation and status bar
sum: 'laSum',
min: 'laMin',
max: 'laMax',
none: 'laNone',
count: 'laCount',
average: 'laAverage',
// standard menu
copy: 'laCopy',
copyWithHeaders: 'laCopy Wit hHeaders',
ctrlC: 'ctrl n C',
paste: 'laPaste',
ctrlV: 'ctrl n V'
}
Using localeTextFunc
The example above works great if all you are translating is ag-Grid. However what if you want
to bind into your wider applications internationalisation? That can be done by providing your
own localeTextFunc, which is an alternative to the above.
The sample code below shows how such a function can used. The function takes the key from the grid
and uses a translate function outside of the grid for doing the translation. If no match is found,
then the default value should be returned (which is the English value for the grid, the grids
default language).
var gridOptions = {
localeTextFunc: function(key, defaultValue) {
// to avoid key clash with external keys, we add 'grid' to the start of each key.
var gridKey = 'grid.' + key;
// look the value up. here we use the AngularJS 1.x $filter service, however you can use whatever
// service you want, AngularJS 1.x or otherwise.
var value = $filter('translate')(gridKey);
return value === gridKey ? defaultValue : value;
}
...
};