Skip to content
This repository has been archived by the owner on Nov 2, 2018. It is now read-only.

Latest commit

 

History

History
40 lines (31 loc) · 722 Bytes

README.md

File metadata and controls

40 lines (31 loc) · 722 Bytes

acyort-i18n

Build Status

Based on i18n-node-2

Features

Add "zero" support

{
    'cat': {
        'zero': 'no cats',
        'one': 'one cat',
        'other': '%d cats'
    }
}

i18n.__n('cat', 0)  // 'no cats'
i18n.__n('cat', 1)  // 'one cat'
i18n.__n('cat', 8)  // '8 cats'

Usage

const i18n = {}
const directory = 'path/to/language.yml'
const ymal = require('yamljs')
const language = 'en'

new I18n({
  locales: [language],
  registered: i18n,
  directory,
  extension: '.yml',
  parse: data => yaml.parse(data.toString()),
})