Using _.translate() to Pass String Literals in NetSuite
Learn to effectively use the _.translate() function for string literals in the Kilimanjaro release of NetSuite.
This topic applies to the Kilimanjaro release of SCA and earlier. If you are localizing text using an extension, see Localize Text in an Extension.
In the following example, the string literal Country is required gets translated to Se requiere país when the site language is Spanish, matching the name-value pair in the SC.Translations array of the es_ES.js file.
_.translate() function used in Address.Model.js file:
validation: { ... , country: { required: true, msg: _('Country is required').translate() } ... }Corresponding JSON used in ShoppingApplication@x.x.x >Languages > es_ES.js:
1SC.Translations = {2 ...3"Continue Shopping":"Continuar comprando", 4"Continue Shopping on our $(0)":"Continuar comprando en nuestro $(0)", 5"Country is required":"Se requiere país", 6"Credit Card Number is invalid":"Número de tarjeta de crédito no válido", 7"Credit Card type is not supported":"No se admite el tipo de tarjeta de crédito",8 ...9};Note:
Values from the SC.Translations arrays go through a translation function, so the values you set in the array for a language might not always match exactly what shows up in your web store.
Many string literals are translated on the client side with the _.translate() function. When you set a specific language, string literals in _.translate() functions are replaced with language-specific strings from the SC.Translations arrays in the JavaScript language files.
The language JavaScript files are in the languages subfolder for each application module-for example, Modules > suite_commerce > ShoppingApplication.x.x.x > Languages. In the final Distribution folder, they're in the languages subfolder at the root.
Note:
If a literal in a _.translate() function doesn't match a name-value pair in the SC.Translations array for the active language, it won't be replaced.
For example, the string literal Country is required gets translated to Se requiere pais when Spanish is the active language, matching the name-value pair in the SC.Translations array of the es_ES.js file in the languages folder.
_.translate() function used in Address.Model.js file:
validation: { ... , country: { required: true, msg: _('Country is required').translate() } ... }Corresponding JSON used in ShoppingApplication@x.x.x >Languages > es_ES.js:
1SC.Translations = {2 ...3"Continue Shopping":"Continuar comprando", 4"Continue Shopping on our $(0)":"Continuar comprando en nuestro $(0)", 5"Country is required":"Se requiere país", 6"Credit Card Number is invalid":"Número de tarjeta de crédito no válido", 7"Credit Card type is not supported":"No se admite el tipo de tarjeta de crédito",8 ...9};Note:
Values from the SC.Translations arrays go to a translation function, so there might not always be a direct match between the values you set in the array and what actually appears in your web store.
Related Topics
- Pass Parameters and HTML
- The Translation Process
- Set Up NetSuite for Localized Content
- Create Custom String Literals
- Configure Hosts for Sites with Multiple Languages
General Notices
Frequently Asked Questions (4)
How does the _.translate() function work with SC.Translations arrays?
What happens if a string literal does not match any entries in the SC.Translations array?
Where are the language-specific JavaScript files located for the ShoppingApplication module?
Does the Pass String Literals feature affect existing functionalities when migrating to a new NetSuite version?
Was this article helpful?
More in General
- NetSuite 2026.1: Enhancements to Consolidated Reports and SuiteQL
NetSuite 2026.1 introduces new consolidated reports and SuiteQL tool for improved reporting and data integrity.
- Release Notes PDF Availability and Translations in NetSuite
NetSuite provides PDF files for each Release Note update, improving accessibility and user experience.
- Enhanced Commitment Credits for Flexible Billing in NetSuite
Commitment Credits in NetSuite SuiteBilling offer enhanced flexibility for usage-based billing across diverse services.
- New Parent Role Field for Custom Roles in NetSuite 2025.2
The new Parent Role field facilitates easier role management and visibility in NetSuite 2025.2 for administrators.
Advertising
Reach General Professionals
Put your product in front of NetSuite experts who work with General every day.
Sponsor This Category