You need a general solution to add localized text without hard-coding it into your stylesheet. Depending on the language, it should display the correct, translated text.
Use language files to add your text.
Language files are the DocBook way to support several languages,
all located under the common
directory. Each file is in XML format and
contains all your translated text as a key/value pair. For more
complex settings and to group things, there are
contexts. The key is never translated, it is
a constant and is only needed to find and retrieve the translated text.
To use a language file, proceed as follows:
The “gentext” method to insert language specific
text is quite powerful, but not almighty. It helps you to keep
translatable text in one place and avoids hard-coded locations in
your stylesheets. If you need the translated text not for the
default language (usually marked in the root element), but for a
different language, use the xsl:with-param
as
shown:
<xsl:call-template name="gentext"> <xsl:with-param name="key" select="'Authors'"/> <xsl:with-param name="lang">de</xsl:with-param> </xsl:call-template>
Project@GitHub | Issue#7 |