Skip to content

Internationalization and localization library for HTML pages via Javascript.

Notifications You must be signed in to change notification settings

SebastianOsuna/i18n

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

i18n

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" } 

Requirements

Usage

  • Add a <script> element after your jQuery import with id="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.

About

Internationalization and localization library for HTML pages via Javascript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published