-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmk-pot.sh
executable file
·42 lines (33 loc) · 969 Bytes
/
mk-pot.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
#!/usr/bin/bash
export TEXTDOMAIN=mx-tour
export TEXTDOMAIN_DIR=.
. gettext.sh
pushtext(){ # push text file into var
local file=${1} var=${2}
: ${file:=-}
IFS='' read -r -d '' ${var} < <( eval cat "${file}") || true
}
GETTEXT="$(cat mx-tour)"
for F in text/*; do
[[ -f ${F} ]] || continue # only files
[[ -z ${F##*.*} ]] && continue # ignore any backup files with dot
[[ -z ${F##*~} ]] && continue # ignore any backup files with ~
N=${F##*/} # basename
N=${N//-/_} # replace hyphens with underline
declare -n nameref=$N
pushtext "$F" $N
GETTEXT+="
$N="'$(gettext '"${nameref@Q})
"
done
xgettext -v -L SHELL \
--no-location \
--no-wrap \
--sort-output \
--from-code=UTF-8 \
--package-name=mx-tour \
--output=en.pot - \
<<<$GETTEXT
sed -i '/^msgid "gtk30"/,/^msgstr/d' en.pot
exit