translation.load(options)
Method Description |
Creates a translation.Handle object with translations for the specified Translation Collections and locales. This method returns a You can load translation strings from multiple Translation Collections in a single call of When you load translation strings using |
Returns |
|
Supported Script Types |
Client and server scripts For additional information, see SuiteScript 2.x Script Types. |
Governance |
10 units |
Module |
|
Sibling Object Members |
|
Since |
2019.1 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
Object[] |
required |
A list of translation.Handle objects to load. |
|
string |
required |
An alias to identify the collection. This alias is used by the script to determine the collection to load. |
|
string |
required |
The script ID of the collection to load. |
|
string[] |
required |
A list of translation keys from the collection to load. |
|
string[] |
optional |
A list of locales to load the collection in. Use the values in the translation.Locale enum to set this value. |
Errors
Error Code |
Thrown If |
---|---|
WRONG_PARAMETER_TYPE |
One of the array parameters ( |
SSS_MISSING_REQD_ARGUMENT |
A collection or key parameter is missing. |
INVALID_TRANSLATION_KEY |
The format of a specified key is invalid. |
INVALID_TRANSLATION_COLLECTION |
The format of a specified collection is invalid. |
INVALID_LOCALE |
The format of a specified locale is invalid. |
INVALID_ALIAS |
The format of a specified alias is invalid. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/translation Module Script Samples.
// Add additional code
...
let localizedStrings = translation.load({
collections: [{
alias: 'myCollection',
collection: 'custcollection_my_strings',
keys: ['MY_TITLE', 'MY_MESSAGE']
}]
});
let myMsg = message.create({
title: localizedStrings.myCollection.MY_TITLE(),
message: localizedStrings.myCollection.MY_MESSAGE(),
type: message.Type.CONFIRMATION
});
...
// Add additional code