Detailed reference of prototypes, properties and methods available in the
Javascript environment of your Helma web applications.

Methods and macros for internationalization of Helma applications.
jala I18n()
Constructs a new instance of jala.I18n
methods
  • ngettext(singularKey, pluralKey, amount)
jala.I18n jala. i18n
Default i18n class instance.
Methods
jala.I18n. setMessages(msgObject)
Overwrite the default object containing the messages (ie. a vanilla EcmaScript object).
parameters
Object msgObject The object containing the messages
jala.I18n. getMessages()
Get the message object.
returns
The object containing the messages
jala.I18n. setLocaleGetter(func)
Set the method for retrieving the locale.
parameters
Function func The getter method
jala.I18n. getLocaleGetter()
Get the method for retrieving the locale.
returns
The getter method
jala.I18n. setHandler(handler)   deprecated Use {@link #setMessages} instead
Set (overwrite) the default handler containing the messages (ie. a vanilla EcmaScript object).
parameters
Object handler The handler containing the message object
jala.I18n. getLocale(localeId)
Returns the locale for the given id, which is expected to follow the form language[_COUNTRY][_variant], where language is a valid ISO Language Code (eg. "de"), COUNTRY a valid ISO Country Code (eg. "AT"), and variant an identifier for the variant to use.
parameters
localeId
returns
The locale for the given id
jala.I18n. translate(key, plural, amount)
Tries to "translate" the given message key into a localized message.
parameters
String key The message to translate (required)
String plural The plural form of the message to translate
Number amount A number to determine whether to use the singular or plural form of the message
returns
The localized message or the appropriate key if no localized message was found
jala.I18n. getCatalog(locale)
Helper method to get the message catalog corresponding to the actual locale.
parameters
locale
returns
The message catalog.
jala.I18n. formatMessage(message, values)
Converts the message passed as argument into an instance of java.text.MessageFormat, and formats it using the replacement values passed.
parameters
String message The message to format
Array values An optional array containing replacement values
returns
The formatted message or, if the formatting fails, the message passed as argument.
see
jala.I18n. gettext(key)
Returns a localized message for the message key passed as argument. If no localization is found, the message key is returned. Any additional arguments passed to this function will be used as replacement values during message rendering. To reference these values the message can contain placeholders following "{number}" notation, where number must match the number of the additional argument (starting with zero).
parameters
String key The message to localize
returns
The translated message
see
jala.I18n. ngettext(singularKey, pluralKey, amount)
Returns a localized message for the message key passed as argument. In contrast to gettext() this method can handle plural forms based on the amount passed as argument. If no localization is found, the appropriate message key is returned. Any additional arguments passed to this function will be used as replacement values during message rendering. To reference these values the message can contain placeholders following "{number}" notation, where number must match the number of the additional argument (starting with zero).
parameters
String singularKey The singular message to localize
String pluralKey The plural form of the message to localize
Number amount The amount which is used to determine whether the singular or plural form of the message should be returned.
returns
The translated message
see
jala.I18n. markgettext(key)
A simple proxy method which is used to mark a message string for the i18n parser as to be translated.
parameters
String key The message that should be seen by the i18n parser as to be translated.
returns
The message in unmodified form
jala.I18n. message_macro(param)
Returns a translated message. The following macro attributes are accepted:
  • text: The message to translate (required)
  • plural: The plural form of the message
  • values: A list of replacement values. Use a comma to separate more than one value. Each value is either interpreted as a global property (if it doesn't containg a dot) or as a property name of the given macro handler object (eg. "user.name"). If the value of the property is a HopObject or an Array this macro uses the size() resp. length of the object, otherwise the string representation of the object will be used.
parameters
param
returns
The translated message
see
gettext()
For convenience reasons the public methods and macros are put into global scope too
Fri, 05 Feb 2010 17:40:07 GMT.

core framework

optional modules

java libraries

properties files