Menu

#431 no way to disable l10n.language

output: all formats
open
nobody
XSL (399)
5
2009-12-21
2009-12-21
No

I like to disable i18n of my docbook xslt. The documents are english api docs, there are no translations and l10n.language is top in the xsltproc --profile output
number match name mode Calls Tot 100us Avg

0 gentext.template 3256 163817 50
1 l10n.language 1984 101624 51
2 chunk 4224 18600 4

On http://docbook.sourceforge.net/release/xsl/current/doc/html/l10n.html I found no way to disable it. Would there an easy way to override it in my customization layer?

Discussion

  • Stefan Sauer

    Stefan Sauer - 2009-12-21
    • summary: no wa to disable l10n.language --> no way to disable l10n.language
    • labels: --> XSL
    • milestone: --> output: all formats
     
  • Stefan Sauer

    Stefan Sauer - 2009-12-21

    I have put this to my customization right now:
    <xsl:template name="l10n.language">
    <xsl:value-of select="en"/>
    </xsl:template>

    and I get a speed-up from 4.4 sec to 3.4 sec!

     
  • Stefan Sauer

    Stefan Sauer - 2009-12-22

    My last comment was nonsense. This override works and brings same speedup.
    <xsl:template name="l10n.language">en</xsl:template>

    Of course it is still translating, which I'd like to avoid.

     
  • Mauritz Jeanson

    Mauritz Jeanson - 2009-12-28

    The "l10n.language" template is called in many places in the stylesheet modules. I suppose that you could replace each call with a simple "en" string if you want to. I cannot think of any other workaround.

     
  • Stefan Sauer

    Stefan Sauer - 2010-01-05

    "gentext.template" is still causing the biggest speed penalty. Hardcoding language to "en" helps. I am now experimenting with a local copy of "gentext.template". I get a little speed up when I disable the lookups on the current document (local.localization.node, local.context.node, local.template.node).

    What I don't get yet is why I do need to keep the parts that lookup from "common/l10n.xml". If I remove those, e.g. my document title disappears. But the title does not contain anything that "common/l10n.xml" could translate.

    I really would like to have a dummy here, that just puts the keys into the document. Any idea?

     
  • Stefan Sauer

    Stefan Sauer - 2010-01-05

    Okay, quite a hack, but much faster:
    <xsl:param name="gtkdoc.l10n.xml" select="document('http://docbook.sourceforge.net/release/xsl/current/common/en.xml')"/>

    <xsl:template name="gentext.template">
    <xsl:param name="context" select="'default'"/>
    <xsl:param name="name" select="'default'"/>
    <xsl:param name="origname" select="$name"/>
    <xsl:param name="verbose" select="1"/>

    <xsl:variable name="context.node"
    select="$gtkdoc.l10n.xml/l:l10n/l:context[@name=$context]"/>

    <xsl:variable name="template.node"
    select="($context.node/l:template[@name=$name])[1]"/>

    <xsl:choose>
    <xsl:when test="$template.node/@text">
    <xsl:value-of select="$template.node/@text"/>
    </xsl:when>
    <xsl:otherwise>
    <xsl:choose>
    <xsl:when test="contains($name, '/')">
    <xsl:call-template name="gentext.template">
    <xsl:with-param name="context" select="$context"/>
    <xsl:with-param name="name" select="substring-after($name, '/')"/>
    <xsl:with-param name="origname" select="$origname"/>
    <xsl:with-param name="verbose" select="$verbose"/>
    </xsl:call-template>
    </xsl:when>
    <xsl:when test="$verbose = 0">
    </xsl:when>
    </xsl:choose>
    </xsl:otherwise>
    </xsl:choose>
    </xsl:template>

     
  • Mauritz Jeanson

    Mauritz Jeanson - 2010-07-28

    Some i18n optimizations have been implemented in the last couple of weeks. Have you tried any recent docbook-xsl snapshot release?