Next in thread → Next in month →

Re: [docbook-apps] gentext: difference between uppper and lower case?

From
Bob Stayton <>
Date
2012-03-23T21:26:26+00:00
ID
21be01cd093b$90440630$6600a8c0@pazu
Thread
Re: [docbook-apps] gentext: difference between uppper and lower case?
Hi Paul,

Over time, the distinction between upper and lower 
case key names for gentext elements has gotten muddled.  The original 
design (from DSSSL days) allowed for both a lower case and an initial cap 
version of each text entry, based on the capitalization of the first letter of 
the key name.  I think the idea was to use the uppercase version in formal 
titles and lowercase elsewhere.

 

But the DSSSL stylesheets themselves never actually 
used the lowercase versions.  Most gentext lookups are based on the 
element name, so to get the uppercase version, it would have to first 
change the first letter of the element name used as a key to uppercase to access 
the text for a title.   At some time before the DSSSL stylesheets were 
ported to XSL, the lowercase text strings for English were all converted to 
uppercase.  From then on, using the "chapter" key would yield "Chapter", 
not "chapter".  This change dates back to at least 2001.

 

But not all locales got that treatment, so some 
still make the distinction, and even worse, some were half-way converted.  
If you look at common/fr.xml, for example, you see inconsistent use of 
capitalization in l:gentext elements.

 

Fortunately, the stylesheets still work for most 
locales because they do not use the <l:gentext> elements much.  Most 
generated text is used in titles and xrefs, and those are handled by the 
<l:context> sections of the locale files, not the <l:gentext> 
elements.  Those context sections have only lowercase key names (to match 
the element name) and use the correct capitalization for the generated 
text.

 

If you are only customizing the 'local.l10n' 
parameter to alter generated text, you only need to supply the lowercase key 
names, because the stylesheet does not make use of the uppercase key names 
(unless your customization does).

 

But if your customization layer uses the template 
named "gentext" from common/l10n.xsl to access the l:gentext elements using a 
lowercase element name as a key, you may get the lowercase text result in 
some locales ("chapter" in fr.xml, for example).  If you uppercase the 
first letter in the key name, you should always get the uppercase text for all 
locales.  If you need a lowercase text string, then that is no longer 
possible across all locales.

 

Fixing all the locale files to use uppercase 
in both l:gentext text strings is a big job, as no one is familiar with all 74 
languages. 

 

Bob Stayton
Sagehill Enterprises


 

 

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

  
From: 
  Paul 
  Tremblay 

  
To: DocBook Apps 

  
Sent: Friday, March 23, 2012 7:33 
AM

  
Subject: [docbook-apps] gentext: 
  difference between uppper and lower case?

  

The customization of titles for the docbook xsl stylesheets 
  requires that one use a key attribute for the following 
  template:
    
<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"> 
  
      <l:l10n language="en"> 
  
          <l:gentext 
  key="glossary" text="Glossary Title"/>
      
  </l:l10n>
    </l:i18n>

However, it is 
  not clear when one should use the upper case for the key, and one should use 
  the lower case. The en.xml file as entries for both. In other words, why not 
  use "Glossary" here (except the obvious that it won't work!).

An online 
  search indicates that the mixture of lower and upper case results because of 
  code from the DSSL that has been kept. 

Thanks

Paul
Next in thread → Next in month →