File: update-po

package info (click to toggle)
sonata 1.7.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,176 kB
  • sloc: python: 9,430; sh: 33; makefile: 13
file content (59 lines) | stat: -rwxr-xr-x 1,574 bytes parent folder | download | duplicates (5)
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
#!/bin/sh
# Copyright 2006-2009 Scott Horowitz <stonecrest@gmail.com>
# Copyright 2009-2014 Jonathan Ballet <jon@multani.info>
#
# This file is part of Sonata.
#
# Sonata is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Sonata is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Sonata.  If not, see <http://www.gnu.org/licenses/>.

PACKAGE=Sonata
INTLTOOL_UPDATE="intltool-update --gettext-package=$PACKAGE"

if ! which intltool-update > /dev/null
then
    echo "You need intltool-update to update the translation files!" > /dev/fd/2
    exit 1
fi

cd $(dirname "$0")/../po

rm -f missing
echo Updating POTFILES.in...
$INTLTOOL_UPDATE -m

if [ -f missing ]
then
    exit 1
fi

echo Updating $PACKAGE.pot...
$INTLTOOL_UPDATE -p

for i in *.po
do
    # Generate ;po files only for the specified language.
    echo "$*" | grep -q "$(echo $i | sed "s/.po$//g")"
    if [ $? = 0 -o $# = 0 ]
    then
        echo Updating $i...
        $INTLTOOL_UPDATE "${i%*.po}"

        echo Purging old translations from $i...
        msgattrib --output-file="$i" --no-obsolete "$i"
    fi
done


echo "Translation status:"
$INTLTOOL_UPDATE -r