³ÉÈËÂÛ̳

Please turn on JavaScript. To find out how to do this visit the .

Internationalisation Module.

Further Info & Examples

Methods

addLocaleModule

Stores the given data against the given module on the given locale.

Synopsis

glow.i18n.addLocaleModule(moduleName, localeTag, data);

Parameters

moduleName
Type

The name of the module to be created/added to.

localeTag
Type

The locale tag to add the module to.

data
Type

The data of the module in key : value form.

Returns

this

Description

Creates any local packs and / or moduels that dio not already exist. Adds the given data to any that do.

Example

// assume locale is "en-GB" first
glow.i18n.setLocale("cy-nonsense-GB");
var newLocale = glow.i18n.getLocale(); // returns "cy-GB"
addLocalePack

Shortcut for creating many locale modules on one locale (ie a brand new entire locale pack)

Synopsis

glow.i18n.addLocalePack(localeTag, data);

Parameters

localeTag
Type

The name of the module retreived.

data
Type

The data of the module in MODULE : key : value form.

Returns

this

checkLocale

Developer focused checker for getting the locale tag(s) returned by tag negotiation

Synopsis

glow.i18n.checkLocale(localeTag, opts);

Parameters

localeTag
Type

The name of the module retreived.

opts
Type
Optional
Yes

Options object

label

If set alongside opts.module, restricts the results to that label on that module.

Type
Optional
Yes
module

If set, restricts the results to that module.

Type
Optional
Yes

Returns

Description

if no options passed it returns a structured data object of the entire data set for the given locale if just a module name is passed, the result set is limited to that module if a module name and a label are passed it returns a string for just that label

getLocale

Returns the tag of the current locale in canonical form.

Synopsis

glow.i18n.getLocale();

Returns

Example

loc = glow.i18n.getLocale(); // returns the current locale eg "en-GB"

glow.i18n.setLocale("cy-GB");
loc = glow.i18n.getLocale(); // now returns "cy

glow.i18n.setLocale("en-ignoredsubtag-US");
loc = glow.i18n.getLocale(); // now returns "en-US", which is the canonical form
getLocaleModule

Retreives an object whose keys are every label that can have a value (via tag negotiation) associated with it, and whose values are the associated label values.

Synopsis

glow.i18n.getLocaleModule(moduleName, opts);

Parameters

moduleName
Type

The name of the module retreived.

opts
Type
Optional
Yes

Options object

locale

On override locale to use instaed of the system locale.

Type
Optional
Yes

Returns

revertLocale

Reverts the locale to the one used immediately prior to the current one.

Synopsis

glow.i18n.revertLocale();

Returns

this

Description

Has no effect if the current locale was the first set (ie if no new locales have been set, or if the locale has been reverted all the way back to the beginning).

Example

// assume locale is "en-GB" first
glow.i18n.setLocale("cy-GB");
// locale is now "cy-GB" with "en-GB" stacked up
glow.i18n.revertLocale();
// locale is now back to "en-GB"
setLocale

Sets the locale to a new one, stacking up the old one for later retreival.

Synopsis

glow.i18n.setLocale(newLocaleTag);

Parameters

newLocaleTag
Type

The new locale tag to be set.

Returns

this

Description

Has no effect if the newLocaleTag is invalid.

Example

// assume locale is "en-GB" first
glow.i18n.setLocale("cy-GB");
// locale is now "cy-GB" with "en-GB" stacked up
Documentation generated by 2.1.0 on Thu Jul 07 2011 12:47:29 GMT+0100 (BST)

³ÉÈËÂÛ̳ iD

³ÉÈËÂÛ̳ navigation

³ÉÈËÂÛ̳ © 2014 The ³ÉÈËÂÛ̳ is not responsible for the content of external sites. Read more.

This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.