Skip to main content

Locales

Paginator.js has support for various different languages:

  • en_US (default)
  • es_LA
  • ja_JP
  • th_TH
  • zh_TW

Installing a Locale

Import your language file first:

import { jaJP } from '@carry0987/paginator/l10n';
note

All locales are combined into one file. There is a UMD format for web-browsers as well: e.g. @carry0987/paginator/l10n/dist/l10n.min.js: https://unpkg.com/@carry0987/paginator/l10n/dist/l10n.min.js

Then pass it to the language setting of your Paginator.js:

Live Editor
const paginator = new Paginator({
    columns: ['Name', 'Email', 'Title'],
    pageSize: 5,
    data: Array(200).fill().map(x => [
        faker.person.fullName(),
        faker.internet.email(),
        faker.person.jobTitle(),
    ]),
    language: jaJP
});
Result
Loading...

Also, you can easily customize Paginator.js messages and add your language. Simply extend the language config to replace the strings:

Live Editor
const paginator = new Paginator({
    columns: ['Name', 'Email', 'Title'],
    pageSize: 5,
    data: Array(200).fill().map(x => [
        faker.person.fullName(),
        faker.internet.email(),
        faker.person.jobTitle(),
    ]),
    language: {
        'pagination': {
            'previous': '⬅️',
            'next': '➡️'
        }
    }
});
Result
Loading...

Creating a Locale

Copy the en_US file, update the values and send a PR!