Class: Translations
Oracle® Fusion Middleware Oracle JavaScript Extension Toolkit (JET)
12c (12.1.4)
E54107-01
Constructor
new Translations()
- Source:
Methods
-
<static> _getResourceString(key) → {string|null}
-
Retrives a translated resource for a given key, accounting for nested keys
Parameters:
Name |
Type |
Description |
key |
string
|
|
- Source:
Returns:
resource associated with the key or null if none was found
-
Type
-
string
|
null
-
<static> applyParameters(parameters)
-
Applies parameters to a format pattern
Parameters:
Name |
Type |
Description |
pattern. |
string
|
Tokens ike {0}, {1}, {name} within the pattern
will be used to define string keys for retrieving values from the parameters
object. Token strings should not contain comma (')
or space characters, since they are reserved for future format type enhancements.
The reserved characters within a pattern are:
$ { } [ ]
These characters will not appear in the formatted output unless they are escaped
with a dollar character ('$'). |
parameters |
Object
|
Array
|
to be inserted into the string. Both arrays and
Javascript objects with string keys are accepted. |
- Source:
Returns:
formatted message or null if the pattern argument was null
-
<static> getComponentTranslations(componentName)
-
Provides a key-to-value map of the translated resources for a given component name
Parameters:
Name |
Type |
Description |
componentName |
string
|
|
- Source:
Returns:
a map of translated resources
-
<static> getResource(key) → {Object|string|null}
-
Retrives a translated resource for a given key
Parameters:
Name |
Type |
Description |
key |
string
|
|
- Source:
Returns:
resource associated with the key or null if none was found
-
Type
-
Object
|
string
|
null
-
<static> getTranslatedString(key, var_args)
-
Retrieves a translated string after inserting optional parameters
Parameters:
Name |
Type |
Description |
key |
string
|
translations resource key
The key is used to retrieve a format pattern from the resource bundle.
Tokens like {0}, {1}, {name} within the pattern will be used to define placement
for the optional parameters. Token strings should not contain comma (,)
or space characters, since they are reserved for future format type enhancements.
The reserved characters within a pattern are:
$ { } [ ]
These characters will not appear in the formatted output unless they are escaped
with a dollar character ('$'). |
var_args |
string
|
Object
|
Array
|
optional parameters to be inserted into the
translated pattern.
If more than one var_args arguments are passed, they will be treated as an array
for replacing positional tokens like {0}, {1}, etc.
If a single argument is passed, it will be treated as a Javascript Object whose
keys will be matched to tokens within the pattern. Note that an Array is just
a special kind of such an Object.
For backward compatibility, a var_args argument whose type is neither
Object or Array will be used to replace {0} in the pattern. |
- Source:
Returns:
formatted translated string
-
<static> setBundle(bundle)
-
Sets the translation bundle used by JET
If an AMD loader (such as Require.js) is not present, this method should be called by the application to provide
translated strings for JET.
This method may also be used by an application that wants to completely replace the resource bundle that is automatically
fetched by an AMD loader.
Parameters:
Name |
Type |
Description |
bundle |
Object
|
resource bundle that should be used by the framework |
- Source: