summaryrefslogtreecommitdiffstats
path: root/tests/auto/linguist/lconvert/data
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-07-10 18:05:30 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2009-07-10 18:06:16 +0200
commit593f8a322895dc011d88fbe112987f2189d43724 (patch)
tree249b1821573d16926101d20ca23200ea15c7f223 /tests/auto/linguist/lconvert/data
parent5425853ec6a9f29af3378c982f12a0cca4bcb0e0 (diff)
rewrite makeplurals.sh in perl
... so it works under windows as well.
Diffstat (limited to 'tests/auto/linguist/lconvert/data')
-rwxr-xr-xtests/auto/linguist/lconvert/data/makeplurals.pl42
-rwxr-xr-xtests/auto/linguist/lconvert/data/makeplurals.sh43
2 files changed, 42 insertions, 43 deletions
diff --git a/tests/auto/linguist/lconvert/data/makeplurals.pl b/tests/auto/linguist/lconvert/data/makeplurals.pl
new file mode 100755
index 0000000000..19bffe020d
--- /dev/null
+++ b/tests/auto/linguist/lconvert/data/makeplurals.pl
@@ -0,0 +1,42 @@
+#! /usr/bin/env perl
+
+sub makeit2($$$)
+{
+ for (my $i = 0; $i < (1 << $_[0]); $i++) {
+ print OUTFILE "\n";
+ print OUTFILE "$_[2]\n" unless $3 eq "";
+ print OUTFILE "msgid \"singular $_[1] $i\"\n";
+ print OUTFILE "msgid_plural \"plural $_[1] $i\"\n";
+ for (my $j = 0; $j < $_[0]; $j++) {
+ my $tr;
+ if (($i & (1 << $j)) == 0) {
+ $tr = "translated $_[1] $i $j";
+ }
+ print OUTFILE "msgstr[$j] \"$tr\"\n";
+ }
+ }
+}
+
+sub makeit($$)
+{
+ open OUTFILE, ">${OUTDIR}plural-$_[0].po" || die "cannot write file in $OUTDIR";
+ print OUTFILE <<EOF;
+msgid ""
+msgstr ""
+"X-FooBar: yup\\n"
+"X-Language: $_[1]\\n"
+EOF
+ makeit2($_[0], "one", "");
+ makeit2($_[0], "two", "#, fuzzy
+#| msgid \"old untranslated one\"");
+ makeit2($_[0], "three", "#, fuzzy
+#| msgid \"old untranslated two\"
+#| msgid_plural \"old untranslated plural two\"");
+ makeit2($_[0], "four", "#, fuzzy
+#| msgid_plural \"old untranslated only plural three\"");
+}
+
+$OUTDIR = $ARGV[0];
+makeit(1, "zh_CN");
+makeit(2, "de_DE");
+makeit(3, "pl_PL");
diff --git a/tests/auto/linguist/lconvert/data/makeplurals.sh b/tests/auto/linguist/lconvert/data/makeplurals.sh
deleted file mode 100755
index 2e0f375486..0000000000
--- a/tests/auto/linguist/lconvert/data/makeplurals.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-#! /bin/bash
-
-function makeit2()
-{
- for ((i = 0; i < (1 << $1); i++)); do
- echo
- test -n "$3" && echo "$3"
- echo "msgid \"singular $2 $i\""
- echo "msgid_plural \"plural $2 $i\""
- for ((j = 0; j < $1; j++)); do
- tr=
- if test $((i & (1 << j))) = 0; then
- tr="translated $2 $i $j"
- fi
- echo "msgstr[$j] \"$tr\""
- done
- done
-}
-
-function makeit()
-{
- {
- cat <<EOF
-msgid ""
-msgstr ""
-"X-FooBar: yup\n"
-"X-Language: $2\n"
-EOF
- makeit2 $1 one ""
- makeit2 $1 two "#, fuzzy
-#| msgid \"old untranslated one\""
- makeit2 $1 three "#, fuzzy
-#| msgid \"old untranslated two\"
-#| msgid_plural \"old untranslated plural two\""
- makeit2 $1 four "#, fuzzy
-#| msgid_plural \"old untranslated only plural three\""
- } > ${OUTDIR}plural-$1.po
-}
-
-OUTDIR=$1
-makeit 1 zh_CN
-makeit 2 de_DE
-makeit 3 pl_PL