A lightweight internationalization (I18n) plug-in based on jQuery.

  • Support to set the default language
  • Support switching languages
  • Support for using JSON files to store translation content

You can customize different language versions of the JSON file according to the user, according to the need to render the language on the web page, to achieve internationalization.

The installation

You can go to github.com/ZOMAKE/jque… Download the latest version

Start with jQuery files:

<script src="jquery.js"></script>Copy the code

Jquery.i18n.js = jquery.i18n.js

<script src="jquery.i18n.js"></script>Copy the code

configuration

filePath

filePath: "/i18n/".Copy the code

This parameter specifies the location of the language file folder in the project.

fileSuffix

fileSuffix: "".Copy the code

This parameter specifies the suffix of the language file’s name.

i18nOnly

By default, HTML elements placeholder, value, and HTML are translated and replaced together. If you want to replace only one of them, you can declare the i18nOnly attribute in the HTML tag.

<input i18n="i18n.test" i18n-only="placeholder" placeholder="multilingual"></input>Copy the code