diff options
Diffstat (limited to 'tests/auto/linguist/lconvert')
-rwxr-xr-x | tests/auto/linguist/lconvert/data/makeplurals.pl | 42 | ||||
-rwxr-xr-x | tests/auto/linguist/lconvert/data/makeplurals.sh | 43 | ||||
-rw-r--r-- | tests/auto/linguist/lconvert/tst_lconvert.cpp | 2 |
3 files changed, 43 insertions, 44 deletions
diff --git a/tests/auto/linguist/lconvert/data/makeplurals.pl b/tests/auto/linguist/lconvert/data/makeplurals.pl new file mode 100755 index 0000000..19bffe0 --- /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 2e0f375..0000000 --- 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 diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 3ad2925..1ed71ab 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -79,7 +79,7 @@ private: void tst_lconvert::initTestCase() { if (!QFile::exists(QLatin1String("data/plural-1.po"))) - QProcess::execute(QLatin1String("data/makeplurals.sh"), QStringList() << QLatin1String("data/")); + QProcess::execute(QLatin1String("perl"), QStringList() << QLatin1String("data/makeplurals.pl") << QLatin1String("data/")); QVERIFY(QFile::exists(QLatin1String("data/plural-1.po"))); } |