Ellié Computing Home Page
My Shopping Cart

Your shopping cart is empty

Display Cart

Call us at +1 586 62 ELLIE / +1 586 62 35543 Office Opened
sales@elliecomputing.com - Contact us


I18N object

 

 

Global object I18N

Syntax

 You cannot create an I18N object, a global I18N object is created for you.

Parameters

 none

Property Of

global namespace.

Implemented In

ECMerge 2.2

Description

 The I18N global object acts as a namespace

Methods

load_catalog
translate

Examples

Example 1.

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"));

See Also 

 Application object.

Method load_catalog

Syntax

function load_catalog (name)

Parameters

name. String. Name of the catalog to load 

Method Of

I18N global object.

Implemented In

ECMerge 2.2

Description

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.

Examples

Example 1.

Loads a catalog called "mymacro":

I18N.load_catalog ("mymacro")

Method translate

Syntax

function translate (text, catalog)
function translate (text, text_plural, num, catalog)
returns a String

Parameters

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.

Method Of

I18N global object.

Implemented In

ECMerge 2.2

Description

 Returns the translation for a given text string.

Examples

Example 1.

Prints 'gauche' to log view when in French, by translating 'left':

log (I18N.translate('left'))

Example 2.

Prints the translation with plural meaning:

var cat_count = 2;
log (I18N.translate('there is # cat', 'there are # cats', cat_count).replace('#', cat_count))

See Also 

I18N object