From: <ko...@us...> - 2010-07-14 16:53:57
|
Revision: 8722 http://docbook.svn.sourceforge.net/docbook/?rev=8722&view=rev Author: kosek Date: 2010-07-14 16:53:51 +0000 (Wed, 14 Jul 2010) Log Message: ----------- Refactored localization support. Language files are loaded on demand. Speedup is about 30%. Modified Paths: -------------- trunk/xsl/common/autoidx-kosek.xsl trunk/xsl/common/l10n.dtd trunk/xsl/common/l10n.xml trunk/xsl/common/l10n.xsl Modified: trunk/xsl/common/autoidx-kosek.xsl =================================================================== --- trunk/xsl/common/autoidx-kosek.xsl 2010-07-14 04:50:16 UTC (rev 8721) +++ trunk/xsl/common/autoidx-kosek.xsl 2010-07-14 16:53:51 UTC (rev 8722) @@ -49,7 +49,7 @@ select="($local.l10n.xml//l:i18n/l:l10n[@language=$lang]/l:letters)[1]"/> <xsl:variable name="l10n.letters" - select="($l10n.xml/l:i18n/l:l10n[@language=$lang]/l:letters)[1]"/> + select="document(concat($lang, '.xml'))/l:l10n/l:letters[1]"/> <xsl:choose> <xsl:when test="count($local.l10n.letters) > 0"> @@ -73,7 +73,7 @@ </xsl:choose> </xsl:message> - <xsl:copy-of select="($l10n.xml/l:i18n/l:l10n[@language='en']/l:letters)[1]"/> + <xsl:copy-of select="document('en.xml')/l:l10n/l:letters[1]"/> </xsl:otherwise> </xsl:choose> </xsl:variable> @@ -109,7 +109,7 @@ select="($local.l10n.xml//l:i18n/l:l10n[@language=$lang]/l:letters)[1]"/> <xsl:variable name="l10n.letters" - select="($l10n.xml/l:i18n/l:l10n[@language=$lang]/l:letters)[1]"/> + select="document(concat($lang, '.xml'))/l:l10n/l:letters[1]"/> <xsl:choose> <xsl:when test="count($local.l10n.letters) > 0"> @@ -133,7 +133,7 @@ </xsl:choose> </xsl:message> - <xsl:copy-of select="($l10n.xml/l:i18n/l:l10n[@language='en']/l:letters)[1]"/> + <xsl:copy-of select="document('en.xml')/l:l10n/l:letters[1]"/> </xsl:otherwise> </xsl:choose> </xsl:variable> Modified: trunk/xsl/common/l10n.dtd =================================================================== --- trunk/xsl/common/l10n.dtd 2010-07-14 04:50:16 UTC (rev 8721) +++ trunk/xsl/common/l10n.dtd 2010-07-14 16:53:51 UTC (rev 8722) @@ -23,6 +23,7 @@ %xmlns; CDATA #FIXED %uri; language CDATA #REQUIRED english-language-name CDATA #IMPLIED + href CDATA #IMPLIED > <!ELEMENT %gentext; EMPTY> Modified: trunk/xsl/common/l10n.xml =================================================================== --- trunk/xsl/common/l10n.xml 2010-07-14 04:50:16 UTC (rev 8721) +++ trunk/xsl/common/l10n.xml 2010-07-14 16:53:51 UTC (rev 8722) @@ -1,131 +1,68 @@ <?xml version='1.0'?> -<!DOCTYPE l:i18n SYSTEM "l10n.dtd" [ -<!ENTITY af SYSTEM "af.xml"> -<!ENTITY am SYSTEM "am.xml"> -<!ENTITY ar SYSTEM "ar.xml"> -<!ENTITY az SYSTEM "az.xml"> -<!ENTITY bg SYSTEM "bg.xml"> -<!ENTITY bn SYSTEM "bn.xml"> -<!ENTITY bs SYSTEM "bs.xml"> -<!ENTITY ca SYSTEM "ca.xml"> -<!ENTITY cs SYSTEM "cs.xml"> -<!ENTITY cy SYSTEM "cy.xml"> -<!ENTITY da SYSTEM "da.xml"> -<!ENTITY de SYSTEM "de.xml"> -<!ENTITY el SYSTEM "el.xml"> -<!ENTITY en SYSTEM "en.xml"> -<!ENTITY eo SYSTEM "eo.xml"> -<!ENTITY es SYSTEM "es.xml"> -<!ENTITY et SYSTEM "et.xml"> -<!ENTITY eu SYSTEM "eu.xml"> -<!ENTITY fa SYSTEM "fa.xml"> -<!ENTITY fi SYSTEM "fi.xml"> -<!ENTITY fr SYSTEM "fr.xml"> -<!ENTITY ga SYSTEM "ga.xml"> -<!ENTITY gl SYSTEM "gl.xml"> -<!ENTITY gu SYSTEM "gu.xml"> -<!ENTITY he SYSTEM "he.xml"> -<!ENTITY hi SYSTEM "hi.xml"> -<!ENTITY hr SYSTEM "hr.xml"> -<!ENTITY hu SYSTEM "hu.xml"> -<!ENTITY id SYSTEM "id.xml"> -<!ENTITY it SYSTEM "it.xml"> -<!ENTITY ja SYSTEM "ja.xml"> -<!ENTITY kn SYSTEM "kn.xml"> -<!ENTITY ko SYSTEM "ko.xml"> -<!ENTITY la SYSTEM "la.xml"> -<!ENTITY lit SYSTEM "lt.xml"> -<!ENTITY lv SYSTEM "lv.xml"> -<!ENTITY mn SYSTEM "mn.xml"> -<!ENTITY nl SYSTEM "nl.xml"> -<!ENTITY nn SYSTEM "nn.xml"> -<!ENTITY nb SYSTEM "nb.xml"> -<!ENTITY or SYSTEM "or.xml"> -<!ENTITY pa SYSTEM "pa.xml"> -<!ENTITY pl SYSTEM "pl.xml"> -<!ENTITY pt_br SYSTEM "pt_br.xml"> -<!ENTITY pt SYSTEM "pt.xml"> -<!ENTITY ro SYSTEM "ro.xml"> -<!ENTITY ru SYSTEM "ru.xml"> -<!ENTITY sk SYSTEM "sk.xml"> -<!ENTITY sl SYSTEM "sl.xml"> -<!ENTITY sq SYSTEM "sq.xml"> -<!ENTITY sr_Latn SYSTEM "sr_Latn.xml"> -<!ENTITY sr SYSTEM "sr.xml"> -<!ENTITY sv SYSTEM "sv.xml"> -<!ENTITY ta SYSTEM "ta.xml"> -<!ENTITY th SYSTEM "th.xml"> -<!ENTITY tl SYSTEM "tl.xml"> -<!ENTITY tr SYSTEM "tr.xml"> -<!ENTITY uk SYSTEM "uk.xml"> -<!ENTITY vi SYSTEM "vi.xml"> -<!ENTITY xh SYSTEM "xh.xml"> -<!ENTITY zh SYSTEM "zh.xml"> -<!ENTITY zh_cn SYSTEM "zh_cn.xml"> -<!ENTITY zh_tw SYSTEM "zh_tw.xml"> -]> +<!DOCTYPE l:i18n SYSTEM "l10n.dtd"> <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"> -⁡ -&am; -&ar; -&az; -&bg; -&bn; -&bs; -&ca; -&cs; -&cy; -&da; -&de; -⪙ -&en; -&eo; -&es; -&et; -&eu; -&fa; -&fi; -&fr; -&ga; -≷ -&gu; -&he; -&hi; -&hr; -&hu; -&id; -⁢ -&ja; -&kn; -&ko; -&la; -&lit; -&lv; -&mn; -&nl; -&nn; -&nb; -∨ -&pa; -&pl; -&pt; -&pt_br; -&ro; -&ru; -&sk; -&sl; -&sq; -&sr; -&sr_Latn; -&sv; -&ta; -&th; -&tl; -&tr; -&uk; -&vi; -&xh; -&zh; -&zh_cn; -&zh_tw; -</l:i18n> +<l:l10n language="af" href="af.xml"/> +<l:l10n language="am" href="am.xml"/> +<l:l10n language="ar" href="ar.xml"/> +<l:l10n language="az" href="az.xml"/> +<l:l10n language="bg" href="bg.xml"/> +<l:l10n language="bn" href="bn.xml"/> +<l:l10n language="bs" href="bs.xml"/> +<l:l10n language="ca" href="ca.xml"/> +<l:l10n language="cs" href="cs.xml"/> +<l:l10n language="cy" href="cy.xml"/> +<l:l10n language="da" href="da.xml"/> +<l:l10n language="de" href="de.xml"/> +<l:l10n language="el" href="el.xml"/> +<l:l10n language="en" href="en.xml"/> +<l:l10n language="eo" href="eo.xml"/> +<l:l10n language="es" href="es.xml"/> +<l:l10n language="et" href="et.xml"/> +<l:l10n language="eu" href="eu.xml"/> +<l:l10n language="fa" href="fa.xml"/> +<l:l10n language="fi" href="fi.xml"/> +<l:l10n language="fr" href="fr.xml"/> +<l:l10n language="ga" href="ga.xml"/> +<l:l10n language="gl" href="gl.xml"/> +<l:l10n language="gu" href="gu.xml"/> +<l:l10n language="he" href="he.xml"/> +<l:l10n language="hi" href="hi.xml"/> +<l:l10n language="hr" href="hr.xml"/> +<l:l10n language="hu" href="hu.xml"/> +<l:l10n language="id" href="id.xml"/> +<l:l10n language="it" href="it.xml"/> +<l:l10n language="ja" href="ja.xml"/> +<l:l10n language="kn" href="kn.xml"/> +<l:l10n language="ko" href="ko.xml"/> +<l:l10n language="la" href="la.xml"/> +<l:l10n language="lit" href="lit.xml"/> +<l:l10n language="lv" href="lv.xml"/> +<l:l10n language="mn" href="mn.xml"/> +<l:l10n language="nl" href="nl.xml"/> +<l:l10n language="nn" href="nn.xml"/> +<l:l10n language="nb" href="nb.xml"/> +<l:l10n language="or" href="or.xml"/> +<l:l10n language="pa" href="pa.xml"/> +<l:l10n language="pl" href="pl.xml"/> +<l:l10n language="pt" href="pt.xml"/> +<l:l10n language="pt_br" href="pt_br.xml"/> +<l:l10n language="ro" href="ro.xml"/> +<l:l10n language="ru" href="ru.xml"/> +<l:l10n language="sk" href="sk.xml"/> +<l:l10n language="sl" href="sl.xml"/> +<l:l10n language="sq" href="sq.xml"/> +<l:l10n language="sr" href="sr.xml"/> +<l:l10n language="sr_latn" href="sr_Latn.xml"/> +<l:l10n language="sv" href="sv.xml"/> +<l:l10n language="ta" href="ta.xml"/> +<l:l10n language="th" href="th.xml"/> +<l:l10n language="tl" href="tl.xml"/> +<l:l10n language="tr" href="tr.xml"/> +<l:l10n language="uk" href="uk.xml"/> +<l:l10n language="vi" href="vi.xml"/> +<l:l10n language="xh" href="xh.xml"/> +<l:l10n language="zh" href="zh.xml"/> +<l:l10n language="zh_cn" href="zh_cn.xml"/> +<l:l10n language="zh_tw" href="zh_tw.xml"/> +<l:l10n language="/l" href="/l.xml"/> +</l:i18n> \ No newline at end of file Modified: trunk/xsl/common/l10n.xsl =================================================================== --- trunk/xsl/common/l10n.xsl 2010-07-14 04:50:16 UTC (rev 8721) +++ trunk/xsl/common/l10n.xsl 2010-07-14 16:53:51 UTC (rev 8722) @@ -19,9 +19,9 @@ <xsl:param name="local.l10n.xml" select="document('')"/> <xsl:key name="l10n-lang" match="l:l10n" use="@language"/> -<xsl:key name="l10n-gentext" match="l:l10n/l:gentext" use="concat(../@language, '#', @key)"/> -<xsl:key name="l10n-dingbat" match="l:l10n/l:dingbat" use="concat(../@language, '#', @key)"/> -<xsl:key name="l10n-context" match="l:l10n/l:context" use="concat(../@language, '#', @name)"/> +<xsl:key name="l10n-gentext" match="l:l10n/l:gentext" use="@key"/> +<xsl:key name="l10n-dingbat" match="l:l10n/l:dingbat" use="@key"/> +<xsl:key name="l10n-context" match="l:l10n/l:context" use="@name"/> <xsl:template name="l10n.language"> <xsl:param name="target" select="."/> @@ -113,12 +113,12 @@ </xsl:for-each> </xsl:template> -<xsl:template name="l10.language.name"> +<xsl:template name="l10n.language.name"> <xsl:param name="lang"> <xsl:call-template name="l10n.language"/> </xsl:param> <xsl:value-of - select="$l10n.xml/l:i18n/l:l10n[@language=$lang]/@english-language-name"/> + select="document(concat($l10n.xml/l:i18n/l:l10n[@language=$lang]/@href, '.xml'))/l:l10n/@english-language-name"/> </xsl:template> <xsl:template name="language.attribute"> @@ -221,12 +221,12 @@ <xsl:call-template name="l10n.language"/> </xsl:param> - <xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work --> + <xsl:for-each select="document(concat($lang, '.xml'))"> <!-- We need to switch context in order to make key() work --> <xsl:variable name="local.l10n.gentext" select="($local.l10n.xml//l:i18n/l:l10n[@language=$lang]/l:gentext[@key=$key])[1]"/> <xsl:variable name="l10n.gentext" - select="key('l10n-gentext', concat($lang, '#', $key))[1]"/> + select="key('l10n-gentext', $key)[1]"/> <xsl:choose> <xsl:when test="$local.l10n.gentext"> @@ -252,7 +252,9 @@ </xsl:choose> </xsl:message> - <xsl:value-of select="key('l10n-gentext', concat('en', '#', $key))[1]/@text"/> + <xsl:for-each select="document('en.xml')"> <!-- We need to switch context in order to make key() work --> + <xsl:value-of select="key('l10n-gentext', $key)[1]/@text"/> + </xsl:for-each> </xsl:otherwise> </xsl:choose> </xsl:for-each> @@ -292,12 +294,12 @@ <xsl:call-template name="l10n.language"/> </xsl:param> - <xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work --> + <xsl:for-each select="document(concat($lang, '.xml'))"> <!-- We need to switch context in order to make key() work --> <xsl:variable name="local.l10n.dingbat" select="($local.l10n.xml//l:i18n/l:l10n[@language=$lang]/l:dingbat[@key=$dingbat])[1]"/> <xsl:variable name="l10n.dingbat" - select="key('l10n-dingbat', concat($lang, '#', $dingbat))[1]"/> + select="key('l10n-dingbat', $dingbat)[1]"/> <xsl:choose> <xsl:when test="$local.l10n.dingbat"> @@ -314,8 +316,10 @@ <xsl:value-of select="$dingbat"/> <xsl:text> exists; using "en".</xsl:text> </xsl:message> - - <xsl:value-of select="key('l10n-dingbat', concat('en', '#', $dingbat))[1]/@text"/> + + <xsl:for-each select="document('en.xml')"> <!-- We need to switch context in order to make key() work --> + <xsl:value-of select="key('l10n-dingbat', $dingbat)[1]/@text"/> + </xsl:for-each> </xsl:otherwise> </xsl:choose> </xsl:for-each> @@ -383,7 +387,7 @@ </xsl:param> <xsl:param name="verbose" select="1"/> - <xsl:for-each select="$l10n.xml"> <!-- We need to switch context in order to make key() work --> + <xsl:for-each select="document(concat($lang, '.xml'))"> <!-- We need to switch context in order to make key() work --> <xsl:variable name="local.localization.node" select="($local.l10n.xml//l:i18n/l:l10n[@language=$lang])[1]"/> @@ -405,7 +409,7 @@ select="$local.localization.node/l:context[@name=$context]"/> <xsl:variable name="context.node" - select="key('l10n-context', concat($lang, '#', $context))[1]"/> + select="key('l10n-context', $context)[1]"/> <xsl:if test="count($context.node) = 0 and count($local.context.node) = 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |