You can download the prototype version of the plugin from our GitHub code base:
You can also download some examples here to understand the simple usage.
You can also use this plugin to format dates so that dates and months are displayed in the correct order, and the names of dates and months can be translated correctly:
Note that in the date format of the figure Arabic above, the year is shown as 1431. This is because the year has been converted in the form of the Hijri calendar.
Some cultural differences are obvious, such as using different currencies or different month names. But other differences are subtle and unexpected. For example, in some cultures, numbers are not grouped in a balanced way. In a culture marked as "te-in" (Telugu in eastern India), numbers are grouped by 3 digits and then grouped by 2 digits. So like the number 1 million (1000000) it will be written "10,00,000". And some cultures do not group numbers at all. All of these nuances can be handled automatically by the jquery internationalization plug-in.
It may be very tricky to get the right date. Different cultures use different calendars, such as the Gregorian calendar and the Hijri calendar. The same culture may also adopt multiple calendars, such as the Gregorian calendar and the annals of the Emperor's reign, which are used in Japan. Plug-ins provide functions to convert dates into each of these calendars.
Using language tags
The jquery internationalization plug-in recognizes culture according to the language tags defined in the RFC 4646 and RFC 5646 standards (see http://tools.ietf.org/html/rfc5646), and language tags are usually composed of multiple auxiliary tags by hyphens, such as:
Language Markup Language name (Chinese)
En-au English (Australia)
EN-BZ English (Belize)
EN-CA English (Canada)
Id Indonesian text
Zh-chs Chinese (Simplified)-mark no longer used
Zu zu Lu Wen
Note that a single language, such as English, can have more than one language tag at a time. In the same English-speaking countries, the number, currency and date formats used in Canada are different from those of Australia or the United States. You can use the following language Tag Finder tool to get the language tags of a culture:
A folder called Globinfo in the jquery internationalization plug-in contains information about these 350 cultures. In fact, there are more than 700 files in this folder, because it includes the minimized (Minify) and original versions of each file.
For example, in the Globinfo folder, the file jquery.glob.en-au.js corresponds to English (Australia), jQuery.glob.id.js corresponds to Indonesian, and jquery.glob.zh-chs corresponds to Simplified Chinese.
Example: Specifying a Culture
Note the span labels above, which identify all areas that need to be formatted with internationalized Plug-ins: The price of the commodity, the date of the shelf, and the amount of inventory.
In the previous example, I statically added a jquery.glob.de-de.js file containing German cultural habits to the Web page, "De-de" is a language tag that represents German used in Germany.
The jquery internationalization plug-in adds new functions to the jquery function library-including preferculture () and new functions such as format (). You can use the Preferculture () function to set the default culture used when other functions are called by the plug-in. The Preferculture () function takes a language tag as an argument, and this function uses the culture closest to the language tag.
The $.format () function is really used to format money, dates, and numbers. The second parameter of the $.format () function is the format classifier. For example, passing in "C" means that the value of the parameter is formatted in currency style. In Githum's readme file, the meaning of all format classifier representations is described in detail: http://github.com/nje/jquery-glob
When we open this page in the browser, all things are displayed correctly according to the German custom. The currency symbol takes the euro symbol, the date is in German and the date and month name, and the number separator is a dot (.), not a comma (,).