Namespace: L10N

OC.L10N

L10N namespace with localization functions.
Source:

Members

(static) _bundles :Object.<String, String>

String bundles with app name as key.
Type:
  • Object.<String, String>
Source:

(static) _pluralFunctions :Object.<String, function()>

Plural functions, key is app name and value is function.
Type:
  • Object.<String, function()>
Source:

Methods

(private, static) _getPlural(number) → {number}

The plural function taken from symfony
Parameters:
Name Type Description
number number
Source:
Returns:
Type
number

(static) load(appName, callback) → {Promise}

Load an app's translation bundle if not loaded already.
Parameters:
Name Type Description
appName String name of the app
callback function callback to be called when the translations are loaded
Source:
Returns:
promise
Type
Promise

(static) register(appName, bundle, pluralFormopt)

Register an app's translation bundle.
Parameters:
Name Type Attributes Description
appName String name of the app
bundle Object.<String, String>
pluralForm function | String <optional>
optional plural function or plural string
Source:

(static) translate(app, text, varsopt, countopt, optionsopt) → {string}

Translate a string
Parameters:
Name Type Attributes Description
app string the id of the app for which to translate the string
text string the string to translate
vars <optional>
map of placeholder key to value
count number <optional>
number to replace %n with
options array <optional>
options array
Properties
Name Type Attributes Default Description
escape bool <optional>
true enable/disable auto escape of placeholders (by default enabled)
Source:
Returns:
Type
string

(static) translatePlural(app, textSingular, textPlural, count, varsopt, optionsopt) → {string}

Translate a plural string
Parameters:
Name Type Attributes Description
app string the id of the app for which to translate the string
textSingular string the string to translate for exactly one object
textPlural string the string to translate for n objects
count number number to determine whether to use singular or plural
vars <optional>
map of placeholder key to value
options array <optional>
options array
Properties
Name Type Attributes Default Description
escape bool <optional>
true enable/disable auto escape of placeholders (by default enabled)
Source:
Returns:
Translated string
Type
string