I'm using angular ui-grid not ng-grid. how can I to change the language english to spanish of the grid options.
The solution I found is to change the default language of the service i18nService on the controller or in a configuration file. as following:
Set default language on the controller
var app = angular.module('moduleName');
app.controller('testController', ['i18nService', function(i18nService){
//es is the language prefix you want
i18nService.setCurrentLang('es');
}]);
Set default language in a configuration file
var app = angular.module('moduleName');
app.config(function($provide){
$provide.decorator('GridOptions',['$delegate', 'i18nService', function($delegate, i18nService){
var gridOptions;
gridOptions = angular.copy($delegate);
gridOptions.initialize = function(options) {
var initOptions;
initOptions = $delegate.initialize(options);
return initOptions;
};
//es is the language prefix you want
i18nService.setCurrentLang('es');
return gridOptions;
}]);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With