Translation of drop down values which are added from Catalog Client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2020 01:03 AM
Hi,
we were able to translate all the drop down values which are added from Quetion choices or choices but the choices which are added from Catalog Client script using addOptions how to translate those?
- Labels:
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2020 01:13 AM
Hi,
store the choice values translation in messages table and use that
g_form.addOption('field', getMessage('choice value'),getMessage('choice value'));
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2020 01:24 AM
Hi Ankur,
I have 50 such choices which are added via addOption. Do I need to add this g_form.addOption('field', getMessage('choice value'),getMessage('choice value')); in the same catalog client script for all the 50 choices?
I have to translate these for almost 15 languages so do i need to do this addoption for 15 languages?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2020 03:40 AM
Hi,
For 1 choice if you want 2 languages then 2 entries here
So if total 50 such choices then 100 entries into messages table
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2020 12:34 AM
Hi Ankur,
Can you please help with the script.
This is the one which is been used currently to add choices. How to include translations script
function onChange(control, oldValue, newValue, isLoading) {
g_form.clearOptions('subcategory');
g_form.addOption('subcategory', '', '-- None --', 0);
g_form.setReadOnly('subcategory', false);
g_form.setMandatory('subcategory', true);
if (isLoading || !newValue) return;
var options = getOptions(newValue);
if (options && options.length) {
options.forEach(function (option) {
g_form.addOption('subcategory', option.value, option.label,
option.sequence);
});
} else {
g_form.setMandatory('subcategory', false);
g_form.setReadOnly('subcategory', true);
}
function getOptions(category) {
return {
hardware: [
{
label: 'AS400',
value: 'as400',
]
}[category];