Get translated labels for a javascript custom action
Having trouble deploying Oxygen XML Web Author? Got a bug to report? Post it all here.
-
- Posts: 98
- Joined: Tue Mar 06, 2018 2:07 pm
- Contact:
Get translated labels for a javascript custom action
Hello,
I created a new action with javascript and I would like to use translated labels for my description.
How can I get, with javascript, the translation (stored in translation.xml) of my description.
In an action created by the UI I can use ${i18n(my.custom.action_description)}
Thanks.
Regards,
Nicolas
I created a new action with javascript and I would like to use translated labels for my description.
Code: Select all
//description
MyCustomAction.prototype.getDescription = function () {
return 'My custom action description'; //not translated for the moment
};
In an action created by the UI I can use ${i18n(my.custom.action_description)}
Thanks.
Regards,
Nicolas
Nicolas Delobel
AmeXio
nicolas.delobel at amexiogroup.com
AmeXio
nicolas.delobel at amexiogroup.com
-
- Posts: 9
- Joined: Mon Sep 21, 2020 5:24 pm
Re: Get translated labels for a javascript custom action
Post by andrei_popa »
Hello,
For your action, you can add the messages to client-side translations[1], before using them.
Here is an example:
You cannot get the client-side messages directly from translation.xml, but you can add them as in the example.
[1] - https://www.oxygenxml.com/maven/com/oxy ... ation.html
For your action, you can add the messages to client-side translations[1], before using them.
Here is an example:
Code: Select all
sync.Translation.addTranslations({
"my.custom.action_description": { 'en_US': 'english string', 'fr_FR': 'french string'... },
});
MyCustomAction.prototype.getDescription = function () {
return tr(msgs["my.custom.action_description"]); //now translated
};
[1] - https://www.oxygenxml.com/maven/com/oxy ... ation.html
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service