Includes : I18n

By w35l3y Last update Jan 31, 2012 — Installed 134,610 times.

Script Summary: I18n Function



Version: 3.0.0.3

Copyright: 2011+, w35l3y (http://gm.wesley.eti.br)

License: GNU GPL

FOR SCRIPTERS/PROGRAMMERS only

If you are neither scripter nor programmer, you're discouraged to install this script directly.
In other words, don't install if you don't know what it is or how it works.

Implementing

// @resource       i18n some url containing label definitions (json) *
// @resource       meta http://userscripts.org/scripts/source/*****.user.js *
// @require        http://userscripts.org/scripts/source/56489.user.js
// @require        http://userscripts.org/scripts/source/85618.user.js
// @require        http://userscripts.org/scripts/source/87940.user.js
* It is recommended to define at least one of the @resource.
* If you choose "meta", the @language header should be defined. Otherwise, it will be considered as being English (en).

Examples

__("Hello world!", alert);
alert(__("Hello world!"));
__("My name is {0} and I am {1} years old.", "custom.label", ["Jack", 21], function(str, obj) {
	alert(str.replace(/\{(\d+)\}/g, function($0, $1) {
		return ($1 in obj?obj[$1]:$0);
	}));
});

Known scripts using it

Neopets : Avatars Flash Games by w35l3y
Includes : Neopets : FlashGame by w35l3y
Includes : Updater by w35l3y