Targeting a specific language for translations via script.

raprohaska
Kilo Guru

We have a very customized portal and are building custom administration screens in the portal as well. The client wants to control translations without jumping around using the session language, meaning they would want someone with their language setting as English be able to create Spanish versions of verbiage without changing their language setting.

Obviously I can go straight to the translated text tables and go between the source table and the translated table, but I'm hoping that I'm missing a way to specify a language for a GlideRecord. If there is, then I can just use getDisplayValue and setDisplayValue as ServiceNow intended to interact with the translations instead of jumping through hoops to get and write data to the translation tables.

The best I've found so far is to cache the user's selected session language, change to the targeted language, perform my queries and updates, and then set the session language back to the user's selected value. But I'm not a fan of this as that would affect other tabs open in the browser and have effects beyond what is reasonable to test.

Thanks in advance for any ideas,

AA

1 REPLY 1

Alex Coope - SN
ServiceNow Employee
ServiceNow Employee

@raprohaska,

Ok so there's quite a few things to unpack there. The first being that "Session Language" is how the UI knows what language to show to the end-user. The second being, I've posted on my blog a rather simplified way of translating portals here (I also recommend checking out the webinar in the post),

Deviating from how the ootb works (based on your proposal) would introduce so much unnecessary technical debt and potentially break how the majority of the Portal works (not to mention the amount of overhead to maintain should you want to take on any new functionality) would be a risk I wouldn't take.

The best thing I can suggest is to guide the Customer to how it works ootb and if necessary send me an email and I'm more than happy to assist (my team is Customer facing),

Side note - we actually have a dedicated forum here on Community for these types of topics here,

Many thanks,
kind regards

--------------------------------------------------------------------
Director of Globalization Deployment, Internationalization