Skip to content

Latest commit

 

History

History
executable file
·
26 lines (17 loc) · 1.07 KB

README.md

File metadata and controls

executable file
·
26 lines (17 loc) · 1.07 KB

knockout-i18n

A simple internationalization module for KnockoutJs, check out the live demo for simple workings.

API

ko.i18n.locale

The current locale string, or array of strings as locale chain fall back. This module read this observable to resolve a bundle for translations.

ko.i18n.setBundle(locale, bundle)

Assigns a bundle object of key-value translation under target locale.

  • locale {string|array} Target locale string(s)
  • bundle {Object} An object for direct key-value translation.

ko.i18n.setBundles(bundles)

Assigns multiple bundles to multiple locale, act as a multiple version of ko.i18n.setBundle(locale, bundle).

  • bundles {Object} An object with keys as locale, and values be designated bundle.

Bindings

i18n: key

  • key {string} Resolves a translation using current ko.i18n.locale.

i18n-options: substitudes

  • substitudes {array} Array of values to be subtitudes using mustache syntax inside the bundle translation, see example.html for example usage.