forked from BOINC/boinc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdatetrans.sh
executable file
·176 lines (127 loc) · 4.59 KB
/
updatetrans.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
#!/bin/sh
# Automate the compilation of the various locale PO files by automatically
# generating them at night.
#
projname=boinctrunk
projdir=/home/boincadm/pootle/po/$projname
cd $projdir
# Update anything that needs updating
svn update
# Iterrate through the various PO files looking for those that need to be added to SVN.
#
for file in `find -name 'BOINC-Manager.po'` ; do
dir=`dirname $file`
locale=`basename $dir`
template_name=${projdir}/${locale}/BOINC-Manager
# Add any missing PO files to SVN
svn add ${template_name}.po > /dev/null 2> /dev/null
svn propset svn:mime-type 'text/plain;charset=UTF-8' ${template_name}.po > /dev/null 2> /dev/null
done
# Iterrate through the various PO files looking for those that need to be added to SVN.
#
for file in `find -name 'BOINC-Client.po'` ; do
dir=`dirname $file`
locale=`basename $dir`
template_name=${projdir}/${locale}/BOINC-Client
# Add any missing PO files to SVN
svn add ${template_name}.po > /dev/null 2> /dev/null
svn propset svn:mime-type 'text/plain;charset=UTF-8' ${template_name}.po > /dev/null 2> /dev/null
done
# Iterrate through the various PO files looking for those that need to be added to SVN.
#
for file in `find -name 'BOINC-Web.po'` ; do
dir=`dirname $file`
locale=`basename $dir`
template_name=${projdir}/${locale}/BOINC-Web
# Add any missing PO files to SVN
svn add ${template_name}.po > /dev/null 2> /dev/null
svn propset svn:mime-type 'text/plain;charset=UTF-8' ${template_name}.po > /dev/null 2> /dev/null
done
# Iterrate through the various PO files looking for those that need to be compiled.
#
for file in `find -name 'BOINC-Manager.po'` ; do
dir=`dirname $file`
locale=`basename $dir`
template_name=${projdir}/${locale}/BOINC-Manager
if test ${template_name}.po -nt ${template_name}.mo
then
# Compile the PO file into an MO file.
pocompile ${template_name}.po ${template_name}.mo
# Add any new MO files to SVN
svn add ${template_name}.mo > /dev/null 2> /dev/null
# Touch each file to adjust timestamps
touch ${template_name}.po
touch ${template_name}.mo
fi
done
# Iterrate through the various PO files looking for those that need to be compiled.
#
for file in `find -name 'BOINC-Client.po'` ; do
dir=`dirname $file`
locale=`basename $dir`
template_name=${projdir}/${locale}/BOINC-Client
if test ${template_name}.po -nt ${template_name}.mo
then
# Compile the PO file into an MO file.
pocompile ${template_name}.po ${template_name}.mo > /dev/null 2> /dev/null
# Add any new MO files to SVN
svn add ${template_name}.mo > /dev/null 2> /dev/null
# Touch each file to adjust timestamps
touch ${template_name}.po
touch ${template_name}.mo
fi
done
# Iterrate through the various PO files looking for those that need to be compiled.
#
for file in `find -name 'BOINC-Web.po'` ; do
dir=`dirname $file`
locale=`basename $dir`
template_name=${projdir}/${locale}/BOINC-Web
if test ${template_name}.po -nt ${template_name}.mo
then
# Compile the PO file into an MO file.
pocompile ${template_name}.po ${template_name}.mo > /dev/null 2> /dev/null
# Add any new MO files to SVN
svn add ${template_name}.mo > /dev/null 2> /dev/null
# Touch each file to adjust timestamps
touch ${template_name}.po
touch ${template_name}.mo
fi
done
# Determine if we need to update the various languages using the templates.
# This will be done by the use of a tag file which should have a matching
# timestamp as the template files. If the timestamps do not match update all
# languages.
for file in `find -name '*.pot'` ; do
template_rootname=`basename $file .pot`
template_name=${projdir}/templates/${template_rootname}
# Check to see if the file exists, if not create it
if test ! -e ${template_name}.flag
then
cp ${template_name}.pot ${template_name}.flag
fi
# If the modification timestamps don't match then update all the languages
if test ${template_name}.pot -nt ${template_name}.flag
then
execute_update=true
fi
done
if test "${execute_update}" = "true"
then
for file in `find -name '*.po'` ; do
dir=`dirname $file`
locale=`basename $dir`
po_name=`basename $file .po`
msgmerge --update ${locale}/${po_name}.po templates/${po_name}.pot
done
fi
for file in `find -name '*.pot'` ; do
template_rootname=`basename $file .pot`
template_name=${projdir}/templates/${template_rootname}
# Touch each file to adjust timestamps
touch ${template_name}.pot
touch ${template_name}.flag
done
# Commit any changes to SVN
svn commit -m 'Update Translations'
exit 0