All pastes #183840 Raw Edit

Miscellany

public text v1 · immutable
#183840 ·published 2006-09-27 09:30 UTC
rendered paste body
#!/bin/sh
POHEADER='
# Beryl-Manager intl file.
# Copyright (C) 2006
# This file is distributed under the same license as the beryl-manager package.
# cyberorg , 2006.
# Steveway (DE translation)
'
POFOOTER='
"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: beryl-project \\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8bit\\n"
'
MYIFS='
'
makepo()
{
    echo -n Making pofile section for `basename $1`
    echo "# `basename $1` - short and long desc" >&2
    SAVEIFS=$IFS
    IFS="$MYIFS"
    for each in `cat $1 | egrep '^[nl]_' | cut -d '=' -f 2 | sed -e 's/"/\\"/g'`
    do
        echo -n '.'
        IFS=$SAVEIFS
        echo "msgid \"$each\"" >&2
        echo 'msgstr ""' >&2
        echo >&2
    done
    echo "# `basename $1` - any string lists / option lists" >&2
    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"
                echo "msgid \"$estr\"" >&2
                echo 'msgstr ""' >&2
                echo >&2
            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"
                        echo "msgid \"$estr\"" >&2
                        echo 'msgstr ""' >&2
                        echo >&2
                    done
                fi
            fi
        fi
    done
    IFS="$SAVEIFS"
    echo Done
}

2>$1
echo "$POHEADER" >&2
for each in /usr/share/beryl/*settings*
do
    echo "filename :  $each"
    makepo "$each"
done
echo "$POFOOTER" >&2