moving to core/
authorkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Sun, 8 Jan 2012 02:23:06 +0000 (02:23 +0000)
committerkruland2607 <kruland2607@180e2498-e6e9-4542-8430-84ac67f01cd8>
Sun, 8 Jan 2012 02:23:06 +0000 (02:23 +0000)
git-svn-id: https://openrocket.svn.sourceforge.net/svnroot/openrocket/trunk@297 180e2498-e6e9-4542-8430-84ac67f01cd8

core/scripts/checkTranslations.sh [new file with mode: 0755]
core/scripts/renameTranslationKeys.sh [new file with mode: 0644]
core/scripts/verifyTranslationKeys.pl [new file with mode: 0755]
scripts/checkTranslations.sh [deleted file]
scripts/renameTranslationKeys.sh [deleted file]
scripts/verifyTranslationKeys.pl [deleted file]

diff --git a/core/scripts/checkTranslations.sh b/core/scripts/checkTranslations.sh
new file mode 100755 (executable)
index 0000000..bbbf91c
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+#
+# Perform all tests for the translation files.
+#
+# Usage:
+#    ./scripts/checkTranslations.sh
+#
+
+
+# Test that keys used in Java files are present in English messages
+find src/ -name "*.java" -exec ./scripts/verifyTranslationKeys.pl l10n/messages.properties {} +
+
diff --git a/core/scripts/renameTranslationKeys.sh b/core/scripts/renameTranslationKeys.sh
new file mode 100644 (file)
index 0000000..2a7314d
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+#
+# Rename translation keys in translation files.
+#
+# Usage:
+#    renameTranslationKeys.sh <mapping files...>
+#
+# The mapping files contain "<original> <new>" key pairs.
+# Empty lines and lines starting with "#" are ignored.
+# All translation files are modified at once.
+#
+
+TRANSLATIONS=messages*.properties
+
+cat "$@" | while read line; do
+
+    if echo "$line" | grep -q "^\s*$\|^\s*#"; then
+       continue
+    fi
+
+    if ! echo "$line" | egrep -q "^\s*[a-zA-Z0-9._-]+\s+[a-zA-Z0-9._-]+\s*$"; then
+       echo "Invalid line:  $line"
+    fi
+
+    from="`echo $line | cut -d" " -f1`"
+    to="`echo $line | cut -d" " -f2`"
+
+    sed -i "s/^${from}\s*=\s*/${to} = /" $TRANSLATIONS
+
+done
diff --git a/core/scripts/verifyTranslationKeys.pl b/core/scripts/verifyTranslationKeys.pl
new file mode 100755 (executable)
index 0000000..f084f06
--- /dev/null
@@ -0,0 +1,67 @@
+#!/usr/bin/perl
+
+#
+# Verify that keys used in Java files are present in the translation file.
+# 
+# Usage:
+#    verifyTranslationKeys.pl <property file> <Java files...>
+#
+# For example:
+#    find src/ -name "*.java" -exec ./scripts/verifyTranslationKeys.pl l10n/messages.properties {} +
+#
+
+
+
+# Read the translation file
+my %keys;
+print "Reading translation keys...\n";
+while ($str = <>) {
+    if ($ARGV!~/\.properties/) {
+       last;
+    }
+
+    if ($str=~/^\s*($|[#!])/) {
+       next;
+    }
+
+    if ($str=~/^([a-zA-Z0-9._-]+)\s*=/) {
+       $keys{$1} = 1;
+    } else {
+       print "ERROR:  Invalid line in $ARGV: $str";
+    }
+}
+
+
+# Read Java files
+my $oldFile = $ARGV;
+my $class="";
+print "Reading Java files...\n";
+while ($str = <>) {
+
+    # Check for new file
+    if ($ARGV != $oldFile) {
+       $class = "";
+    }
+    
+    # Check for irregular translator definition (exclude /l10n/ and /startup/)
+    if ($str =~ / Translator / &&
+       $str !~ /private static final Translator trans = Application.getTranslator\(\);/ &&
+       $ARGV !~ /\/(l10n|startup)\//) {
+       print "ERROR:  Unusual translator usage in file $ARGV: $str";
+    }
+
+    # Check for new class definition
+    if ($str =~ /^[\sa-z]*class ([a-zA-Z0-9]+) /) {
+       $class = $1;
+    }
+
+    # Check for translator usage
+    if ($str =~ /trans\.get\(\"([^\"]+)\"\)/) {
+       $key = $1;
+       if (!(exists $keys{$key}) && 
+           !(exists $keys{$class . "." . $key})) {
+           print "ERROR:  Missing translation for '$key' in file $ARGV\n";
+       }
+    }
+
+}
diff --git a/scripts/checkTranslations.sh b/scripts/checkTranslations.sh
deleted file mode 100755 (executable)
index bbbf91c..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/bash
-
-#
-# Perform all tests for the translation files.
-#
-# Usage:
-#    ./scripts/checkTranslations.sh
-#
-
-
-# Test that keys used in Java files are present in English messages
-find src/ -name "*.java" -exec ./scripts/verifyTranslationKeys.pl l10n/messages.properties {} +
-
diff --git a/scripts/renameTranslationKeys.sh b/scripts/renameTranslationKeys.sh
deleted file mode 100644 (file)
index 2a7314d..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-
-#
-# Rename translation keys in translation files.
-#
-# Usage:
-#    renameTranslationKeys.sh <mapping files...>
-#
-# The mapping files contain "<original> <new>" key pairs.
-# Empty lines and lines starting with "#" are ignored.
-# All translation files are modified at once.
-#
-
-TRANSLATIONS=messages*.properties
-
-cat "$@" | while read line; do
-
-    if echo "$line" | grep -q "^\s*$\|^\s*#"; then
-       continue
-    fi
-
-    if ! echo "$line" | egrep -q "^\s*[a-zA-Z0-9._-]+\s+[a-zA-Z0-9._-]+\s*$"; then
-       echo "Invalid line:  $line"
-    fi
-
-    from="`echo $line | cut -d" " -f1`"
-    to="`echo $line | cut -d" " -f2`"
-
-    sed -i "s/^${from}\s*=\s*/${to} = /" $TRANSLATIONS
-
-done
diff --git a/scripts/verifyTranslationKeys.pl b/scripts/verifyTranslationKeys.pl
deleted file mode 100755 (executable)
index f084f06..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/perl
-
-#
-# Verify that keys used in Java files are present in the translation file.
-# 
-# Usage:
-#    verifyTranslationKeys.pl <property file> <Java files...>
-#
-# For example:
-#    find src/ -name "*.java" -exec ./scripts/verifyTranslationKeys.pl l10n/messages.properties {} +
-#
-
-
-
-# Read the translation file
-my %keys;
-print "Reading translation keys...\n";
-while ($str = <>) {
-    if ($ARGV!~/\.properties/) {
-       last;
-    }
-
-    if ($str=~/^\s*($|[#!])/) {
-       next;
-    }
-
-    if ($str=~/^([a-zA-Z0-9._-]+)\s*=/) {
-       $keys{$1} = 1;
-    } else {
-       print "ERROR:  Invalid line in $ARGV: $str";
-    }
-}
-
-
-# Read Java files
-my $oldFile = $ARGV;
-my $class="";
-print "Reading Java files...\n";
-while ($str = <>) {
-
-    # Check for new file
-    if ($ARGV != $oldFile) {
-       $class = "";
-    }
-    
-    # Check for irregular translator definition (exclude /l10n/ and /startup/)
-    if ($str =~ / Translator / &&
-       $str !~ /private static final Translator trans = Application.getTranslator\(\);/ &&
-       $ARGV !~ /\/(l10n|startup)\//) {
-       print "ERROR:  Unusual translator usage in file $ARGV: $str";
-    }
-
-    # Check for new class definition
-    if ($str =~ /^[\sa-z]*class ([a-zA-Z0-9]+) /) {
-       $class = $1;
-    }
-
-    # Check for translator usage
-    if ($str =~ /trans\.get\(\"([^\"]+)\"\)/) {
-       $key = $1;
-       if (!(exists $keys{$key}) && 
-           !(exists $keys{$class . "." . $key})) {
-           print "ERROR:  Missing translation for '$key' in file $ARGV\n";
-       }
-    }
-
-}