summaryrefslogtreecommitdiffstats
path: root/tests/auto/linguist/lconvert/data/makeplurals.sh
blob: 2e0f37548613e5859bf3effb08f3c5446bf4f8b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /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