-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile-messages.sh
executable file
·55 lines (46 loc) · 1.19 KB
/
compile-messages.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
#!/usr/bin/env bash
set -euo pipefail
AUTHOR="Codruta Toadere"
EMAIL="codrutatoadere@gmail.com"
init()
{
use_locale=$1
echo "..: Creating ${use_locale} translation."
lang=${use_locale:0:2}
msginit --locale=${use_locale} --input=messages.pot --output=messages-${lang}.po
}
compile()
{
use_locale=$1
echo "..: Building ${use_locale} translation binaries"
lang=${use_locale:0:2}
if [ ! -f "messages-${lang}.po" ]; then
init $use_locale
fi
msgmerge "messages-${lang}.po" messages.pot \
--lang=${use_locale} \
--sort-output \
--no-wrap \
--verbose \
--update
mkdir -p "./${lang}/LC_MESSAGES"
msgfmt "messages-${lang}.po" \
--verbose \
--output="./${lang}/LC_MESSAGES/fbg-simulation-pyqt.mo"
}
# collect all translatable strings
xgettext gui/*.py \
--sort-output \
--foreign-user \
--copyright-holder="${AUTHOR}" \
--package-name="fbg-simulation-pyqt" \
--package-version="v2.0" \
--msgid-bugs-address="${EMAIL}" \
--language=Python \
--verbose \
--output="./translation/messages.pot"
cd ./translation
for language in ro_RO en_US; do
compile $language
done
cd ..