summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2012-01-18 10:54:42 -0500
committerShaun McCance <shaunm@gnome.org>2012-01-18 10:54:42 -0500
commit7804e1f5b946d4a31dd0d939573710eba2cf2ada (patch)
treeac198fcecb0476a241326a02bd97a98198eeb4c8
parente443f53b562251718b379c9c5c86f2c92fe23514 (diff)
downloadyelp-7804e1f5b946d4a31dd0d939573710eba2cf2ada.tar.gz
Provide xslt translation domain for install link text
-rw-r--r--configure.ac8
-rw-r--r--data/Makefile.am2
-rw-r--r--data/domains/Makefile.am31
-rw-r--r--data/domains/msgs.xsl43
-rw-r--r--data/domains/yelp.pot24
-rw-r--r--data/domains/yelp.xml.in32
-rw-r--r--data/xslt/Makefile.am2
-rw-r--r--data/xslt/info2html.xsl.in1
-rw-r--r--data/xslt/mal2html.xsl.in18
-rw-r--r--data/xslt/man2html.xsl.in1
-rw-r--r--po/POTFILES.in1
11 files changed, 152 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index f6dec399..4f72a778 100644
--- a/configure.ac
+++ b/configure.ac
@@ -70,6 +70,11 @@ AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
[The gettext translation domain])
+AC_ARG_VAR([ITSTOOL], [Path to the `itstool` command])
+AC_CHECK_PROG([ITSTOOL], [itstool], [itstool])
+if test x"$ITSTOOL" = x; then
+ AC_MSG_ERROR([itstool is required to build the translation XML files])
+fi
LIBLZMA_REQUIRED=4.9
AC_ARG_ENABLE(lzma,
@@ -141,6 +146,8 @@ AC_SUBST(XSL_JSDIR)
XSL_GETTEXT="`$PKG_CONFIG --variable=gettext yelp-xsl`"
AC_SUBST(XSL_GETTEXT)
+XSL_DOMAINS="`$PKG_CONFIG --variable=domains yelp-xsl`"
+AC_SUBST(XSL_DOMAINS)
YELP_ICON_PATH="`$PKG_CONFIG --variable=icondir yelp-xsl`"
AC_SUBST(YELP_ICON_PATH)
@@ -198,6 +205,7 @@ docs/libyelp/version.xml
libyelp/Makefile
src/Makefile
data/Makefile
+data/domains/Makefile
data/dtd/Makefile
data/dtd/catalog
data/icons/Makefile
diff --git a/data/Makefile.am b/data/Makefile.am
index 68924495..bc0bdc2b 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = dtd icons xslt
+SUBDIRS = domains dtd icons xslt
#This has to be defined, because GSETTINGS_CHECK_RULE adds to it
MOSTLYCLEANFILES =
diff --git a/data/domains/Makefile.am b/data/domains/Makefile.am
new file mode 100644
index 00000000..9c532392
--- /dev/null
+++ b/data/domains/Makefile.am
@@ -0,0 +1,31 @@
+ALL_LINGUAS = @ALL_LINGUAS@
+
+$(srcdir)/yelp.pot: yelp.xml.in
+ itstool -o "$@" yelp.xml.in
+
+all: $(srcdir)/yelp.pot
+
+yelp.xml: yelp.xml.in
+ @echo " GEN $@"; \
+ if [ ! -d .yelp ]; then mkdir .yelp; fi; \
+ echo '<files>' > ".yelp.files"; \
+ echo '<source href="yelp.xml.in"/>' >> ".yelp.files"; \
+ for lang in $(ALL_LINGUAS); do \
+ msgfmt -o ".yelp/$$lang.mo" "$(top_srcdir)/po/$$lang.po" || exit 1; \
+ (cd .yelp && itstool -o "$$lang.xml" -m "$$lang.mo" "../yelp.xml.in") || exit 1; \
+ rm ".yelp/$$lang.mo" || exit 1; \
+ echo '<file href="'".yelp/$$lang.xml"'"/>' >> ".yelp.files"; \
+ done; \
+ echo '</files>' >> ".yelp.files"; \
+ xsltproc -o "$@" "msgs.xsl" ".yelp.files" || exit 1; \
+ for lang in $(ALL_LINGUAS); do rm ".yelp/$$lang.xml"; done; \
+ rmdir .yelp; \
+ rm .yelp.files
+
+xsldir=${XSL_DOMAINS}
+
+xsl_DATA = yelp.xml
+
+EXTRA_DIST = yelp.xml yelp.xml.in
+
+CLEANFILES = yelp.xml yelp.pot
diff --git a/data/domains/msgs.xsl b/data/domains/msgs.xsl
new file mode 100644
index 00000000..d0d9a3be
--- /dev/null
+++ b/data/domains/msgs.xsl
@@ -0,0 +1,43 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:msg="http://projects.gnome.org/yelp/gettext/"
+ xmlns="http://projects.gnome.org/yelp/gettext/"
+ version="1.0">
+
+<xsl:output method="xml" encoding="UTF-8"/>
+
+<xsl:variable name="source" select="document(/files/source/@href)"/>
+<xsl:variable name="files" select="/files/file"/>
+
+<xsl:key name="id.key" match="msg:msg" use="@id"/>
+
+<xsl:template match="/files">
+ <msg:l10n>
+ <xsl:apply-templates select="$source/msg:l10n/msg:msg"/>
+ </msg:l10n>
+</xsl:template>
+
+<xsl:template match="msg:msg">
+ <xsl:variable name="id" select="@id"/>
+ <msg:msg id="{$id}">
+ <msg:msgstr xml:lang="C">
+ <xsl:for-each select="msg:msgstr/node()">
+ <xsl:copy/>
+ </xsl:for-each>
+ </msg:msgstr>
+ <xsl:for-each select="$files">
+ <xsl:for-each select="document(@href)/*">
+ <xsl:variable name="lang" select="@xml:lang"/>
+ <xsl:for-each select="key('id.key', $id)[1]">
+ <msg:msgstr xml:lang="{$lang}">
+ <xsl:for-each select="msg:msgstr/node()">
+ <xsl:copy/>
+ </xsl:for-each>
+ </msg:msgstr>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:for-each>
+ </msg:msg>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/data/domains/yelp.pot b/data/domains/yelp.pot
new file mode 100644
index 00000000..f988f848
--- /dev/null
+++ b/data/domains/yelp.pot
@@ -0,0 +1,24 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2012-01-18 10:49-0500\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. ID: install.tooltip
+#. This is a format message used to format tooltips on install: links. These
+#. links allow users to install packages by clicking a link in the help. The
+#. tooltip may also be used as the link text, if there's no link text in the
+#. document. Special elements in the message will be replaced with the
+#. appropriate content, as follows:
+#.
+#. <string/> - The package to install
+#.
+#: yelp.xml.in:29(msg/msgstr)
+msgid "Install <string/>"
+msgstr ""
+
diff --git a/data/domains/yelp.xml.in b/data/domains/yelp.xml.in
new file mode 100644
index 00000000..dc94dbe2
--- /dev/null
+++ b/data/domains/yelp.xml.in
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?><!-- -*- indent-tabs-mode: nil -*- -->
+
+<l10n xmlns="http://projects.gnome.org/yelp/gettext/"
+ xmlns:msg="http://projects.gnome.org/yelp/gettext/"
+ xmlns:its="http://www.w3.org/2005/11/its"
+ xmlns:itst="http://itstool.org/extensions/">
+
+<its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
+ <its:langRule selector="//*" langPointer="@xml:lang"/>
+
+ <its:translateRule selector="/msg:l10n/msg:msg/msg:msgstr" translate="yes"/>
+ <its:withinTextRule selector="/msg:l10n/msg:msg/msg:msgstr//*" withinText="yes"/>
+
+ <itst:preserveSpaceRule selector="/msg:l10n/msg:msg/its:locNote" preserveSpace="yes"/>
+ <its:locNoteRule selector="/msg:l10n/msg:msg/msg:msgstr" locNotePointer="../its:locNote"/>
+</its:rules>
+
+<msg id="install.tooltip">
+<its:locNote>
+ID: install.tooltip
+This is a format message used to format tooltips on install: links. These
+links allow users to install packages by clicking a link in the help. The
+tooltip may also be used as the link text, if there's no link text in the
+document. Special elements in the message will be replaced with the
+appropriate content, as follows:
+
+&lt;string/> - The package to install
+</its:locNote>
+<msgstr>Install <string/></msgstr>
+</msg>
+
+</l10n>
diff --git a/data/xslt/Makefile.am b/data/xslt/Makefile.am
index e46ebabe..6afa2326 100644
--- a/data/xslt/Makefile.am
+++ b/data/xslt/Makefile.am
@@ -1,5 +1,3 @@
-@INTLTOOL_XML_RULE@
-
xsldir=$(datadir)/yelp/xslt
xsl_DATA = \
diff --git a/data/xslt/info2html.xsl.in b/data/xslt/info2html.xsl.in
index a97b054f..3a51686f 100644
--- a/data/xslt/info2html.xsl.in
+++ b/data/xslt/info2html.xsl.in
@@ -6,7 +6,6 @@
extension-element-prefixes="yelp"
version="1.0">
-<xsl:import href="@XSL_GETTEXT@"/>
<xsl:import href="@XSL_COLOR@"/>
<xsl:import href="@XSL_ICONS@"/>
<xsl:import href="@XSL_HTML@"/>
diff --git a/data/xslt/mal2html.xsl.in b/data/xslt/mal2html.xsl.in
index efe8a7ad..6118bf93 100644
--- a/data/xslt/mal2html.xsl.in
+++ b/data/xslt/mal2html.xsl.in
@@ -42,9 +42,12 @@
<xsl:param name="xref" select="$node/@xref"/>
<xsl:choose>
<xsl:when test="starts-with($action, 'install:')">
- <!-- FIXME: i18n -->
- <xsl:text>INSTALL </xsl:text>
- <xsl:value-of select="substring($action, 9)"/>
+ <xsl:call-template name="l10n.gettext">
+ <xsl:with-param name="domain" select="'yelp'"/>
+ <xsl:with-param name="msgid" select="'install.tooltip'"/>
+ <xsl:with-param name="string" select="substring($action, 9)"/>
+ <xsl:with-param name="format" select="true()"/>
+ </xsl:call-template>
</xsl:when>
<xsl:when test="starts-with($xref, 'ghelp:') or starts-with($xref, 'help:')">
<xsl:value-of select="$xref"/>
@@ -58,9 +61,12 @@
<xsl:param name="xref" select="$node/@xref"/>
<xsl:choose>
<xsl:when test="starts-with($action, 'install:')">
- <!-- FIXME: i18n -->
- <xsl:text>INSTALL </xsl:text>
- <xsl:value-of select="substring($action, 9)"/>
+ <xsl:call-template name="l10n.gettext">
+ <xsl:with-param name="domain" select="'yelp'"/>
+ <xsl:with-param name="msgid" select="'install.tooltip'"/>
+ <xsl:with-param name="string" select="substring($action, 9)"/>
+ <xsl:with-param name="format" select="true()"/>
+ </xsl:call-template>
</xsl:when>
<xsl:when test="starts-with($xref, 'ghelp:') or starts-with($xref, 'help:')">
<xsl:value-of select="$xref"/>
diff --git a/data/xslt/man2html.xsl.in b/data/xslt/man2html.xsl.in
index a9907b9d..12a0160a 100644
--- a/data/xslt/man2html.xsl.in
+++ b/data/xslt/man2html.xsl.in
@@ -6,7 +6,6 @@
extension-element-prefixes="yelp"
version="1.0">
-<xsl:import href="@XSL_GETTEXT@"/>
<xsl:import href="@XSL_COLOR@"/>
<xsl:import href="@XSL_ICONS@"/>
<xsl:import href="@XSL_HTML@"/>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 857f8d8f..fec0dae7 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,7 @@
# Add files with translateable strings here.
# Please keep this file sorted alphabetically.
[encoding: UTF-8]
+data/domains/yelp.pot
libyelp/yelp-bz2-decompressor.c
libyelp/yelp-debug.c
libyelp/yelp-docbook-document.c