Re: [docbook] Localization

From
Bob Stayton <>
Date
2010-11-02T16:58:09+00:00
ID
020f01cb7aaf$158ba590$6600a8c0@pazu
Thread
Re: [docbook] Localization
Hi Klaus,

Regarding the lang attribute name, if you want 
valid DocBook documents you would use the attribute named lang for DocBook 
version 4 documents, and xml:lang for DocBook version 5 documents.  

 

Regarding the value of "de" versus "DE_DE", you may 
also see examples using "de-de", "de_DE", and other variants.  I'm not 
clear that there is a single standard that everyone is to adhere to, which has 
led to the "too much flexibility" problem you mention.

 

So the XSL stylesheets are written to handle all 
the variants.  The stylesheets take the value of either the lang 
or xml:lang attribute, convert it to lowercase, change any dash to underscore, 
and looks for a best match in the collection of languages supported by DocBook 
XSL.  The final match comes down to a locale name in the "common" directory 
of the XSL stylesheet distribution.  There you will find a file named 
'de.xml' with a language="de" attribute.  Since DocBook XSL does not have 
support for country variants of German, there is a single German locale 
file.  So the minimum match for lang would be "de".  If you are using 
Chinese, you would need to use either "zh_cn" or "zh_tw".

 

The complete list of supported locales in a DocBook 
distribution is in common/l10n.xml (that's .xml, not .xsl), which looks like 
this:

 

<!ENTITY af SYSTEM "af.xml">
<!ENTITY 
am SYSTEM "am.xml">
<!ENTITY ar SYSTEM "ar.xml">
<!ENTITY az 
SYSTEM "az.xml">
<!ENTITY bg SYSTEM "bg.xml">

Strictly speaking, the stylesheet actually looks 
for a match on the value of the "language" attribute in those locale files, but 
the locale filenames match that attribute value in all cases, so you can use the 
list of filenames in that file as a reference.

 

Hope this helps.

 

Bob Stayton
Sagehill Enterprises


 

 

  
----- Original Message ----- 

  
From: 
  Klaus 
  Jantzen 

  
To: Bob Stayton ; docBook 

  
Sent: Sunday, October 31, 2010 12:37 
  PM

  
Subject: Re: [docbook] Localization

  

Bob Stayton wrote: 
  Hi 
    Klaus, 
I think you have misunderstood that example.  That was a 
    snippet from a DocBook XSL localization file, not something to insert in 
    your file.  If you want to declare a document to be German, you would 
    add a lang="DE_DE" attribute to the root element of your document (or 
    xml:lang if using DocBook 5).  Then the stylesheet will process it with 
    German generated text.  If I have misunderstood your intentions, let me 
    know. 

Bob Stayton 
Sagehill Enterprises 
 

----- 
    Original Message ----- From: "Klaus Jantzen" <> 
    
To: "docBook" <> 
    
Sent: Friday, October 29, 2010 12:20 AM 
Subject: [docbook] 
    Localization 

    Hi, 

according to the example on page 334 
      of "DocBook XSL" I insert the following lines in my file 
      

<l:l10n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0" 
      
       language="de" 
      
       
      english-language-name="German"> 

Processing the file with 
      xsltproc under Debian lenny I get the following message 
      

xxx.dbk:154: parser error : Premature end of data in tag l10n line 
      17 

What is missing ? 
Where can I find the documentation for 
      this tag? 

Thanks. 
-- 
KDJ. 
      

--------------------------------------------------------------------- 
      
To unsubscribe, e-mail:  
      
For additional commands, e-mail:  
      

Hi 
  Bob,

thank you very much for your help.
I did what you suggested and 
  it works.

And with that my problems start.
You suggested 
  >lang="DE_DE"<, in one of the books[1][2] it says >lang="de"< and 
  somewhere it 
says >xml:lang="de"< .
Now I have three notations 
  and each works. So what is the "correct" notation?
Flexibility is nice but 
  too much flexibility confuses.

At the moment I am somewhat confused as 
  to where I have to look for information: [1] or [2] in case I
am 
  stuck.

A ray of hope: in the mean time I am able to successfully use a 
  catalog: mainly due to the complete example in [2].

Thanks 
  again.

[1] DocBook 5 The Definitive Guide
[2] DocBook XSL 4th 
  Edition

  
-- 

  
  KDJ.
--------------------------------------------------------------------- 
  To unsubscribe, e-mail:  For 
  additional commands, e-mail: