Translation of text in othertype attribute of note element.

Post here questions and problems related to editing and publishing DITA content.
JeeWee
Posts: 4
Joined: Mon Jan 29, 2024 4:25 pm

Translation of text in othertype attribute of note element.

Post by JeeWee »

Hi Team,
For our software we create help files in several languages. The (CSS) transformation scenarios translate predefined texts fine, but for a number of notes we created our own texts and of course no translations for those exist. These notes have attribute 'type' set to 'other' and attribute 'othertype' set to a text of our choice.
Is it possible to add translations for these words, for example in language-specific translation files and if so, how can we achieve that?

Best regards,
Jan Willem
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Translation of text in othertype attribute of note element.

Post by Radu »

Hi Jan,

I added some feedback based on your use case here:
https://github.com/dita-ot/dita-ot/issues/4136
As a workaround I would probably avoid using "othertype", I would set an @outputclass attribute value:

Code: Select all

<note outputclass="myNote">hello</note>
which generates in the HTML something like:

Code: Select all

<div
                                                class="- topic/note note note note_note myNote"
                                                  ><span class="note__title">Note:</span>
                                                hello</div>
allowing you to match the ".my_note > .note__title" in the CSS and maybe change its text.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
JeeWee
Posts: 4
Joined: Mon Jan 29, 2024 4:25 pm

Re: Translation of text in othertype attribute of note element.

Post by JeeWee »

Hi Radu,

Thanks for the quick and clear reply. Too bad that this won't work, although not completely expected as the recommended way to create a custom note variant is to use the othertype attribute as far as I can find in documentation and forum. The biggest advantage of this method is that the text that will appear in the output is the same as the text in the source document. Use of the outputclass loses that advantage.
I will give your suggestion a chance though. Thanks!

Best regards,
Jan Willem
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Translation of text in othertype attribute of note element.

Post by Radu »

Hello Jan,
About this remark:
The biggest advantage of this method is that the text that will appear in the output is the same as the text in the source document.
There is nothing stopping you from using the "othertype" text and asking the translator to also translate its value when you translate your DITA Map's content to various languages. I originally thought you wanted to control this from the CSS.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
JeeWee
Posts: 4
Joined: Mon Jan 29, 2024 4:25 pm

Re: Translation of text in othertype attribute of note element.

Post by JeeWee »

Hi Radu,
Sorry for the confusion, but if I ask the translation agency to translate these texts, what do I need to do to get Oxygen to use these texts in the output of the transformation scenarios?.

Best regards,
Jan Willem
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Translation of text in othertype attribute of note element.

Post by Radu »

Hi Jan,

So in general a company which translates their DITA XML content has a separate folder for each translation language:
https://blog.oxygenxml.com/topics/trans ... lq_cmp_rdb
You have the original "en" folder containing the English content DITA Map and topics, then you send this project to the translator either directly as DITA XML or convert it to XLiff and send it, then the translator provides the French translation which is a separate "fr" folder with the DITA Map and all topics translated to French. And if the topic in French would have its "othertype" text translated, it would show up in the published output when publishing the French DITA Map.

Regards,
RAdu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
JeeWee
Posts: 4
Joined: Mon Jan 29, 2024 4:25 pm

Re: Translation of text in othertype attribute of note element.

Post by JeeWee »

Hi Radu,
thanks for the explanation. However, usually, translation agencies do not translate attributes, only text. The returned translated files then have the othertype values from the English text. For the Note variants ( like tip, caution, warning) the translations are defined in language-specific variable definition files. I was hoping something similar would exist for the othertype definition. Apparently not.
For the next translation round I will ask the agency if they can translate the othertype values, if not I will create a little replace program for it.
I am aware of the XML refactoring tool (I use it to change xml:lang and dir in the returned files). For the currently nine languages (and counting) it is getting a bit much, and I cannot seem to find a way to script an XML refactoring operation, so I think I will write a replace tool anyway.
Thanks for your help,

Best regards,
Jan Willem
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Translation of text in othertype attribute of note element.

Post by Radu »

Hello Jan,
I fully agree with the translators usually skipping attribute values.
This is why in general the DITA XML standard has moved away from using translatable text in attribute values. For example an older DITA standard allowed setting the "alternate" text on an image using the "alt" attribute, then in DITA 1.3 the <alt> element was added as a preferred way (and easier translatable) to set the image's alternate text.
So the fact that the @othertype remains as the only way to set some custom text on a note's title is a small problem in the standard. This is why I would have preferred to specify a key-like value on the othertype like "othertype='myKey'" and then in the CSS to match ".myKey" and set some custom text on it depending also on the current language of the topic.
About XML refactoring operations, we provide a bunch of default operations but you can also implement your own operations using XSLT:
https://www.oxygenxml.com/doc/ug-editor ... tions.html
We have a bunch of already implemented XML refactoring operations here as examples:
https://github.com/oxygenxml/dita-refactoring-examples
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply