Example
// The PCCViewer.Language object can be initialized from a hash.
PCCViewer.Language.initializeData({
"addComment": "Add Comment",
"advancedSearch": "Advanced Search Options",
"annotateLabel": "Annotate"
// ...
});
// Later, we can get any data by key.
var myValue = PCCViewer.Language.getValue("annotateLabel");
Methods
getData() → {Object}
Returns the hash representing the language data.
Returns:
The hash representing the language data.
- Type
- Object
getValue(key) → {String|Object}
Gets the value from the Language data object with the given key or returns the key.
This method evaluates dots (‘.’) in the key, looking for a child object if a dot is seen. This method provides a convenience over directly accessing the data object because it will return the key instead of returning undefined or throwing in cases where an object is not defined.
Parameters:
Name | Type | Description |
---|---|---|
key |
string |
Look up language data for this key. The key is a string, which uses dot notation to specify sub-keys. |
Throws:
-
If language data is
undefined
. -
- Type
- Error
Returns:
- Type
- String | Object
Example
var myValue;
// Look up language data by a string key
myValue = PCCViewer.Language.getValue("annotateLabel");
// Look up language data using a key with dot notation.
myValue = PCCViewer.Language.getValue("printDialog.title");
initializeData(languageData)
Sets the language data from a hash.
Parameters:
Name | Type | Description |
---|---|---|
languageData |
object |
A hash representing the language data. |
Example
// The PCCViewer.Language object can be initialized from a hash.
PCCViewer.Language.initializeData({
"addComment": "Add Comment",
"advancedSearch": "Advanced Search Options",
"annotateLabel": "Annotate"
// ...
});