Internationalization and localization library for HTML pages via Javascript.
Supports nested resolving, i.e. you can use I18N.resolve( 'a.b.c' )
to resolve
"EN": {
"a": {
"b": {
"c": "Your text"
}
}
}
or
"EN": { "a.b.c": "Your text" }
- Add a
<script>
element after your jQuery import withid="i18n"
. - Add a
i18n-src
attribute to the previous<script>
tag pointing to you JSON locale file. - Add a
i18n-locale
attribute to the previous<script>
tag with the locale the page will use. - Mark the elements that will use i18n with
i18n-text
. - Use
i18n-placeholder
in your<input>
s and<textarea>
s to resolve placeholders. - Or use
I18N.resolve
in your scripts. - Use
I18N.setLocale(..)
to dynamically change the locale.
See the example for more details.