We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

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>
3 REPLIES 3

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

@Shusovit Dutta 

Hope you are doing good.

Did my reply answer your question?

💡 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
Tera Patron

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 Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti