[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: keycap and localized @function
Hi,
as far as I know, DocBook have since version 4.3 a function attribut in
keycap. However, it seems it is not supported by the current stylesheets.
For example, if you write <keycap function="control"/> I thought that the
stylesheets fill in the missing content with a localized version.
Unfortunatly, there is no output.
For this reason I would suggest to introduce a new l:context for keycaps
in common/*.xml to support localized keycaps (or whatever is best for
this purpose.) In English the above keycap is resolved to "Ctrl" whereas
for a German keyboard layout it is "Strg".
The modifications involves all localized version under common. For
example, in German you have the following entries:
-------------[ common/de.xml ]
<l:l10n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
language="de"
english-language-name="German">
<!-- ... -->
<l:context name="keycap">
<l:template name="alt" text="Alt"/>
<l:template name="backspace" text="<—"/>
<!-- <l:template name="command" text=""/> -->
<l:template name="control" text="Strg"/>
<l:template name="delete" text="Entf"/>
<l:template name="down" text="↓"/><!-- darr -->
<l:template name="end" text="Ende"/>
<l:template name="enter" text="Eingabetaste"/>
<l:template name="escape" text="Esc"/>
<l:template name="home" text="Pos 1"/>
<l:template name="insert" text="Einfg"/>
<l:template name="left" text="←"/><!-- larr -->
<l:template name="meta" text="Meta"/>
<!-- <l:template name="option" text=""/> -->
<l:template name="other" text="???"/>
<l:template name="pagedown" text="Bild ↓"/>
<l:template name="pageup" text="Bild ↑"/>
<l:template name="right" text="→"/><!-- rarr -->
<l:template name="shift" text="Umschalttaste"/>
<l:template name="space" text="Leertaste"/>
<l:template name="tab" text="→|"/>
<l:template name="up" text="↑"/><!-- uarr -->
</l:context>
</l:l10n>
-------------
Of course, the stylesheet under fo/inline.xsl and {html,xhtml}/inline.xsl
have to be adapated as well. I tested it with the following modification
for HTML:
<xsl:template match="keycap">
<xsl:param name="key.contents" select="."/>
<xsl:variable name="key.length" select="string-length($key.contents)"/>
<xsl:choose>
<xsl:when test="@function and @function!=''">
<xsl:call-template name="inline.boldseq">
<xsl:with-param name="content">
<xsl:call-template name="gentext.template">
<xsl:with-param name="context" select="local-name()"/>
<xsl:with-param name="name" select="@function"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="inline.boldseq"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
What do you think? Does it sound reasonable? :-)
Bye,
Tom
--
Thomas Schraitle
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]