How to set Locale for Transformation
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 14
- Joined: Tue Nov 12, 2013 4:26 pm
How to set Locale for Transformation
Post by lostiniceland »
Hello everyone,
I would like to propose DITA for my project and one last thing I'd like to figure out is, how I set the locale for the Dita-OT transformation.
We will have only one language for our publications (which is German) and because that wont change I dont want to put the xml:lang="de_de" Attribute on each and every topic. I tried setting ANT-properties, for example args.dita.locale, on a custom transformation szenario without success.
Can someone please let me know which attribute I have to set? There must be some way, because some articles mention that the OT comes with a lot of languages.
I would like to propose DITA for my project and one last thing I'd like to figure out is, how I set the locale for the Dita-OT transformation.
We will have only one language for our publications (which is German) and because that wont change I dont want to put the xml:lang="de_de" Attribute on each and every topic. I tried setting ANT-properties, for example args.dita.locale, on a custom transformation szenario without success.
Can someone please let me know which attribute I have to set? There must be some way, because some articles mention that the OT comes with a lot of languages.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: How to set Locale for Transformation
Post by sorin_ristache »
Hello,
You should set the locale in the DITA source files by setting the xml:lang attribute at the DITA map level (for example by setting the xml:lang attribute on the root element <map> or <bookmap>), at the topic level (set the attribute on the <topic> or <task> or <concept> element) or even at element level (paragraph, list, table, etc). The closest ancestor with an xml:lang attribute declaration will set the locale for the current element. The DITA processing will fork to the appropriate locale based on the xml:lang declarations in the XML source files.
For example you can set only once, on the <map> element or the <bookmap> element, the attribute xml:lang="de-de" (BTW the correct language value is "de-de", not "de_de", always use a hyphen instead of an underline character), and only override this language setting at the topic level or at the element level, if you need to insert in the same DITA map some topics or elements with content in a different language.
Regards,
Sorin
You should set the locale in the DITA source files by setting the xml:lang attribute at the DITA map level (for example by setting the xml:lang attribute on the root element <map> or <bookmap>), at the topic level (set the attribute on the <topic> or <task> or <concept> element) or even at element level (paragraph, list, table, etc). The closest ancestor with an xml:lang attribute declaration will set the locale for the current element. The DITA processing will fork to the appropriate locale based on the xml:lang declarations in the XML source files.
For example you can set only once, on the <map> element or the <bookmap> element, the attribute xml:lang="de-de" (BTW the correct language value is "de-de", not "de_de", always use a hyphen instead of an underline character), and only override this language setting at the topic level or at the element level, if you need to insert in the same DITA map some topics or elements with content in a different language.
Regards,
Sorin
-
- Posts: 14
- Joined: Tue Nov 12, 2013 4:26 pm
Re: How to set Locale for Transformation
Post by lostiniceland »
Thanks for the quick reply. I indeed tried the attribut at map-level already but with the typo...de_de comes from my Java background 
Still, when I transform to Webhelp I have "Content" instead of "Inhalt" or for reltable-content the output still says "related information". Is this specific for Webhelp? I expected that the translation applies to all scenarios.

Still, when I transform to Webhelp I have "Content" instead of "Inhalt" or for reltable-content the output still says "related information". Is this specific for Webhelp? I expected that the translation applies to all scenarios.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: How to set Locale for Transformation
Post by sorin_ristache »
The title of the Content, Search and Index tabs is always in English because the language is not read correctly from the DITA map file. We will correct this problem in the next version. You can correct it yourself in the current version by replacing the following code on line 166 in file [Oxygen-15.1-install-dir]\frameworks\dita\DITA-OT\plugins\com.oxygenxml.webhelp\build_dita.xml:
with this code:
If the language of a topic is not English you have to set the xml:lang in that topic too. I thought that setting the xml:lang attribute once in the map was enough, but I was wrong
Each topic is assumed by any DITA transformation to contain English text unless otherwise specified by an xml:lang attribute in an XML element of that topic.
Regards,
Sorin
Code: Select all
in="${output.dir}/toc.xml"
Code: Select all
in="${dita.temp.dir}/${user.input.file}"
If the language of a topic is not English you have to set the xml:lang in that topic too. I thought that setting the xml:lang attribute once in the map was enough, but I was wrong

Regards,
Sorin
-
- Posts: 14
- Joined: Tue Nov 12, 2013 4:26 pm
Re: How to set Locale for Transformation
Post by lostiniceland »
Thanks again for your help Sorin.
Everything is as expected now, though I think it is not the best idea to resolve all topics to english when there is no xml:lang. I hope this is only related to the Dita OT and not the standard, so I can file a feature request there.
Well, thanks again.
Everything is as expected now, though I think it is not the best idea to resolve all topics to english when there is no xml:lang. I hope this is only related to the Dita OT and not the standard, so I can file a feature request there.
Well, thanks again.
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Re: How to set Locale for Transformation
Post by sorin_ristache »
It is related to the processor (DITA-OT in our case):
Regards,
Sorin
It is not fixed by the DITA specification but there is a strong recommendation to set the xml:lang attribute in each map and topic:xml:lang
Specifies the language of the element content. When no xml:lang value is supplied, the default value of US English (en-us) is assumed.
If the @xml:lang attribute on the document (outermost) element of a map or of a top-level topic has no value, the processor should assume a default value. The default value of the processor may be either fixed, configurable, or derived from the content itself, such as the @xml:lang attribute on the primary map file. As the default value of a processor may be fixed, it is strongly recommended that the @xml:lang attribute be set on each map and top-level topic.
Regards,
Sorin
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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