riot-i18n
Riot JS internationalization tag and mixin
Getting Started
1. Installation
npm install riot-i18n
2. Examples
include with module loader
var i18n = ;i18n
or via script tag
<!-- exposes global var 'i18n' -->
The library register's the 'i1-8n' tag with riot.
HelloI love you
and provides a 'localise' method for translating outside of a tag
i18ni18n // -> 您好
setting language can be achieved using i18n.setLanguage('lang') or triggered using a riot observable
enzhjpriot.mixin('i18n')this.i18n.setLanguage('fr')this.i18n.localise('Hello') // -> Hellothis.onClick = function(e) {this.i18n.trigger('lang', e.target.innerHTML)}this.i18n.trigger('lang', 'jp')this.i18n.localise('Hello') // -> こんにちは
If no dictionary language substitute is available the default will always be used
localise method substitution object
thisi18n // --> Hello Goodman!
nested properties
i18n
Copyright and license
Copyright (c) 2015-2017 Anycode lee@anycode.io
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.