docbook-apps

  • 1.  keycap and localized @function

    Posted 03-04-2007 10:50
    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="control" text="Strg"/>
    <l:template name="delete" text="Entf"/>
    <l:template name="down" text="↓"/>
    <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="←"/>
    <l:template name="meta" text="Meta"/>

    <l:template name="other" text="???"/>
    <l:template name="pagedown" text="Bild ↓"/>
    <l:template name="pageup" text="Bild ↑"/>
    <l:template name="right" text="→"/>
    <l:template name="shift" text="Umschalttaste"/>
    <l:template name="space" text="Leertaste"/>
    <l:template name="tab" text="→|"/>
    <l:template name="up" text="↑"/>
    </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



  • 2.  Re: [docbook-apps] keycap and localized @function

    Posted 03-08-2007 17:32
    Hi,

    On Sonntag, 4. März 2007, Thomas Schraitle wrote:
    > [...]

    For the full content see:
    http://lists.oasis-open.org/archives/docbook-apps/200703/msg00026.html


    > What do you think? Does it sound reasonable? :-)

    My question relates to empty keycaps that uses the function attribute,
    like this: <keycap function="control"/> and if we can add a localized
    content under common/...

    I've sent the above mail some days ago and I appreciate any feedback or
    comments. :) Can we add this modification to the stylesheets? Should I
    open a RFE? Any objections?


    Thanks,
    Tom

    --
    Thomas Schraitle