[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: DOCBOOK-APPS: Re: Country codes
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
/ jaccoud@petrobras.com.br was heard to say:
| 1) Docbook XML DTD does not declares the xml:lang attribute, so we must use
| lang. I wonder why. (It is not a namespace issue, since none is involved.)
Just an oversight, I suppose. Please file an RFE at SourceForge.
| 2) lang should use ISO 3166 codes, that mandate the form "pt-BR", instead
| of "pt_BR" or "pt_br". Norm confirmed that in
| http://lists.oasis-open.org/archives/docbook/200107/msg00076.html.
|
| 3) The XSL stylesheets process my <article lang="pt-BR"> using the
| common/pt.xml file, which is not correct. "pt_BR" doesn't work either, only
| the value "pt_br" makes it behave correctly. Looks like the atribute value
| must match the filename exactly.
Well, actually pt-br would have worked. Anyway, I've fixed this in CVS.
Try this template:
<xsl:template name="l10n.language">
<xsl:param name="target" select="."/>
<xsl:param name="xref-context" select="false()"/>
<xsl:variable name="mc-language">
<xsl:choose>
<xsl:when test="$l10n.gentext.language != ''">
<xsl:value-of select="$l10n.gentext.language"/>
</xsl:when>
<xsl:when test="$xref-context or $l10n.gentext.use.xref.language != 0">
<!-- can't do this one step: attributes are unordered! -->
<xsl:variable name="lang-scope"
select="($target/ancestor-or-self::*[@lang]
|$target/ancestor-or-self::*[@xml:lang])[last()]"/>
<xsl:variable name="lang-attr"
select="$lang-scope/@lang | $lang-scope/@xml:lang"/>
<xsl:choose>
<xsl:when test="string($lang-attr) = ''">
<xsl:value-of select="$l10n.gentext.default.language"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lang-attr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<!-- can't do this one step: attributes are unordered! -->
<xsl:variable name="lang-scope"
select="(ancestor-or-self::*[@lang]
|ancestor-or-self::*[@xml:lang])[last()]"/>
<xsl:variable name="lang-attr"
select="$lang-scope/@lang | $lang-scope/@xml:lang"/>
<xsl:choose>
<xsl:when test="string($lang-attr) = ''">
<xsl:value-of select="$l10n.gentext.default.language"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$lang-attr"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="language" select="translate($mc-language,
'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
'abcdefghijklmnopqrstuvwxyz')"/>
<xsl:variable name="adjusted.language">
<xsl:choose>
<xsl:when test="contains($language,'-')">
<xsl:value-of select="substring-before($language,'-')"/>
<xsl:text>_</xsl:text>
<xsl:value-of select="substring-after($language,'-')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$language"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$l10n.xml/l:i18n/l:l10n[@language=$adjusted.language]">
<xsl:value-of select="$adjusted.language"/>
</xsl:when>
<!-- try just the lang code without country -->
<xsl:when test="$l10n.xml/l:i18n/l:l10n[@language=substring-before($adjusted.language,'_')]">
<xsl:value-of select="substring-before($adjusted.language,'_')"/>
</xsl:when>
<!-- or use the default -->
<xsl:otherwise>
<xsl:message>
<xsl:text>No localization exists for "</xsl:text>
<xsl:value-of select="$adjusted.language"/>
<xsl:text>" or "</xsl:text>
<xsl:value-of select="substring-before($adjusted.language,'_')"/>
<xsl:text>". Using default "</xsl:text>
<xsl:value-of select="$l10n.gentext.default.language"/>
<xsl:text>".</xsl:text>
</xsl:message>
<xsl:value-of select="$l10n.gentext.default.language"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
| 4) The language specification does not fuind its way into the HTML
| generated code. I thought it would be very nice if it did, so I tried to
| override some templates that generate it, but I would have to translate the
| wrong "pt_br" to the correct "pt-BR" to use it. Not very nice, since it
| should be correct already.
Sigh. That's going to be harder. Where is it supposed to go in the HTML?
Be seeing you,
norm
- --
Norman Walsh <ndw@nwalsh.com> | The future belongs to those who
http://www.oasis-open.org/docbook/ | believe in the beauty of their
Chair, DocBook Technical Committee | dreams.--Eleanor Roosevelt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.7 <http://mailcrypt.sourceforge.net/>
iD8DBQE9pAcWOyltUcwYWjsRAuWgAKCReFakqZ05whi/9B4AJJSNQWgQTQCfUlVT
o3tpc82kLrHQCkFWxGlNMF0=
=1yjR
-----END PGP SIGNATURE-----
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC