-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmake-mo
More file actions
executable file
·38 lines (31 loc) · 943 Bytes
/
make-mo
File metadata and controls
executable file
·38 lines (31 loc) · 943 Bytes
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
#!/bin/bash
NAMES=$(cat RESOURCES)
to_dir="locale"
main() {
for name in $NAMES; do
local lc_name=$(echo $name | tr 'A-Z' 'a-z')
local from_dir="../translations/antix-development.$lc_name"
printf "%25s:" "$name"
local from_file
for from_file in $from_dir/*.po; do
egrep -q 'msgstr "[^"]+"' $from_file || continue
local lang=$(basename $from_file .po)
local to_file=$to_dir/$lang/LC_MESSAGES/$name.mo
should_copy $from_file $to_file || continue
echo -n " $lang"
mkdir -p $(dirname $to_file)
msgfmt -o $to_file $from_file
done
echo
done
}
should_copy() {
local sorc=$1 targ=$2
[ "$FORCE" ] && return 0
[ -f $targ ] || return 0
local targ_time=$(stat -c %Y $targ)
local sorc_time=$(stat -c %Y $sorc)
[ $targ_time -lt $sorc_time ] && return 0
return 1
}
main "$@"