Class Index | File Index

Classes


Class M.I18N


Extends M.Object.
M.I18N defines a prototype for for internationalisation and localisation within The M-Project. It is used to set and get the application's language and to localize any string within an application.
Defined in: i18n.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
M.I18N()
Field Summary
Field Attributes Field Name and Description
 
The system's default language.
 
This property is used to map the navigator's language to an ISO standard if necessary.
 
The type of this object.
Method Summary
Method Attributes Method Name and Description
 
This method is used to get a language for the current user.
 
This method checks if the passed language is available within the app or not.
 
l(key)
This method returns the localized string for the given key based on the current language.
 
setLanguage(language)
This method sets the applications current language and forces it to reload.
Methods borrowed from class M.Object:
bindToCaller, create, destroy, extend, get, include, set
Class Detail
M.I18N()
Field Detail
{String} defaultLanguage
The system's default language.

{Object} languageMapper
This property is used to map the navigator's language to an ISO standard if necessary. E.g. 'de' will be mapped to 'de_de'. Currently we only provide support for english and german. More languages are about to come or can be added by overwriting this property.

{String} type
The type of this object.
Method Detail
{String} getLanguage()
This method is used to get a language for the current user. This process is divided into three steps. If one step leads to a language, this on is returned. The steps are prioritized as follows: - get the user's language by checking his navigator - use the application's default language - use the systems's default language
Returns:
{String} The user's language.

{Boolean} isLanguageAvailable(language)
This method checks if the passed language is available within the app or not.
Parameters:
{String} language
The language to be checked.
Returns:
{Boolean} Indicates whether the requested language is available or not.

{String} l(key)
This method returns the localized string for the given key based on the current language.
Parameters:
{String} key
The key to the localized string.
Returns:
{String} The localizes string based on the current application language.

setLanguage(language)
This method sets the applications current language and forces it to reload.
Parameters:
{String} language
The language to be set.

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Dec 08 2010 15:07:30 GMT+0100 (MEZ)