Home

Awesome

I18n-harmony

i18n-harmony i18n-harmony

Code Climate Test Coverage Build Status

Dependency Status devDependency Status

I18n library that's using ES2015 template string syntax (but with reduced functionality).

Minified: ~1.6KB (~870B gziped)

Also supports:

How to install

Dependencies: None

Works as a AMD (Require.js) module, CommonJS (node.js) module or as a global library.

Features

Global & local (per locale) variables

Nested translations

Plural support

Fallbacks

Post processing

Documentation

Methods

init(options)

Initializes the library. Options:

add(key, translation, [locale=activeLocale])

Add a translation to the locale

add(translations, [locale=activeLocale])

Add multiple translations to the locale. The first argument is a map of all the translations that should be added.

t(key, [options], [locale=activeLocale])

Get the interpolated string. Options is an object with local variables, and count parameter

has(key, [options], [includeDefault=false], [locale=activeLocale])

Check if the translation key exists in the active locale (if includeDefault is set as true, it will also check the default locale)

Properties

locale

Get or set the active locale

globals (read-only)

Get the globals object - object can be edited, but not replaced.

Changelog

1.6

1.5

1.4

1.3

1.2

1.1

1.0