Translations , need to add German Language also in the below On Change script

prudhviraj1
Tera Guru

When selecting German Language also it was showing English Choices only, so need to include German choices in the script, kindly help me

prudhviraj1_0-1674565429639.jpeg

 

 

7 REPLIES 7

Hayo Lubbers
Kilo Sage

The proper way would be to retrieve the choices via a GlideAjax call.

The simplified way would be to check the language of the user if(g_lang == 'en'){} and hardcode also the other list of options for German.

 

Regards,

Hayo

 

Please mark the solution as correct, if the answer provided has resolved your query.

Hi Lubbere,

I have created Countries translated also, but here we are countries would be selected as region based.

On the script we written that only. but the issue is not translated the countries

Hi Lubbers,

I have called the GlideAjax call. but it's not working kindly help me

 

var ajax = new GlideAjax('global.TranslationsPayrollCountry');


// ajax.addParam('sysparm_name','getCountry');
// ajax.addParam('sysparm_region', region);
// ajax.getXMLAnswer(function (answer) {
// alert('hi');
// g_form.addInfoMessage("00 " + answer);
// var user = JSON.parse(answer);
// var id = user.userSysid ;
// alert(user);
// var name = user.userName;
// });

Alex Coope - SN
ServiceNow Employee
ServiceNow Employee

@prudhviraj1,

Ok so there's a few things to unpack here. The first being, adding choices in code like this is not best-practice as in introduced unnecessary technical debt, it's also not the intended design for how translated choices work.

Here's my blog post on why "hard-coded" strings are bad practice, here's my blog post on how the 5 translation tables work (in your case it should be entries in [sys_choice] without using any scripts for the translations - so you should look to refactor your client script, 

 

And finally, here's our training course on NowLearning on how Localization works across the platform,

Many thanks,
kind regards

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