-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpos
executable file
·48 lines (43 loc) · 2.03 KB
/
pos
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
#!/bin/bash --
#
# This script creates .po files in po/ subdirectory given the list of languages
# in po/LINGUAS and list of source files in po/POTFILES.in
#
# Copyright (c) 2012-2014 Vadim@dbFin <[email protected]>
# This file is distributed under the same license as dbFin YAWL GNOME Shell Extensions.
#
# Notes:
# A new .po file is generated only if it does not exist in po/
# Error messages are kept in pos.log file
#
function help() {
echo "Usage: $BASH_SOURCE extension_name"
exit 1
}
[ $# -gt 0 ] && [ -f "./$1/autogen.sh" ] && [ -f "./$1/include.mk" ] || help
cd "./$1/"
# get current version of extension
vd=$( cat include.mk | grep '^ *extensionversion *= *' )
vd=${vd#*extensionversion = }
while read l; do
if [ -f po/$l.po ]; then
echo -e "\e[0;33mpo/$l.po\e[0m already exists: delete the file if you want a fresh copy"
else
xgettext --no-location -k_ -kN_ -L Java -f po/POTFILES.in -o po/$l.po 2> >( while read e; do echo "$(date) $1: $e"; done >> ../pos.log ) \
&& echo -e "\e[0;32mpo/$l.po\e[0m was created successfully, ready to be translated" \
&& sed -i \
-e 's|SOME DESCRIPTIVE TITLE.|Translation for dbFin YAWL GNOME Shell extension|' \
-e 's|YEAR THE PACKAGE'"'"'S COPYRIGHT HOLDER|'2013-"$(date +%Y)"' Vadim Cherepanov @ dbFin.com|' \
-e 's|the PACKAGE package|dbFin YAWL GNOME Shell Extension|' \
-e 's|FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.|Vadim Cherepanov @ dbFin <[email protected]>, '2013-"$(date +%Y)"'|' \
-e 's|PACKAGE VERSION|YAWL '"$vd"'|' \
-e 's|YEAR-MO-DA HO:MI+ZONE|'"$(date +%Y-%m-%d\ %H:%M%z)"'|' \
-e 's|FULL NAME <EMAIL@ADDRESS>|Vadim Cherepanov @ dbFin <[email protected]>|' \
-e 's|LANGUAGE <[email protected]>|dbFin|' \
-e 's|charset=CHARSET|charset=UTF-8|' \
-e 's|||' \
-e 's|||' \
po/$l.po 2> >( while read e; do echo "$(date): $e"; done >> ./pos.log ) \
|| echo -e "\e[0;31mpo/$l.po\e[0m: failed to modify file, check log file pos.log"
fi
done < po/LINGUAS