XML technologies / DocBook / The DocBook XSL stylesheets / Changing localization
(Excerpt from "DocBook-XML: Media-neutral and platform-independent publishing" by Thomas Schraitle)
The DocBook stylesheets are localized, meaning text generated by the stylesheets, such as Kapitel for German books and Chapter for English books, is produced by a template gentext:
<xsl:call-template name="gentext">
<xsl:with-param name="key">chapter</xsl:with-param>
<xsl:with-param name="lang">de</xsl:with-param>
</xsl:call-template>The call above returns the localized German string for the keyword chapter. The language is usually detected automatically rather than specified directly. The DocBook stylesheets support all common languages (see the common directory).
To generate a localized string, the function gentext needs language information. The following methods control the generated text:
Use the language attribute
lang(DocBook 4) orxml:lang(DocBook 5) on a DocBook element. This is the most common way to set a language.The parameter
l10n.gentext.languageoverrides every language attribute. Use it only if the document has no language attribute, an incorrect one, or one unsupported by the stylesheets.The parameter
l10n.gentext.default.languageapplies only to elements without a language attribute. It has no effect if the root element has a language attribute.Customize the generated text using language files.
How does the function gentext know where to look? See Customizing language files; first, however, we examine the simpler options.
Copyright © 2009 Millin Verlag
You may print the online version for your private use.
Otherwise, this chapter from "DocBook-XML: Medienneutrales und plattformunabhängiges Publizieren" is subject to the same provisions as the printed edition: the work, including all its parts, is protected by copyright. All rights are reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Millin Verlag, Siebengebirgsring 36, 53797 Lohmar, info(at)millin.de
back to top