[yelp-xsl] domain/check.xsl: Added XSLT to check translations
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp-xsl] domain/check.xsl: Added XSLT to check translations
- Date: Mon, 14 May 2012 17:06:21 +0000 (UTC)
commit e685d731dcf8b4cd842ed149ce907b5118fb647e
Author: Shaun McCance <shaunm gnome org>
Date: Mon May 14 13:06:00 2012 -0400
domain/check.xsl: Added XSLT to check translations
xslt/common/domains/check.xsl | 96 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 96 insertions(+), 0 deletions(-)
---
diff --git a/xslt/common/domains/check.xsl b/xslt/common/domains/check.xsl
new file mode 100644
index 0000000..3d07b6a
--- /dev/null
+++ b/xslt/common/domains/check.xsl
@@ -0,0 +1,96 @@
+<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
+<!--
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; see the file COPYING.LGPL. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:msg="http://projects.gnome.org/yelp/gettext/"
+ xmlns:its="http://www.w3.org/2005/11/its"
+ xmlns:str="http://exslt.org/strings"
+ exclude-result-prefixes="msg str"
+ version="1.0">
+
+<xsl:variable name="xml_out" select="/"/>
+<xsl:variable name="xml_in" select="document('yelp-xsl.xml.in')"/>
+
+<xsl:template match="/">
+ <xsl:for-each select="$xml_in/msg:l10n/msg:msg">
+ <xsl:variable name="msg" select="."/>
+ <xsl:if test="contains(its:locNote, '
<')">
+ <xsl:for-each select="str:split(its:locNote, '
<')[position() != 1]">
+ <xsl:variable name="element" select="substring-before(., '/>')"/>
+ <xsl:for-each select="$xml_out/msg:l10n/msg:msg[ id = $msg/@id]/msg:msgstr">
+ <xsl:if test="not(.//*[local-name(.) = $element])">
+ <xsl:message>
+ <xsl:text>Missing </xsl:text>
+ <xsl:value-of select="$element"/>
+ <xsl:text> in </xsl:text>
+ <xsl:value-of select="@xml:lang"/>
+ <xsl:text> translation of </xsl:text>
+ <xsl:value-of select="$msg/@id"/>
+ <xsl:for-each select="descendant::*">
+ <xsl:text>:</xsl:text>
+ <xsl:value-of select="local-name(.)"/>
+ </xsl:for-each>
+ </xsl:message>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="$msg/@id = 'default:LTR'">
+ <xsl:for-each select="$xml_out/msg:l10n/msg:msg[ id = $msg/@id]/msg:msgstr">
+ <xsl:if test="not(. = 'default:LTR') and not(. = 'default:RTL')">
+ <xsl:message>
+ <xsl:text>Incorrect </xsl:text>
+ <xsl:value-of select="@xml:lang"/>
+ <xsl:text> translation of </xsl:text>
+ <xsl:value-of select="$msg/@id"/>
+ </xsl:message>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="$msg/@id = 'yelp-quote-201C.png'">
+ <xsl:for-each select="$xml_out/msg:l10n/msg:msg[ id = $msg/@id]/msg:msgstr">
+ <xsl:variable name="char" select="substring-before(substring-after(., 'yelp-quote-'), '.png')"/>
+ <xsl:if test="not($char = '201C') and not($char = '201D') and not($char = '201E') and
+ not($char = '00AB') and not($char = '00BB')">
+ <xsl:message>
+ <xsl:text>Incorrect </xsl:text>
+ <xsl:value-of select="@xml:lang"/>
+ <xsl:text> translation of </xsl:text>
+ <xsl:value-of select="$msg/@id"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="."/>
+ </xsl:message>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ <xsl:if test="$msg/@id = 'Other Credits'">
+ <xsl:for-each select="$xml_out/msg:l10n/msg:msg[ id = $msg/@id]/msg:msgstr">
+ <xsl:if test="contains(., '@')">
+ <xsl:message>
+ <xsl:text>Probably incorrect </xsl:text>
+ <xsl:value-of select="@xml:lang"/>
+ <xsl:text> translation of </xsl:text>
+ <xsl:value-of select="$msg/@id"/>
+ </xsl:message>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+</xsl:stylesheet>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]