Merge pull request #1094 in FS/freeswitch from ~SAFAROV/freeswitch2:FS-9805 to master

* commit 'fdfc024a521d2f08966226d8c95b03bf4c19fb85':
  FS-9805: Organized prompts in phrase_en.xml
  FS-9805: Created script to compare XML traslation files with phrase_en.xml
This commit is contained in:
Brian West 2016-12-05 07:56:05 -06:00
commit 8b40ddee8b
4 changed files with 85 additions and 3 deletions

View File

@ -7,6 +7,11 @@ to automatically generate or verify all the files exist for a particular
language. If you are capable of recording each language please do so and
contribute them to the project. As phrases are added, the files will need to be
updated for the respective phrase_xx.xml file.
make_checks.sh - script to compare phrase_en.xml with other language xml files.
Script output contans prompt elements with attributes:
translated - value 'false' or not displayed;
transpated-to - tranlation value if exists;
more-then-one-translation - displayed if exist two or more for given wav file.
How can you contribute?

17
docs/phrase/make_checks.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
SAXON_JAR=/usr/share/java/saxon9he.jar
XML=$1
if [ ! -f "$SAXON_JAR" ]; then
echo "Please update 'SAXON_JAR' varaiable value to location of SAXON jar"
exit -1
fi
if [ -z "$XML" ]; then
echo "Error: Please enter xml file name that must be ckecked."
echo "Exmple: make_checks.sh phrase_es_ES.xml > comparison_result.xml"
exit -1
fi
java -jar "$SAXON_JAR" -xsl:make_checks.xslt -t "$XML"

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema" exclude-result-prefixes="xs" version="2.0">
<xsl:template match="/">
<xsl:variable name="master_xml">
<xsl:copy-of select="document('phrase_en.xml')/*"/>
</xsl:variable>
<xsl:variable name="current_xml">
<xsl:copy-of select="*"/>
</xsl:variable>
<xsl:apply-templates select="$master_xml" mode="checkElements">
<xsl:with-param name="current_xml" select="$current_xml/*"/>
</xsl:apply-templates>
</xsl:template>
<xsl:template match="en" mode="checkElements">
<xsl:param name="current_xml"/>
<xsl:copy>
<xsl:attribute name="translated-to" select="name($current_xml)"/>
<xsl:apply-templates select="@*|node()" mode="#current">
<xsl:with-param name="current_xml" select="$current_xml/*"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="prompt" mode="checkElements">
<xsl:param name="current_xml"/>
<xsl:variable name="translation"
select="$current_xml[@filename=current()/@filename]/@phrase"/>
<xsl:copy>
<xsl:apply-templates select="@*" mode="#current"/>
<xsl:choose>
<xsl:when test="count($translation)=0">
<xsl:attribute name="translated" select="false()"/>
</xsl:when>
<xsl:when test="@phrase = $translation">
<xsl:attribute name="translated" select="false()"/>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="translated-to" select="$translation[1]"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="count($translation) > 1">
<xsl:attribute name="more-then-one-translation" select="true()"/>
</xsl:if>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()" mode="checkElements">
<xsl:param name="current_xml"/>
<xsl:copy>
<xsl:apply-templates select="@*|node()" mode="#current">
<xsl:with-param name="current_xml" select="$current_xml/*"/>
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>

View File

@ -144,12 +144,12 @@
<prompt phrase="Twentieth" filename="h-20.wav"/>
<prompt phrase="Thirtieth" filename="h-30.wav"/>
<prompt phrase="Hundred" filename="hundred.wav"/>
<prompt phrase="Thousand" filename="thousand.wav"/>
<prompt phrase="Million" filename="million.wav"/>
<prompt phrase="Period" filename="period.wav"/>
<prompt phrase="Point" filename="point.wav"/>
<prompt phrase="Pound" filename="pound.wav"/>
<prompt phrase="Star" filename="star.wav"/>
<prompt phrase="Thousand" filename="thousand.wav"/>
</digits>
<currency>
<prompt phrase="And" filename="and.wav"/>
@ -176,6 +176,8 @@
<prompt phrase="Hours" filename="hours.wav"/>
<prompt phrase="Minute" filename="minute.wav"/>
<prompt phrase="Minutes" filename="minutes.wav"/>
<prompt phrase="Second" filename="second.wav"/>
<prompt phrase="Seconds" filename="seconds.wav"/>
<prompt phrase="January" filename="mon-0.wav"/>
<prompt phrase="Febuary" filename="mon-1.wav"/>
<prompt phrase="March" filename="mon-2.wav"/>
@ -191,8 +193,6 @@
<prompt phrase="O'Clock" filename="oclock.wav"/>
<prompt phrase="oh" filename="oh.wav"/>
<prompt phrase="P.M." filename="p-m.wav"/>
<prompt phrase="Second" filename="second.wav"/>
<prompt phrase="Seconds" filename="seconds.wav"/>
<prompt phrase="Today" filename="today.wav"/>
<prompt phrase="Tomorrow" filename="tomorrow.wav"/>
<prompt phrase="Yesterday" filename="yesterday.wav"/>