How to change the language of buttons from Grid?

I need to change the buttons from 'Add', 'Delete' to 'Agregar', and 'Eliminar', that is English to Spanish.


How do I make it?


1 Reply 1 reply marked as answer

NS Nithya Sivaprakasam Syncfusion Team August 4, 2022 01:58 PM UTC

Hi Luis,


Greetings from Syncfusion support.


Query:” How to change the language of buttons from Grid?


You can customize the default Grid text by using the ‘grid.locale’ property and translation object of the Localization library. Find the below code example and sample for more information.


Index.js

 

ej.base.enableRipple(true);

ej.base.L10n.load({

  es: {

    grid: {

       …..……

      Add: 'Añadir',

      Edit: 'Editar',

      Cancel: 'Cancelar',

      Update: 'Actualizar',

      Delete: 'Eliminar',

      ………….

    },

  },

});

var grid = new ej.grids.Grid({

  dataSource: window.orderDatas,

  allowPaging: true,

  allowEditing: true,

  editSettings: {

    allowEditing: true,

    allowAdding: true,

    allowDeleting: true,

    mode: 'Normal',

  },

  locale: 'es',

  toolbar: ['Add', 'Edit', 'Delete', 'Update', 'Cancel'],

  columns: [

    {

      field: 'OrderID',

      isPrimaryKey: true,

      headerText: 'Order ID',

      textAlign: 'Right',

      validationRules: { required: true, number: true },

      width: 140,

    },

    {

      field: 'CustomerID',

      headerText: 'Customer ID',

      validationRules: { required: true },

      width: 140,

    },

    {

      field: 'Freight',

      headerText: 'Freight',

      textAlign: 'Right',

      editType: 'numericedit',

      width: 140,

      format: 'C2',

      validationRules: { required: true },

    },

    {

      field: 'OrderDate',

      headerText: 'Order Date',

      editType: 'datetimepickeredit',

      format: { type: 'dateTime', format: 'M/d/y hh:mm a' },

      width: 160,

    },

    {

      field: 'ShipCountry',

      headerText: 'Ship Country',

      editType: 'dropdownedit',

      width: 150,

      edit: { params: { popupHeight: '300px' } },

    },

  ],

});

grid.appendTo('#Grid');


Kindly check the below documentation and sample.


Sample: https://stackblitz.com/edit/gbhrnn-5d96hq?file=index.js


Documentation: https://ej2.syncfusion.com/javascript/documentation/grid/global-local/


A list of locale texts for different cultures which can be loaded for the EJ2 controls can be checked in the below link,


Locale texts: https://github.com/syncfusion/ej2-locale/tree/master/src  


Please get back to us if you need further assistance on this.


Regards,

Nithya Sivaprakasam.


If this post is helpful, please consider accepting it as the solution so that other members can locate it more quickly.


Marked as answer
Loader.
Up arrow icon