Built-In Namespace _global_
Field Attributes | Field Name and Description |
---|---|
Utility function which checks for untranslated strings.
|
|
Internet Explorer version number, or undefined if using a real browser.
|
|
Boolean indicating the MacOS platform.
|
|
Converts a string to a translated string without translation.
|
Method Attributes | Method Name and Description |
---|---|
_(text)
Translates a string.
|
|
bindtextdomain(domain, pattern)
Adds a new i18n domain, usually for a plugin.
|
|
callback()
|
|
constant(x)
Constant function.
|
|
dnpgettext(domain, context, singular, plural, n)
Translates a string containing numbers.
|
|
dpgettext(domain, context, text)
Translates a string
|
|
Empty function.
|
|
escapeHTML(s)
Escapes a string to be included in an HTML file.
|
|
escapeRegExp(s)
Escapes a string to be included in a regular expression.
|
|
extend(parent, prototype)
Creates the prototype object of a subclass.
|
|
format(string, params)
Formats a string by replacing printf-style format specifiers in the string
with dynamic parameters.
|
|
formatDateTime(format, date)
Formats a Date object according to a format string.
|
|
getInterval(t, until)
Formats an interval as a string
|
|
Returns the day of the week which decides the week number
|
|
gettext(text)
Translates a string.
|
|
I18nString(toString)
A class for translated strings.
|
|
identity(x)
Identity function.
|
|
isEmpty(x)
Returns whether an object is empty.
|
|
isLocalToday(t)
Same as isToday but using local time
|
|
Returns an array with currently registered i18n domains.
|
|
loadI18n(js, name, path, cb, cb)
Evaluates a JavaScript program using the specified i18n text domain.
|
|
loadModule(name, join, noI18n)
Loads a module at runtime.
|
|
ngettext(singular, plural, n)
Translates a string containing numbers.
|
|
noI18n(text)
Converts a string to I18nString without translation.
|
|
npgettext(context, singular, plural, n)
Translates a string containing numbers with context.
|
|
ObjectToArray(object)
Converts an Object into Array
|
|
parseDateTime(format, string)
Parses a date and time according to a format string.
|
|
pgettext(context, text)
Translates a string with context
|
|
Quotes the personal name part of a mail address, if necessary.
|
|
replacePOFile(domain, language, data)
Installs a PO file from a string parameter instead of downloading it from
the server.
|
|
setLanguage(name)
Changes the current language which is used for all subsequent translations.
|
Field Detail
{String}
expectI18n
Utility function which checks for untranslated strings.
Should be used by widget implementations to convert I18nString to strings
immediately before displaying them.
Defined in: i18n.js.
Defined in: i18n.js.
IE
Internet Explorer version number, or undefined if using a real browser.
Since comparisons with undefined always return false, checks involving this
variable should use the "<" or "<=" operators, e. g. "if (IE < 8)".
Defined in: util.js.
Defined in: util.js.
Mac
Boolean indicating the MacOS platform. If true, selections use the Meta key
instead of the Ctrl key.
Defined in: util.js.
Defined in: util.js.
{I18nString}
noI18n
Converts a string to a translated string without translation.
Use only for user-entered data.
Defined in: i18n.js.
Defined in: i18n.js.
Method Detail
{I18nString}
_(text)
Translates a string.
Defined in: modules.js.
Defined in: modules.js.
- Parameters:
- {String} text
- The original English text to translate.
- Returns:
- The translated text.
bindtextdomain(domain, pattern)
Adds a new i18n domain, usually for a plugin.
Defined in: i18n.js.
Defined in: i18n.js.
- Parameters:
- {String} domain
- A new domain name, usually the plugin name.
- {String} pattern
- A Pattern which is used to find the PO or JS file on the server. The pattern is processed by formatting it with the language ID as the only parameter. The formatted result is used to download the file from the server.
callback()
Defined in: i18n.js.
{Function}
constant(x)
Constant function.
Returns a new function which returns the first parameter of this function.
Defined in: util.js.
Defined in: util.js.
- Parameters:
- x
- Returns:
- A function which returns x.
{I18nString}
dnpgettext(domain, context, singular, plural, n)
Translates a string containing numbers.
Defined in: i18n.js.
Defined in: i18n.js.
- Parameters:
- {String} domain
- An i18n domain to use for the translation.
- {String} context
- A context to differentiate multiple identical texts with different translations.
- {String} singular
- The original English text for the singular form.
- {String} plural
- The original English text for the plural form.
- {Number} n
- The number which determines which text form is used.
- Returns:
- The translated text.
{I18nString}
dpgettext(domain, context, text)
Translates a string
Defined in: i18n.js.
Defined in: i18n.js.
- Parameters:
- {String} domain
- An i18n domain to use for the translation.
- {String} context
- A context to differentiate multiple identical texts with different translations.
- {String} text
- The original English text to translate.
- Returns:
- The translated text.
emptyFunction()
Empty function. Does nothing.
Defined in: util.js.
Defined in: util.js.
{String}
escapeHTML(s)
Escapes a string to be included in an HTML file.
The characters '<', '>', '&', '"' and "'" are replaced by their HTML entity
references.
Defined in: util.js.
Defined in: util.js.
- Parameters:
- {String} s
- The string to escape.
- Returns:
- The escaped string.
{String}
escapeRegExp(s)
Escapes a string to be included in a regular expression.
Defined in: util.js.
Defined in: util.js.
- Parameters:
- {String} s
- The string to escape.
- Returns:
- The escaped string.
{Object}
extend(parent, prototype)
Creates the prototype object of a subclass.
Defined in: util.js.
Defined in: util.js.
- Parameters:
- {Function} parent
- The constructor function of the superclass.
- {Object} prototype
- The prototype object of the subclass, containing only new and overridden members.
- Returns:
- The prototype object with all inherited members added to it.
{String or I18nString}
format(string, params)
Formats a string by replacing printf-style format specifiers in the string
with dynamic parameters. Flags, width, precision and length modifiers are
not supported. All type conversions are performed by the standard toString()
JavaScript method.
Defined in: i18n.js.
Defined in: i18n.js.
- Parameters:
- {String or I18nString} string
- The format string.
- params
- Either an array with parameters or multiple separate parameters.
- Returns:
- The formatted string.
{String}
formatDateTime(format, date)
Formats a Date object according to a format string.
Defined in: i18n.js.
Defined in: i18n.js.
- Parameters:
- {String} format
- The format string. It has the same syntax as Java's java.text.SimpleDateFormat, assuming a Gregorian calendar.
- {Date} date
- The Date object to format. It must contain a Time value as defined in the HTTP API specification.
- Returns:
- The formatted date and/or time.
{String}
getInterval(t, until)
Formats an interval as a string
Defined in: i18n.js.
Defined in: i18n.js.
- Parameters:
- {Number} t
- The interval in milliseconds
- {Boolean} until
- Specifies whether the returned text should be in objective case (if true) or in nominative case (if false).
- Returns:
- The formatted interval.
getKeyDayOfWeek(d)
Returns the day of the week which decides the week number
Defined in: i18n.js.
Defined in: i18n.js.
- Parameters:
- d
- Returns:
- Day of week
{I18nString}
gettext(text)
Translates a string.
Defined in: modules.js.
Defined in: modules.js.
- Parameters:
- {String} text
- The original English text to translate.
- Returns:
- The translated text.
I18nString(toString)
A class for translated strings.
Each I18n object has a toString() method which returns the translation based
on the current language. All user-visible widgets expect instances of this
class, and convert them to strings when the user changes the GUI language.
Defined in: i18n.js.
Defined in: i18n.js.
- Parameters:
- {function()} toString
- A callback function which returns a translated text using the current GUI language.
identity(x)
Identity function. Returns its first parameter.
Defined in: util.js.
Defined in: util.js.
- Parameters:
- x
{Boolean}
isEmpty(x)
Returns whether an object is empty.
Defined in: util.js.
Defined in: util.js.
- Parameters:
- {Object} x
- The tested object
- Returns:
- True if the object does not have enumerable properties, false otherwise.
isLocalToday(t)
Same as isToday but using local time
Defined in: i18n.js.
Defined in: i18n.js.
- Parameters:
- t
{Array}
listI18nDomains()
Returns an array with currently registered i18n domains. I18n domains are
used by plugins to allow for independent translation.
Defined in: i18n.js.
Defined in: i18n.js.
- Returns:
- An array of strings, including one empty string for the default domain.
loadI18n(js, name, path, cb, cb)
Evaluates a JavaScript program using the specified i18n text domain.
The domain must have been bound using bindtextdomain().
The JavScript program is converted to the body of a function and
that function is called.
Defined in: modules.js.
Defined in: modules.js.
- Parameters:
- {String} js
- The javaScript program to evaluate.
- {String} name
- The i18n text domain as used by bindtextdomain(). This value can also be accessed in the evaluated program as NAME.
- {String} path
- The path to the file's directory. This value can be accessed in the evaluated program as PATH.
- {Function} cb
- A callback function which is called with the return value of the evaluated program.
- cb
- Returns:
- The return value of the evaluated program.
loadModule(name, join, noI18n)
Loads a module at runtime.
Loading a module which is already (being) loaded has no effect.
The register.js file from the module's directory is converted to the body of
a function and that function is called.
The file is downloaded asynchronously.
Defined in: modules.js.
Defined in: modules.js.
- Parameters:
- {String} name
- The name of the module to load.
- {Join} join
- An optional Join object which is locked until the module finishes loading.
- noI18n
{I18nString}
ngettext(singular, plural, n)
Translates a string containing numbers.
Defined in: modules.js.
Defined in: modules.js.
- Parameters:
- {String} singular
- The original English text for the singular form.
- {String} plural
- The original English text for the plural form.
- {Number} n
- The number which determines which text form is used.
- Returns:
- The translated text.
{I18nString}
noI18n(text)
Converts a string to I18nString without translation.
Defined in: modules.js.
Defined in: modules.js.
- Parameters:
- {String} text
- The text to convert.
- Returns:
- The untranslated text as I18nString.
{I18nString}
npgettext(context, singular, plural, n)
Translates a string containing numbers with context.
Defined in: modules.js.
Defined in: modules.js.
- Parameters:
- {String} context
- A context to differentiate multiple identical texts with different translations.
- {String} singular
- The original English text for the singular form.
- {String} plural
- The original English text for the plural form.
- {Number} n
- The number which determines which text form is used.
- Returns:
- The translated text.
ObjectToArray(object)
Converts an Object into Array
Defined in: util.js.
Defined in: util.js.
- Parameters:
- object
{Date}
parseDateTime(format, string)
Parses a date and time according to a format string.
Defined in: i18n.js.
Defined in: i18n.js.
- Parameters:
- {String} format
- The format string. It has the same syntax as Java's java.text.SimpleDateFormat, assuming a Gregorian calendar.
- {String} string
- The string to parse.
- Returns:
- The parsed date as a Date object. It will contain a Time value as defined in the HTTP API specification.
{I18nString}
pgettext(context, text)
Translates a string with context
Defined in: modules.js.
Defined in: modules.js.
- Parameters:
- {String} context
- A context to differentiate multiple identical texts with different translations.
- {String} text
- The original English text to translate.
- Returns:
- The translated text.
{String}
quotePersonalAddr(s)
Quotes the personal name part of a mail address, if necessary.
Defined in: util.js.
Defined in: util.js.
- Parameters:
- {String} s
- The personal name to quote.
- Returns:
- Either the quoted or the original string.
replacePOFile(domain, language, data)
Installs a PO file from a string parameter instead of downloading it from
the server.
In case of a syntax error, an exception is thrown.
If the specified language file is already loaded, it will be replaced.
When replacing a file for the currently active language, the settings take
effect immediately.
Defined in: i18n.js.
Defined in: i18n.js.
- Parameters:
- {String} domain
- The i18n domain of the file. Usually the ID of a plugin or the empty string for the translation of the core.
- {String} language
- The language of the file.
- {String} data
- The contents of the PO file.
setLanguage(name)
Changes the current language which is used for all subsequent translations.
Also translates all currently displayed strings.
Defined in: i18n.js.
Defined in: i18n.js.
- Parameters:
- {String} name
- The ID of the new language.