1 |
slords |
1.1 |
#!/bin/bash |
2 |
|
|
|
3 |
|
|
# Functions |
4 |
|
|
. /etc/pootle/bin/functions |
5 |
|
|
|
6 |
|
|
# Clean up tmp dir |
7 |
|
|
rm -rf /etc/pootle/tmp |
8 |
|
|
mkdir -p /etc/pootle/tmp /var/www/html/{patches,errors,anaconda} |
9 |
|
|
|
10 |
|
|
#========================================================== |
11 |
|
|
|
12 |
|
|
export CVS_RSH=ssh |
13 |
|
|
|
14 |
|
|
# Update/expand smeserver cvs |
15 |
|
|
cd /etc/pootle/cvs/smeserver |
16 |
|
|
for pkg in */sme7 anaconda/sme8 |
17 |
|
|
do |
18 |
|
|
make -C $pkg clean &> /dev/null |
19 |
|
|
done |
20 |
|
|
cvs update -dPA > /dev/null |
21 |
|
|
for pkg in */sme7 anaconda/sme8 |
22 |
|
|
do |
23 |
|
|
make -C $pkg prep &> /dev/null |
24 |
|
|
done |
25 |
|
|
|
26 |
|
|
# Update/expand smecontribs cvs |
27 |
|
|
cd /etc/pootle/cvs/smecontribs |
28 |
|
|
for pkg in */contribs7 |
29 |
|
|
do |
30 |
|
|
make -C $pkg clean &> /dev/null |
31 |
|
|
done |
32 |
|
|
cvs update -dPA > /dev/null |
33 |
|
|
for pkg in */contribs7 |
34 |
|
|
do |
35 |
|
|
make -C $pkg prep &> /dev/null |
36 |
|
|
done |
37 |
|
|
|
38 |
|
|
cd /etc/pootle/tmp |
39 |
|
|
|
40 |
|
|
#========================================================== |
41 |
|
|
|
42 |
|
|
# Take server down to prevent translation issues |
43 |
|
|
killall PootleServer |
44 |
|
|
|
45 |
|
|
#========================================================== |
46 |
|
|
|
47 |
|
|
# Update anaconda templates |
48 |
|
|
anacondatmpl > anaconda.pot |
49 |
|
|
diffmv anaconda.pot /etc/pootle/po/sme7bc/templates/anaconda.pot |
50 |
|
|
|
51 |
|
|
# Update console templates |
52 |
|
|
potempl $(find /etc/pootle/cvs/smeserver/e-smith-quota/ -type f -name adminQuotaSummary.tmpl) > adminQuotaSummary.tmpl.pot |
53 |
|
|
diffmv adminQuotaSummary.tmpl.pot /etc/pootle/po/sme7bc/templates/adminQuotaSummary.tmpl.pot |
54 |
|
|
potempl $(find /etc/pootle/cvs/smeserver/e-smith-backup/ -type f -name do_backup -o -regex '.*/crontab/backup') > backup.pot |
55 |
|
|
diffmv backup.pot /etc/pootle/po/sme7bc/templates/backup.pot |
56 |
|
|
potempl $(find /etc/pootle/cvs/smeserver/e-smith-manager/ -type f -name 25Copyright) > foot.tmpl.pot |
57 |
|
|
diffmv foot.tmpl.pot /etc/pootle/po/sme7bc/templates/foot.tmpl.pot |
58 |
|
|
potempl $(find /etc/pootle/cvs/smeserver/ -type f -regex '.*/e-?smith/console.*') > server-console.pot |
59 |
|
|
diffmv server-console.pot /etc/pootle/po/sme7bc/templates/server-console.pot |
60 |
|
|
potempl $(find /etc/pootle/cvs/smeserver/e-smith-quota/ -type f -name userOverQuota.tmpl) > userOverQuota.tmpl.pot |
61 |
|
|
diffmv userOverQuota.tmpl.pot /etc/pootle/po/sme7bc/templates/userOverQuota.tmpl.pot |
62 |
|
|
|
63 |
|
|
# Update panel templates |
64 |
|
|
for pkg in $(find /etc/pootle/cvs/smeserver/*/*7/*/root/etc/e-smith/locale/en-us/ -type f -print) |
65 |
|
|
do |
66 |
|
|
xmltempl $pkg "SME Panels" |
67 |
|
|
diffcp /etc/pootle/templates/$(basename $pkg).pot /etc/pootle/po/sme7bp/templates/$(basename $pkg).pot |
68 |
|
|
done |
69 |
|
|
|
70 |
|
|
# Update contrib panel templates |
71 |
|
|
for pkg in $(find /etc/pootle/cvs/smecontribs/*/*7/*/root/etc/e-smith/locale/en-us/ -type f -print) |
72 |
|
|
do |
73 |
|
|
xmltempl $pkg "Contrib Panels" |
74 |
|
|
diffcp /etc/pootle/templates/$(basename $pkg).pot /etc/pootle/po/sme7cp/templates/$(basename $pkg).pot |
75 |
|
|
done |
76 |
|
|
|
77 |
|
|
#========================================================== |
78 |
|
|
|
79 |
|
|
# Apply templates to languages |
80 |
|
|
for lang in $(ls -I templates /etc/pootle/po/sme* | grep '[[:alpha:]]$' | sort -u) |
81 |
|
|
do |
82 |
|
|
# Create error compendium to assist translators |
83 |
|
|
pocompendium -e errors-$lang.po -d /etc/pootle/po/sme*/$lang |
84 |
slords |
1.2 |
sed -i '0,/^$/d;/^#~/d' errors-$lang.po |
85 |
|
|
sed -i ':a;/^\n*$/{$d;N;ba;}' errors-$lang.po |
86 |
slords |
1.1 |
chmod 644 errors-$lang.po |
87 |
|
|
diffmv errors-$lang.po /var/www/html/errors/errors-$lang.po |
88 |
|
|
|
89 |
|
|
# Create compendium to assist translations |
90 |
|
|
pocompendium -c /etc/pootle/tmp/compendium-$lang.po -d /etc/pootle/po/*/$lang |
91 |
|
|
|
92 |
|
|
# Use compendium to migrate each project to new template |
93 |
|
|
for proj in $(ls -d /etc/pootle/po/sme*/$lang | sed 's@.*/\([^/]\+\)/[^/]\+$@\1@') |
94 |
|
|
do |
95 |
|
|
mkdir -p /etc/pootle/tmp/$proj/$lang |
96 |
|
|
pomigrate2 -F -C=/etc/pootle/tmp/compendium-$lang.po -q --no-wrap --locale=$lang /etc/pootle/po/$proj/$lang /etc/pootle/tmp/$proj/$lang /etc/pootle/po/$proj/templates > /dev/null |
97 |
|
|
|
98 |
|
|
# Ensure language is correct |
99 |
|
|
sed -i "/msgid \"en-us\"/{N;s@msgstr \"[^\"]*\"@msgstr \"$lang\"@}" /etc/pootle/tmp/$proj/$lang/* |
100 |
|
|
|
101 |
|
|
# Generate translation memory for panels |
102 |
|
|
updatetm --progress none -c 4 -i /etc/pootle/tmp/$proj/$lang -t /etc/pootle/tmp/compendium-$lang.po -o /etc/pootle/tmp/$proj/$lang |
103 |
|
|
done |
104 |
|
|
done |
105 |
|
|
|
106 |
|
|
# Set package name/version in new po files |
107 |
|
|
sed -i 's@Project-Id-Version.*\\n@Project-Id-Version: SME Console\\n@' /etc/pootle/tmp/sme7bc/*/*.po |
108 |
|
|
sed -i 's@Project-Id-Version.*\\n@Project-Id-Version: SME Anadonda\\n@' /etc/pootle/tmp/sme7bc/*/anaconda.po |
109 |
|
|
sed -i 's@Project-Id-Version.*\\n@Project-Id-Version: SME Panels\\n@' /etc/pootle/tmp/sme7bp/*/*.po |
110 |
|
|
sed -i 's@Project-Id-Version.*\\n@Project-Id-Version: Contrib Panels\\n@' /etc/pootle/tmp/sme7cp/*/*.po |
111 |
|
|
|
112 |
|
|
# Move files that have changed |
113 |
|
|
for chk in $(find /etc/pootle/tmp/sme* -type f) |
114 |
|
|
do |
115 |
|
|
diffmv $chk $(echo $chk | sed 's@/tmp/@/po/@') |
116 |
|
|
done |
117 |
|
|
|
118 |
|
|
#========================================================== |
119 |
|
|
|
120 |
|
|
# Recalculate stats and restart server |
121 |
|
|
cd /etc/pootle |
122 |
|
|
PootleServer --refreshstats &> /dev/null |
123 |
|
|
nohup PootleServer --servertype threaded >> /var/log/pootle.log 2>&1 & |
124 |
|
|
|
125 |
|
|
#========================================================== |
126 |
|
|
|
127 |
|
|
cd /etc/pootle/tmp |
128 |
|
|
|
129 |
|
|
# Build diffs for languages |
130 |
|
|
for lang in $(ls /etc/pootle/po/sme7bp -I templates) |
131 |
|
|
do |
132 |
|
|
# Build anaconda files |
133 |
|
|
mkdir -p /var/www/html/anaconda/sme7/$lang/LC_MESSAGES |
134 |
|
|
anacondagen sme7 $lang > /var/www/html/anaconda/sme7/$lang/LC_MESSAGES/anaconda.mo |
135 |
|
|
[ -s /var/www/html/anaconda/sme7/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/anaconda/sme7/$lang |
136 |
|
|
|
137 |
|
|
mkdir -p /var/www/html/anaconda/sme8/$lang/LC_MESSAGES |
138 |
|
|
anacondagen sme8 $lang > /var/www/html/anaconda/sme8/$lang/LC_MESSAGES/anaconda.mo |
139 |
|
|
[ -s /var/www/html/anaconda/sme8/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/anaconda/sme8/$lang |
140 |
|
|
|
141 |
|
|
# Build console files |
142 |
|
|
pkgname=$(ls -d /etc/pootle/cvs/smeserver/smeserver-locale/*7/*/root | cut -d/ -f8) |
143 |
|
|
mkdir -p ${pkgname}.update/po/$lang |
144 |
slords |
1.3 |
for pkg in $(ls /etc/pootle/po/sme7bc/templates/ | sed -n '/^anaconda.pot$/b;s@\.pot@\.po@p') |
145 |
slords |
1.1 |
do |
146 |
|
|
msgcat -F --no-wrap /etc/pootle/po/sme7bc/$lang/$pkg \ |
147 |
|
|
| grep -v 'Project-Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|X-Generator' \ |
148 |
|
|
| sed '0,/msgid ""/{/^#/d};/^#,/d' \ |
149 |
|
|
> ${pkgname}.update/po/$lang/$pkg |
150 |
|
|
done |
151 |
|
|
done |
152 |
|
|
|
153 |
|
|
# Build translated xml files |
154 |
|
|
for pkg in $(ls /etc/pootle/po/sme7*p/templates/ | sed -n 's@\.pot@@p') |
155 |
|
|
do |
156 |
|
|
pkgname=$(find /etc/pootle/cvs/smecontribs/*/*7/*/root/etc/e-smith/locale/en-us -name $pkg | cut -d/ -f8) |
157 |
|
|
if [ -z "$pkgname" ] |
158 |
|
|
then |
159 |
|
|
if [ -z "$(find /etc/pootle/cvs/smeserver/*/*7/*/root/etc/e-smith/locale/en-us -name $pkg)" ] |
160 |
|
|
then |
161 |
|
|
echo -e "\n *** Can't find package for $pkg ***\n" |
162 |
|
|
continue |
163 |
|
|
fi |
164 |
|
|
pkgname=$(ls -d /etc/pootle/cvs/smeserver/smeserver-locale/*7/*/root | cut -d/ -f8) |
165 |
|
|
else |
166 |
|
|
mkdir -p ${pkgname}.update/$(localedir en-us $pkg) |
167 |
|
|
cat /etc/pootle/templates/$pkg.orig \ |
168 |
|
|
| perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \ |
169 |
|
|
> ${pkgname}.update/$(localedir en-us $pkg)/$pkg |
170 |
|
|
fi |
171 |
|
|
for lang in $(ls /etc/pootle/po/sme7bp -I templates) |
172 |
|
|
do |
173 |
|
|
mkdir -p ${pkgname}.update/$(localedir $lang $pkg) |
174 |
|
|
xmlgen /etc/pootle/po/sme7*p/$lang/${pkg}.po \ |
175 |
|
|
> ${pkgname}.update/$(localedir $lang $pkg)/$pkg |
176 |
|
|
done |
177 |
|
|
done |
178 |
|
|
|
179 |
|
|
# Build xml diffs |
180 |
|
|
for pkg in $(ls -d *.update | sed 's@.update$@@') |
181 |
|
|
do |
182 |
|
|
orig=/etc/pootle/cvs/sme*/*/*7/$pkg/root/etc/e-smith/locale |
183 |
|
|
rm /var/www/html/patches/$(echo $pkg | sed 's/-[^-]\+$//')-*-locale-*.patch |
184 |
|
|
diff -ruN $orig $pkg.update/root/etc/e-smith/locale \ |
185 |
|
|
| sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/root/.*\)@\1 \2@;/^diff -ruN/d' \ |
186 |
|
|
> /var/www/html/patches/$pkg-locale-$(date +%F).patch |
187 |
|
|
done |
188 |
|
|
|
189 |
|
|
# Build console diffs |
190 |
|
|
pkg=$(ls -d smeserver-locale-* | sed 's@.update$@@') |
191 |
|
|
orig=/etc/pootle/cvs/smeserver/smeserver-locale/*7/$pkg/po |
192 |
|
|
rm /var/www/html/patches/$(echo $pkg | sed 's/-[^-]\+$//')-*-locale-*.patch |
193 |
|
|
diff -ruN $orig $pkg.update/po \ |
194 |
|
|
| sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/po/.*\)@\1 \2@;/^diff -ruN/d' \ |
195 |
|
|
>> /var/www/html/patches/$pkg-locale-$(date +%F).patch |
196 |
|
|
|