translation.get(options)
Method Description |
Creates a translator function for a key in the specified Translation Collection and locale. This method returns a translator function, which is subsequently called with any specified parameters. When you call |
Returns |
|
Supported Script Types |
Client and server scripts For additional information, see SuiteScript 2.x Script Types. |
Governance |
1 unit |
Module |
|
Sibling Object Members |
|
Since |
2019.1 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
string |
required |
The script ID of the collection. |
|
string |
required |
A valid key from the collection. |
|
string |
optional |
A valid locale from the translation.Locale enum. If a locale is not specified, the locale from the current session is used as the default locale. |
Errors
Error Code |
Thrown If |
---|---|
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. |
TRANSLATION_KEY_NOT_FOUND |
A specified translation key was not found. |
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 myMsg = message.create({
title: translation.get({
collection: 'custcollection_my_strings',
key: 'MY_TITLE'
})(),
message: translation.get({
collection: 'custcollection_my_strings',
key: 'HELLO_1'
})({
params: ['NetSuite']
}),
type: message.Type.CONFIRMATION
});
...
// Add additional code