Directory renamed for something more general 39/3239/2
Sylvestre Ledru [Wed, 23 Feb 2011 12:30:29 +0000 (13:30 +0100)]
Introduce a script to make sure localization are placed at the right place
(English being the reference)

Change-Id: I0fd987de51541086b8044d8ffdcd27a767ae638a

scilab/modules/helptools/src/script/8859_to_utf8.pl [moved from scilab/modules/helptools/src/perl/8859_to_utf8.pl with 100% similarity]
scilab/modules/helptools/src/script/check_xml.pl [moved from scilab/modules/helptools/src/perl/check_xml.pl with 100% similarity]
scilab/modules/helptools/src/script/check_xml_dir.pl [moved from scilab/modules/helptools/src/perl/check_xml_dir.pl with 100% similarity]
scilab/modules/helptools/src/script/dispatchHelp.sh [new file with mode: 0644]
scilab/modules/helptools/tests/nonreg_tests/bug_4938.tst

diff --git a/scilab/modules/helptools/src/script/dispatchHelp.sh b/scilab/modules/helptools/src/script/dispatchHelp.sh
new file mode 100644 (file)
index 0000000..987eb45
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# English is the reference. Update all other languages to put them at the right
+# place.
+
+if test -z "$SCI"; then
+        echo "Please define the variable SCI"
+        exit -2
+fi
+
+REFERENCE_LANG=en_US
+LANGS="ja_JP fr_FR pt_BR"
+
+ENGLISH_FILES=$(find modules/ -iname '*.xml'|grep "/help/$REFERENCE_LANG")
+
+for f in $ENGLISH_FILES; do
+    FILENAME=$(basename $f)
+    DIRNAME=$(dirname $f)
+    MODULENAME=$(echo $f|awk -F '/' '{print $1"/"$2}')
+
+    # Check if the file already exists in other langs
+    for l in $LANGS; do
+        fTranslated=$(echo $f|sed -e "s|$REFERENCE_LANG|$l|")
+
+        if test ! -f $fTranslated; then
+            # File not found. However, it might not have been translated
+            # Look if it the case or not
+
+            # File found but at the wrong place
+            FOUNDFILE=$(find $MODULENAME -name $FILENAME|grep $l)
+            if test "$FOUNDFILE" != ""; then
+                # File found.
+                TARGET=$(echo $DIRNAME|sed -e "s|$REFERENCE_LANG|$l|")
+                if test ! -d $TARGET; then
+                    echo "Creation of $TARGET"
+                    mkdir $TARGET
+                fi
+                echo "mv $FOUNDFILE $TARGET"
+                mv $FOUNDFILE $TARGET
+            fi
+            
+
+        fi
+    done
+done
index e226511..36f705f 100644 (file)
@@ -15,4 +15,4 @@
 // <-- Short Description -->
 // The output of check_xml.pl is eating some characters.
 
-// perl ./modules/helptools/src/perl/check_xml.pl graphics
\ No newline at end of file
+// perl ./modules/helptools/src/script/check_xml.pl graphics
\ No newline at end of file