Using xml:lang attributes to switch content?

<oXygen/> general issues.
piwiaus
Posts: 8

Using xml:lang attributes to switch content?

Tue Mar 08, 2016 9:54 am

I may have painted my company into a corner. Any help for a way out? oXygen 17.1, transforming to WebHelp.

In EN, we have made extensive use of <keywords> (because we have many standard terms, and they also get revised pretty often). We have a big file listing all the keywords, included as a mapref in each ditamap as required. Works great for English.

Now we are localizing. Worse, we are *partially* localizing, since the budget doesn't allow the whole help system at once. So imagine we have two topics, topicA and topicB, and that both include a <keyword keyref="adopt"/> embedded in their content. At launch time, only topicA will be localized, and topicB will be published in English. The desired outcome is that <keyword keyref="adopt"/> would output localized text in topicA and English in topic B.

I had hoped it might work like this:
(1) In the file of keywords, define localized variations:

Code: Select all

<keydef keys="adopt">
    <topicmeta>
      <keywords>
        <keyword xml:lang="en">Adopted</keyword>
        <keyword xml:lang="de">Angenommen</keyword>
      </keywords>
    </topicmeta>
  </keydef>


(2) Add the language attribute to the topics:

Code: Select all

  <task id="task_topicA" xml:lang="de"> ...

and

Code: Select all

  <task id="task_topicB" xml:lang="en">


I rather hoped that Author view for topicA would now include the "Angenommen" value, based on the language attribute switching the choice of keywords to a definition with the matching language attribute. But it does not (unless, perhaps, it would change the output values after a transformation?? But I expect not...).

So, is there any way to achieve the desired goal of these "text variables" in our keywords being published in different languages based on the xml:lang attribute of each topic? Or any other ideas? Or am I just plain busted?

Thanks in advance
Radu
Posts: 5216

Re: Using xml:lang attributes to switch content?

Tue Mar 08, 2016 10:14 am

Hi Peter,

The xml:lang attribute is not a profiling attribute. So the DITA Open Toolkit publishing process cannot filter content based on it.
The attribute is used in various outputs to control translations for various static labels which appear in the published content (Tabel: or Figure: for example) or to control what fonts are used in the PDF output.
So not sure what the best approach would be for your case. Usually the entire DITA Map project gets translated and the translation is kept in sync with the original content.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
piwiaus
Posts: 8

Re: Using xml:lang attributes to switch content?

Tue Mar 08, 2016 10:56 am

I feared as much. Thans for the very prompt reply, Radu.

Return to “Other Issues”

Who is online

Users browsing this forum: No registered users and 1 guest