track-i18n

0.0.4 • Public • Published

TrackI18n

Internationalization support for track.

Build Status

Installation

npm

npm install track-i18n

Usage

Define locale.

models.ja.js

module.exports = {
  models: {
    anime: {
      title:   'Title',
      creator: 'Creator',
    },
  },
};

YAML is useful, when define locale.

(Webpack and yaml-loader is very very very good)

models.ja.yml

views:
  index:
    hello:  'Welcome to yokoso japaripark!',
    serval: 'I am %{name} of serval cat.',
  show:
    title: 'The friends of %{type}.'

Translate

const I18n = require('track-i18n');

I18n.load(require('./models.ja'));
I18n.load(require('./views.ja'));

I18n.t('views.index.hello');                    // => 'Welcome to yokoso japaripark!'
I18n.t('views.index.serval', {name: 'serval'}); // => 'I am servel of serval cat.'

Readme

Keywords

none

Package Sidebar

Install

npm i track-i18n

Weekly Downloads

1

Version

0.0.4

License

ISC

Unpacked Size

9.01 kB

Total Files

7

Last publish

Collaborators

  • alfa-jpn