-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathmessages.sh
executable file
·56 lines (41 loc) · 2.11 KB
/
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
56
#!/usr/bin/env bash
#
function init_message() {
find . -iname "*.sh" | xargs xgettext --output=/tmp/jumpserver-installer.pot --from-code=UTF-8
msginit --input=/tmp/jumpserver-installer.pot --locale=locale/zh_CN/LC_MESSAGES/jumpserver-installer.po
msginit --input=/tmp/jumpserver-installer.pot --locale=locale/en/LC_MESSAGES/jumpserver-installer.po
msginit --input=/tmp/jumpserver-installer.pot --locale=locale/zh_Hant/LC_MESSAGES/jumpserver-installer.po
}
function make_message() {
find . -iname "*.sh" | xargs xgettext --output=/tmp/jumpserver-installer.pot --from-code=UTF-8
msginit --input=/tmp/jumpserver-installer.pot --locale=locale/zh_CN/LC_MESSAGES/jumpserver-installer-tmp.po
msgmerge -U locale/zh_CN/LC_MESSAGES/jumpserver-installer.po locale/zh_CN/LC_MESSAGES/jumpserver-installer-tmp.po
msginit --input=/tmp/jumpserver-installer.pot --locale=locale/en/LC_MESSAGES/jumpserver-installer-tmp.po
msgmerge -U locale/en/LC_MESSAGES/jumpserver-installer.po locale/en/LC_MESSAGES/jumpserver-installer-tmp.po
msginit --input=/tmp/jumpserver-installer.pot --locale=locale/zh_Hant/LC_MESSAGES/jumpserver-installer-tmp.po
msgmerge -U locale/zh_Hant/LC_MESSAGES/jumpserver-installer.po locale/zh_Hant/LC_MESSAGES/jumpserver-installer-tmp.po
rm ./locale/zh_CN/LC_MESSAGES/jumpserver-installer-tmp.po
rm ./locale/en/LC_MESSAGES/jumpserver-installer-tmp.po
rm ./locale/zh_Hant/LC_MESSAGES/jumpserver-installer-tmp.po
}
function compile_message() {
msgfmt --output-file=locale/zh_CN/LC_MESSAGES/jumpserver-installer.mo locale/zh_CN/LC_MESSAGES/jumpserver-installer.po
msgfmt --output-file=locale/en/LC_MESSAGES/jumpserver-installer.mo locale/en/LC_MESSAGES/jumpserver-installer.po
msgfmt --output-file=locale/zh_Hant/LC_MESSAGES/jumpserver-installer.mo locale/zh_Hant/LC_MESSAGES/jumpserver-installer.po
}
action=$1
if [ -z "$action" ]; then
action="make"
fi
case $action in
m|make)
make_message;;
i|init)
init_message;;
c|compile)
compile_message;;
*)
echo "Usage: $0 [m|make i|init | c|compile]"
exit 1
;;
esac