Global object I18N
You cannot create an I18N object, a global I18N object is created for you.
none
global namespace.
ECMerge 2.2
The I18N global object acts as a namespace
load_catalog
translate
This samples uses the '_' facility function provided by
the _facility.js macro file. '_'
(underscore) function is a shortcut for
I18N.translate.
The following line will show an alert box with 'left' written
in your language:
alert (_("left"));
Application object.
function load_catalog (name)
name. String. Name of the catalog to load
I18N global object.
ECMerge 2.2
Loads a catalog file with given name. A catalog file is
a .mo file compiled from a PO file (as per gettext
GNU package) with msgfmt tool.
Currently catalogs are searched only in the ECMerge
directories.
Loads a catalog called "mymacro":
I18N.load_catalog ("mymacro")
function translate (text, catalog)
function translate (text, text_plural, num, catalog)
returns a String
text, text_plural. String. Texts to be
translated
num. Int32. When used, indicates the default
translation for plurals.
catalog. String. If not provided or undefined, the
translation is chosen from any catalog (from the last loaded
which contains the text to be translated), else a translation
is searched only in given catalog.
I18N global object.
ECMerge 2.2
Returns the translation for a given text string.
Prints 'gauche' to log view when in French, by translating 'left':
log (I18N.translate('left'))
Prints the translation with plural meaning:
var cat_count = 2;
log (I18N.translate('there is # cat', 'there are # cats',
cat_count).replace('#', cat_count))
I18N object