| 1 |
<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- --> |
| 2 |
<!-- |
| 3 |
This program is free software; you can redistribute it and/or modify it under |
| 4 |
the terms of the GNU Lesser General Public License as published by the Free |
| 5 |
Software Foundation; either version 2 of the License, or (at your option) any |
| 6 |
later version. |
| 7 |
|
| 8 |
This program is distributed in the hope that it will be useful, but WITHOUT |
| 9 |
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 10 |
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
| 11 |
details. |
| 12 |
|
| 13 |
You should have received a copy of the GNU Lesser General Public License |
| 14 |
along with this program; see the file COPYING.LGPL. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
--> |
| 16 |
|
| 17 |
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
| 18 |
xmlns:msg="http://projects.gnome.org/yelp/gettext/" |
| 19 |
xmlns:its="http://www.w3.org/2005/11/its" |
| 20 |
xmlns:str="http://exslt.org/strings" |
| 21 |
exclude-result-prefixes="msg str" |
| 22 |
version="1.0"> |
| 23 |
|
| 24 |
<xsl:variable name="xml_out" select="/"/> |
| 25 |
<xsl:variable name="xml_in" select="document('yelp-xsl.xml.in')"/> |
| 26 |
|
| 27 |
<xsl:template match="/"> |
| 28 |
<xsl:for-each select="$xml_in/msg:l10n/msg:msg"> |
| 29 |
<xsl:variable name="msg" select="."/> |
| 30 |
<xsl:if test="contains(its:locNote, '
<')"> |
| 31 |
<xsl:for-each select="str:split(its:locNote, '
<')[position() != 1]"> |
| 32 |
<xsl:variable name="element" select="substring-before(., '/>')"/> |
| 33 |
<xsl:for-each select="$xml_out/msg:l10n/msg:msg[@id = $msg/@id]/msg:msgstr"> |
| 34 |
<xsl:if test="not(.//*[local-name(.) = $element])"> |
| 35 |
<xsl:message> |
| 36 |
<xsl:text>Missing </xsl:text> |
| 37 |
<xsl:value-of select="$element"/> |
| 38 |
<xsl:text> in </xsl:text> |
| 39 |
<xsl:value-of select="@xml:lang"/> |
| 40 |
<xsl:text> translation of </xsl:text> |
| 41 |
<xsl:value-of select="$msg/@id"/> |
| 42 |
<xsl:for-each select="descendant::*"> |
| 43 |
<xsl:text>:</xsl:text> |
| 44 |
<xsl:value-of select="local-name(.)"/> |
| 45 |
</xsl:for-each> |
| 46 |
</xsl:message> |
| 47 |
</xsl:if> |
| 48 |
</xsl:for-each> |
| 49 |
</xsl:for-each> |
| 50 |
</xsl:if> |
| 51 |
<xsl:if test="$msg/@id = 'default:LTR'"> |
| 52 |
<xsl:for-each select="$xml_out/msg:l10n/msg:msg[@id = $msg/@id]/msg:msgstr"> |
| 53 |
<xsl:if test="not(. = 'default:LTR') and not(. = 'default:RTL')"> |
| 54 |
<xsl:message> |
| 55 |
<xsl:text>Incorrect </xsl:text> |
| 56 |
<xsl:value-of select="@xml:lang"/> |
| 57 |
<xsl:text> translation of </xsl:text> |
| 58 |
<xsl:value-of select="$msg/@id"/> |
| 59 |
</xsl:message> |
| 60 |
</xsl:if> |
| 61 |
</xsl:for-each> |
| 62 |
</xsl:if> |
| 63 |
<xsl:if test="$msg/@id = 'Other Credits'"> |
| 64 |
<xsl:for-each select="$xml_out/msg:l10n/msg:msg[@id = $msg/@id]/msg:msgstr"> |
| 65 |
<xsl:if test="contains(., '@')"> |
| 66 |
<xsl:message> |
| 67 |
<xsl:text>Probably incorrect </xsl:text> |
| 68 |
<xsl:value-of select="@xml:lang"/> |
| 69 |
<xsl:text> translation of </xsl:text> |
| 70 |
<xsl:value-of select="$msg/@id"/> |
| 71 |
</xsl:message> |
| 72 |
</xsl:if> |
| 73 |
</xsl:for-each> |
| 74 |
</xsl:if> |
| 75 |
</xsl:for-each> |
| 76 |
</xsl:template> |
| 77 |
|
| 78 |
</xsl:stylesheet> |