Skip to content
/ i18n.js Public

Lightweight jQuery plugin for handling internationalization (i18n). Swap text on html pages with their relevant locale from a JSON language file.

Notifications You must be signed in to change notification settings

cmjio/i18n.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jQuery Internationalization (i18n)

This is a lightweight jQuery function for translating strings of text on html pages. This plugin detects the language set by the user in their browser or by using a forced language in the your javascript.

Quick Start

The language files are .json files located by default in js/lang in your directory, this can be changed using the plugin options. For each language their should be a seperate language file. This can be formated in any why that suits your project. An example language file for our example can be found in example/js/lang. The file names for these language files should take the following format:

i18n_en-US.json
i18n_fr.json
i18n_en-UK.json

To start getting your HTML5 files supporting international languages start by including the latest jQuery library in your source then this jQuery plugin. Use jquery.i18n.min.js for a minified version or jquery.i18n.js if you would prefer to view the source.

On the elements you wish translated to your desired language from your language file use put data-attributes on those elements called data-translate="".

$('[data-translate]').i18n();

About

Lightweight jQuery plugin for handling internationalization (i18n). Swap text on html pages with their relevant locale from a JSON language file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published