Giter Site home page Giter Site logo

zinggrid / zinggrid-custom-language Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 14 KB

A ZingGrid example showing the default `en.js` language file and how to use the internationalization feature by adding a custom language to your grid with a lang.js file.

Home Page: https://www.zinggrid.com/docs/features/internationalization

JavaScript 100.00%

zinggrid-custom-language's Introduction

Locale Files

A ZingGrid example showing how to use the internationalization feature by adding a custom language to your grid with a lang.js file.

We have two default files available in the library:

  1. en.js
  2. es.js

Defining A Custom Locale

You can define a custom locale two ways. First you can use es6 exports to define the object.

export default {
  lang: 'es',
  columntypes: {
    editor: 'Editar',
    remover: 'Eliminar',
    selector: 'Seleccionar',
  },
  context: {
    copyCell: 'Copiar Celda',
    pasteCell: 'Pegar Celda',
    insertRecordLabel: 'Añadir Registro Nuevo',
    insertRecordHere: 'Aqui',
    insertRecordEnd: 'Al Final',
    insertRecordStart: 'Al Principio',
    deleteRow: 'Eliminar Fila',
    sortColumn: 'Ordenar Columna',
    editCell: 'Editar Celda',
    editRow: 'Editar Fila',
    selectCell: 'Seleccionar Celda',
    selectRow: 'Seleccionar Fila',
    deselect: 'Deseleccionar',
    previousPage: 'Regresar a la página anterior',
    nextPage: 'Ir a la página siguiente',
    firstPage: 'Regresar a la primera página',
    lastPage: 'Ir a la página final',
    version: 'Sobre ZingGrid',
    save: 'Guardar',
    cancel: 'Cancelar',
  }...
}

Second you can define the locale with a variable

var esLocale = {
  lang: 'es',
  columntypes: {
    editor: 'Editar',
    remover: 'Eliminar',
    selector: 'Seleccionar',
  },
  context: {
    copyCell: 'Copiar Celda',
    pasteCell: 'Pegar Celda',
    insertRecordLabel: 'Añadir Registro Nuevo',
    insertRecordHere: 'Aqui',
    insertRecordEnd: 'Al Final',
    insertRecordStart: 'Al Principio',
    deleteRow: 'Eliminar Fila',
    sortColumn: 'Ordenar Columna',
    editCell: 'Editar Celda',
    editRow: 'Editar Fila',
    selectCell: 'Seleccionar Celda',
    selectRow: 'Seleccionar Fila',
    deselect: 'Deseleccionar',
    previousPage: 'Regresar a la página anterior',
    nextPage: 'Ir a la página siguiente',
    firstPage: 'Regresar a la primera página',
    lastPage: 'Ir a la página final',
    version: 'Sobre ZingGrid',
    save: 'Guardar',
    cancel: 'Cancelar',
  },
}

Registering a Locale File

You will use the ZingGrid.registerLanguage(obj, 'custom') method to set the appropriate language. This will register the langauge globally to the page.

To instantiate the language you still have to define the language on the html, zing-grid or zg-column tag(s).

zinggrid-custom-language's People

Contributors

damntrecky avatar jeanettephung avatar

Watchers

Thomas A Powell avatar James Cloos avatar dspint avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.