Skip to main content
hadih26673991
Inspiring
December 2, 2020
Answered

DITA template language

  • December 2, 2020
  • 2 replies
  • 1506 views

Is it possible to change the language of the DITA templates for all the defined styles at once?

The way I do it now is a bit slow: I go to paragraph designer-->Font-->Select a style-->Set language.

This means I have to repeat it for all the styles that I may use. I would rather change the language for the whole template.

This topic has been closed for replies.
Correct answer 4everJang

Although StudioSm gives an answer that works, the better way is of course to use the xml:lang attribute in your DITA files to determine the language settings in the documents. To do this you should look at the attribute in the root element and set your language as ContextRule in the TextFormatRules for that root element. There is a small difficulty to overcome, though. The EDD uses a colon in attribute references to allow pointing at an attribute of a parent element. The DITA xml:lang attribute is using the colon to indicate the XML namespace.

To overcome this issue, you should rename the xml:lang attribute in your DITA template's EDD to lang and add a read-write rule that translates between the xml:lang in the DITA file and lang in your FrameMaker EDD. It is a bit of work, but if you work in an environment where multiple languages are used (which is the majority of tech docs I guess), you will have to use this to allow translations with correct language settings. The only other option you would have is to create one set of templates for each different language - and you would have to quit FM, swap out the templates and restart FM every time you want to work on (or publish) DITA materials in another language.

So, if you are (going to) work in multiple languages, I suggest biting the bullet and doing it the proper way.

2 replies

4everJang
4everJangCorrect answer
Brainiac
December 7, 2020

Although StudioSm gives an answer that works, the better way is of course to use the xml:lang attribute in your DITA files to determine the language settings in the documents. To do this you should look at the attribute in the root element and set your language as ContextRule in the TextFormatRules for that root element. There is a small difficulty to overcome, though. The EDD uses a colon in attribute references to allow pointing at an attribute of a parent element. The DITA xml:lang attribute is using the colon to indicate the XML namespace.

To overcome this issue, you should rename the xml:lang attribute in your DITA template's EDD to lang and add a read-write rule that translates between the xml:lang in the DITA file and lang in your FrameMaker EDD. It is a bit of work, but if you work in an environment where multiple languages are used (which is the majority of tech docs I guess), you will have to use this to allow translations with correct language settings. The only other option you would have is to create one set of templates for each different language - and you would have to quit FM, swap out the templates and restart FM every time you want to work on (or publish) DITA materials in another language.

So, if you are (going to) work in multiple languages, I suggest biting the bullet and doing it the proper way.

Community Manager
December 7, 2020

Hi Jang,

 

maybe I missunderstood something, but xml:lang works fine for me in ContextRules:

 

<TextFormatRules>
  <ContextRule>
     <If>
        <Specification>[xml:lang = "en-US"]</Specification>
        <ParagraphFormatting>
           <PropertiesFont>
              <Language>
                 <USEnglish/>
              </Language>
           </PropertiesFont>
        </ParagraphFormatting>
     </If>
     <ElseIf>
        <Specification>[xml:lang = "de-DE"]</Specification>
        <ParagraphFormatting>
           <PropertiesFont>
              <Language>
                 <DeutschNeu/>
              </Language>
           </PropertiesFont>
        </ParagraphFormatting>
     </ElseIf>
  </ContextRule>
</TextFormatRules>

 

This way, I can set the xml:lang attribute to en-US or de-DE for an element and then FM changes the paragraf language accordingly. Changing xml:lang from string to choice and adding language codes also makes it nicely selectable for the user in the attibute panel.

 

Kind regards,

Stefan

4everJang
Brainiac
December 7, 2020

Hello Stefan,

You are of course right. I was confused with the definition of variables as well as prefixes and suffixes that use attribute values. These definitions use a colon to point to an attribute on an ancestor, which means that a colon as part of an attribute name does not work at all. So if you have any variables, prefixes and/or suffixes you would like to make language-dependent, you should still use my workaround for the @xml:lang - which effectively renames the attribute to @9343468 without hurting the DITA validation rules.

Now that we are discussing language settings via the @xml:lang, I do need to add that the language settings are inherited in all elements EXCEPT table cells. It seems that every single entry in a table has to explicitly set the language to make it use the proper dictionary and hyphenation rules. I tried setting the attribute on the <tgroup> but that does not work either. It is a long-overlooked omission in the application of EDD text format rules.

Kind regards

Jang

Adobe Expert
December 2, 2020

Hi hadih26673991,

 

I have only very limited experience with DITA. In unstructured FrameMaker you can just selected all paragraphs (CTRL+A) and then change the language in the Paragraph Designer and click Update Style (or click on the small gear in the lower left corner of the dialog). FrameMaker opens the Global Update Options dialog. There select Default Font Properties Only and All Matching Tags in Selection and click Update. Then FrameMaker updates only the languages.

 

Best regards

 

Winfried

hadih26673991
Inspiring
December 2, 2020

Hi Winfried,

Thanky for fast reply. I can access the gear for global update options, but it does not give me the option to set the language globally. I still have to select a style.

Adobe Expert
December 2, 2020

Hi,

 

You have to make your changes (language) in the Paragraph Designer first. Then select the Global Update Options.

The language is part of the font properties.

 

Best regards

 

Winfried