Back to Blogs
NetSuite Diaries

Learn How to Manage Translations in SuiteScript

Jona Obrador
October 25, 2024
3
minutes to read

This article is a sequel to our previous one, Globalize Your Business: Learn How to Manage NetSuite Component Translations  where we discussed Translation Collections and how to extract translation strings from them into our NetSuite objects without any coding.

In this article, we will explore how to use scripts to extract translation strings from Translation Collections and apply them according to our needs.

Another Dilemma

Building on the concepts from the previous article, we face new challenges when introducing custom messages into our record pages.

While translating the Book record type name, field labels, and field-level help texts was beneficial, imagine this scenario: you have an information banner on your Book record type page.

english-translation

Now, that’s a bit inconsistent, as all the other parts of our page and record are translated into Japanese, but the information banner, which we displayed using SuiteScript, remains in English.

Solution

Use Translation Collections!

Using the translation collection we created in the first article, add the strings you need for the information banner.

translation-string

translation-string-source

Access these strings using the N/translation module.

The great news is that we don’t need to specify the locale or language we want to use. The N/translation module automatically pulls the translation strings based on the current language setting.

As we can see here, we did not specify to pull the Japanese translation. It just automatically knows.

Now this feels more congruent :)

translation-japanese-banner

Final Thoughts

Previously, developers had no option but to implement their own translation engines to manage translations across different languages. I recall that our repository contained a large JSON file that stored all the translation strings, along with a translation engine designed to extract those strings from the file.

With the N/translation module, all of that is streamlined, making pulling translation strings easier than ever.

To see the complete SuiteScript code and implementation details discussed in this article, visit Jona’s GitHub repository.

Meet the Author

jona-obrador-author

Jona has over a decade of experience in SuiteCloud Development on the NetSuite platform. She specializes in implementing advanced solutions and has led teams in creating high-quality software. Jona holds multiple certifications and has been recognized with awards like the Summit Award and Quality Champion Award.