File: generate-pot.sh

package info (click to toggle)
rednotebook 2.39%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,956 kB
  • sloc: python: 9,570; javascript: 4,103; xml: 128; sh: 58; makefile: 11
file content (48 lines) | stat: -rwxr-xr-x 1,283 bytes parent folder | download | duplicates (3)
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
#! /bin/bash
#
# Needs intltool package.

set -e
set -u

# Check that required 'intltool' is installed.
if ! [ -x "$(command -v intltool-extract)" ]
then
    echo 'intltool not installed. Please install intltool package. Exiting...' >&2
    exit 1
fi

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

# Get strings from glade file into helper file
intltool-extract --local --type=gettext/glade ../rednotebook/files/main_window.glade

# Remove gtk-ok and gtk-cancel lines
sed -i '/"gtk-/d' tmp/main_window.glade.h

# Replace "/* abc */" with "# Translators: abc"
# The first character after the s is the separation character (!)
sed -i 's!/\*!# Translators:!g' tmp/main_window.glade.h
sed -i 's!\*/!!g' tmp/main_window.glade.h

# Get strings from both glade helper file and the python files

# Write a list of all sourcefiles
find ../rednotebook -name "*.py" -not -path "*external*" > sourcefiles.txt

xgettext    --output=rednotebook.pot \
            --language=Python \
            --keyword=_ \
            --keyword=N_ \
            --add-comments=\ Translators \
            --from-code=utf-8 \
            --files-from=sourcefiles.txt \
            tmp/main_window.glade.h

for file in $(ls *.po); do
    msgmerge --previous --update ${file} rednotebook.pot
done

rm sourcefiles.txt
rm -rf tmp/