summaryrefslogtreecommitdiff
path: root/makepos
blob: 89a5ddccce005a242518c7940aaa5199918e52fd (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
POHEADER='
# ccs-settings intl file.
# Copyright (C) 2006
# This file is distributed under the same license as the ccs-settings package.
# cyberorg , 2006.
# Steveway (DE translation)
msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2006-09-25 22:07+0530\n"
"PO-Revision-Date: 2006-09-25 17:15+0530\n"
"Last-Translator: Melvil/Steveway\n"
"Language-Team: OpenCompositing \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
'
MYIFS='
'
addmsg()
{
    OSTR="`echo $1| sed -e 's/"/\\\\"/g'`"
    OSTR2="`echo $OSTR | sed -e 's/\\\\/\\\\\\\/g'`"
    if cat $OFILE | grep "^msgid \"$OSTR2\"" > /dev/null
    then
        echo -n "D" # duplicate value
    else
        echo "msgid \"$OSTR\"" >> $OFILE
        echo 'msgstr ""' >> $OFILE
        echo >> $OFILE
    fi
}
makepo()
{
    echo -n Making pofile section for `basename $1`
    SAVEIFS=$IFS
    IFS="$MYIFS"
    for each in `cat $1 | egrep '^[nl]_' | cut -d '=' -f 2- | sed -e 's/"/\\"/g'`
    do
        echo -n '.'
        IFS=$SAVEIFS
        addmsg "$each"
    done
    IFS="$MYIFS"
    for each in `cat $1 | egrep '^s_'`
    do
        echo -n '.'
        IFS="$SAVEIFS"
        #find if it is a =string, or =list
        oname="`echo $each | cut -d '_' -f 2- | cut -d '=' -f 1`"
        otype="`cat $1 | grep "o_$oname=" | cut -d '=' -f 2-`"
        if [ "$otype" = "string" ]
        then
            echval="`echo $each | cut -d '=' -f 2-`"
            IFS=";"
            for estr in $echval
            do
                IFS="$SAVEIFS"
                addmsg "$estr"
            done
        else
            if [ "$otype" = "list" ]
            then
                ltype="`cat $1 | grep "t_$oname=" | cut -d '=' -f 2-`"
                if [ "$ltype" = "string" ]
                then
                    echval="`echo $each | cut -d '=' -f 2-`"
                    IFS=";"
                    for estr in $echval
                    do
                        IFS="$SAVEIFS"
                        addmsg "$estr"
                    done
                fi
            fi
        fi
    done
    IFS="$SAVEIFS"
    echo Done
}
if [ "$1" = "" ]
then
    echo "Usage: $0 output_file [settings_dir]"
    exit
fi
if [ "$2" = "" ]
then
    SETDIR="/usr/share/ccs/"
else
    SETDIR=$2
fi
OFILE=$1
if [ -f $OFILE ]
then
    echo Append mode, not writing header.
else
    echo "$POHEADER" > $OFILE
fi
for each in $SETDIR/*settings*
do
    makepo "$each"
done