forked from gnunn1/tilix
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
extract-strings.sh
executable file
·87 lines (77 loc) · 2.18 KB
/
extract-strings.sh
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
#!/bin/sh
set -e
DOMAIN=tilix
BASEDIR=$(dirname $0)
OUTPUT_FILE=${BASEDIR}/po/${DOMAIN}.pot
echo "Extracting translatable strings... "
# Extract the strings from D source code. Since xgettext does not support D
# as a language we use Vala, which works reasonable well.
find ${BASEDIR}/source -name '*.d' | xgettext \
--output $OUTPUT_FILE \
--files-from=- \
--directory=$BASEDIR \
--language=Vala \
--keyword=C_:1c,2 \
--from-code=utf-8 \
--add-comments=TRANSLATORS
xgettext \
--join-existing \
--output $OUTPUT_FILE \
--directory=$BASEDIR \
${BASEDIR}/data/nautilus/open-tilix.py
# Glade UI Files
find ${BASEDIR}/data/resources/ui -name '*.ui' | xgettext \
--join-existing \
--output $OUTPUT_FILE \
--files-from=- \
--directory=$BASEDIR \
--language=Glade \
--from-code=utf-8
xgettext \
--join-existing \
--output $OUTPUT_FILE \
--default-domain=$DOMAIN \
--package-name=$DOMAIN \
--directory=$BASEDIR \
--foreign-user \
--language=Desktop \
${BASEDIR}/data/pkg/desktop/com.gexperts.Tilix.desktop.in
TMP_METAINFO_FILE=${BASEDIR}/data/metainfo/com.gexperts.Tilix.appdata.xml.rel.in
appstreamcli news-to-metainfo ${BASEDIR}/NEWS \
${BASEDIR}/data/metainfo/com.gexperts.Tilix.appdata.xml.in \
${TMP_METAINFO_FILE}
xgettext \
--join-existing \
--output $OUTPUT_FILE \
--default-domain=$DOMAIN \
--package-name=$DOMAIN \
--directory=$BASEDIR \
--foreign-user \
--language=appdata \
${TMP_METAINFO_FILE}
rm -f ${TMP_METAINFO_FILE}
# Merge the messages with existing po files
echo "Merging with existing translations... "
for file in ${BASEDIR}/po/*.po
do
echo -n $file
msgmerge -F --update $file $OUTPUT_FILE
done
echo "Updating LINGUAS file..."
find ${BASEDIR}/po \
-type f \
-iname "*.po" \
-printf '%f\n' \
| grep -oP '.*(?=[.])' | sort \
> ${BASEDIR}/po/LINGUAS
# Update manpage translations
echo "Updating manpage translations..."
if type po4a-updatepo >/dev/null 2>&1; then
MANDIR=${BASEDIR}/data/man
po4a-gettextize -f man -m ${MANDIR}/tilix.1 -p ${MANDIR}/po/tilix.1.man.pot
for file in ${MANDIR}/po/*.man.po
do
echo -n $file
po4a-updatepo -f man -m ${MANDIR}/tilix.1 -p $file
done
fi