Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Translation in UI page

Shusovit Dutta
Tera Expert

The following is a code snippet from a ui page, how to I modify the code to make the texts translatable. for eg: the text: "On Hold Reason" or its choices below. ${} is not working btw.

 

<div>
            <label for="textarea" id="selectOptions">On Hold Reason</label>
            <p>
                <select name="onHold" id="onHoldReason" onchange="onHoldChoiceMandatory()" class="form-control">
                    <option value="noneValue" role="option">--None--</option>
                    <option value="awaitingCaller" role="option">Awaiting Caller</option>
                    <option value="awaitingVendor" role="option">Awaiting Vendor</option>
                    <option value="awaitingChange" role="option">Awaiting Change</option>

                    <j:if test="${jvar_showUserOffboarding}">
                        <option value="userOffboarding" role="option">User Offboarding</option>
                    </j:if>
                </select>
            </p>
        </div>
2 REPLIES 2

Ankur Bawiskar
Tera Patron

@Shusovit Dutta 

this worked for me.

See this and enhance

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
    <div>
        <g:evaluate jelly="true">
            var messages = {
            'user_offboarding': gs.getMessage('user.offboarding'),
            'awaiting_vendor': gs.getMessage('awaiting.vendor'),
            'awaiting_change': gs.getMessage('awaiting.change'),
            'awaiting_caller': gs.getMessage('awaiting.caller')
            }
        </g:evaluate>
        <select name="onHold" id="onHoldReason" onchange="onHoldChoiceMandatory()" class="form-control">
            <option value="noneValue" role="option">--None--</option>
            <option value="awaitingCaller" role="option">${messages.awaiting_caller}</option>
            <option value="awaitingVendor" role="option">${messages.awaiting_vendor}</option>
            <option value="awaitingChange" role="option">${messages.awaiting_change}</option>
            <option value="userOffboarding" role="option">${messages.user_offboarding}</option>
        </select>
    </div>
</j:jelly>

Messages

56.png

Output: choices shown in French

55.png

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Tanushree Maiti
Giga Sage

Hi @Shusovit Dutta 

 

Here is the post with your solution . Hoe it helps you.

 

https://www.servicenow.com/community/developer-forum/how-to-translate-ui-macro-content/m-p/1368078#:....

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: