1 |
#!/bin/bash |
2 |
|
3 |
# Functions |
4 |
. /etc/pootle/bin/functions |
5 |
|
6 |
#========================================================== |
7 |
|
8 |
cd /etc/pootle/tmp |
9 |
|
10 |
# Build diffs for languages |
11 |
for lang in $(ls /etc/pootle/po/sme7bp -I templates) |
12 |
do |
13 |
# Build anaconda files |
14 |
mkdir -p /var/www/html/anaconda/sme7/$lang/LC_MESSAGES |
15 |
anacondagen sme7 $lang > /var/www/html/anaconda/sme7/$lang/LC_MESSAGES/anaconda.mo |
16 |
[ -s /var/www/html/anaconda/sme7/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/anaconda/sme7/$lang |
17 |
|
18 |
mkdir -p /var/www/html/anaconda/sme8/$lang/LC_MESSAGES |
19 |
anacondagen sme8 $lang > /var/www/html/anaconda/sme8/$lang/LC_MESSAGES/anaconda.mo |
20 |
[ -s /var/www/html/anaconda/sme8/$lang/LC_MESSAGES/anaconda.mo ] || rm -rf /var/www/html/anaconda/sme8/$lang |
21 |
|
22 |
# Build console files |
23 |
pkgname=$(ls -d /etc/pootle/cvs/smeserver/smeserver-locale/*7/*/root | cut -d/ -f8) |
24 |
mkdir -p ${pkgname}.update/po/$lang |
25 |
for pkg in $(ls /etc/pootle/po/sme7bc/templates/ -I anaconda.pot | sed 's@\.pot@\.po@') |
26 |
do |
27 |
msgcat -F --no-wrap /etc/pootle/po/sme7bc/$lang/$pkg \ |
28 |
| grep -v 'Project-Id-Version\|Report-Msgid-Bugs-To\|POT-Creation-Date\|PO-Revision-Date\|Last-Translator\|Language-Team\|X-Generator' \ |
29 |
| sed '0,/msgid ""/{/^#/d};/^#,/d' \ |
30 |
> ${pkgname}.update/po/$lang/$pkg |
31 |
done |
32 |
done |
33 |
|
34 |
# Build translated xml files |
35 |
for pkg in $(ls /etc/pootle/po/sme7*p/templates/ | sed -n 's@\.pot@@p') |
36 |
do |
37 |
pkgname=$(find /etc/pootle/cvs/smecontribs/*/*7/*/root/etc/e-smith/locale/en-us -name $pkg | cut -d/ -f8) |
38 |
if [ -z "$pkgname" ] |
39 |
then |
40 |
if [ -z "$(find /etc/pootle/cvs/smeserver/*/*7/*/root/etc/e-smith/locale/en-us -name $pkg)" ] |
41 |
then |
42 |
echo -e "\n *** Can't find package for $pkg ***\n" |
43 |
continue |
44 |
fi |
45 |
pkgname=$(ls -d /etc/pootle/cvs/smeserver/smeserver-locale/*7/*/root | cut -d/ -f8) |
46 |
else |
47 |
mkdir -p ${pkgname}.update/$(localedir en-us $pkg) |
48 |
cat /etc/pootle/templates/$pkg.orig \ |
49 |
| perl -pe 's@_AMP_@&@g;s@_{_@<@g;s@_}_@>@g' \ |
50 |
> ${pkgname}.update/$(localedir en-us $pkg)/$pkg |
51 |
fi |
52 |
for lang in $(ls /etc/pootle/po/sme7bp -I templates) |
53 |
do |
54 |
mkdir -p ${pkgname}.update/$(localedir $lang $pkg) |
55 |
xmlgen /etc/pootle/po/sme7*p/$lang/${pkg}.po \ |
56 |
> ${pkgname}.update/$(localedir $lang $pkg)/$pkg |
57 |
done |
58 |
done |
59 |
|
60 |
# Build xml diffs |
61 |
for pkg in $(ls -d *.update | sed 's@.update$@@') |
62 |
do |
63 |
orig=/etc/pootle/cvs/sme*/*/*7/$pkg/root/etc/e-smith/locale |
64 |
rm /var/www/html/patches/$(echo $pkg | sed 's/-[^-]\+$//')-*-locale-*.patch |
65 |
diff -ruN $orig $pkg.update/root/etc/e-smith/locale \ |
66 |
| sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/root/.*\)@\1 \2@;/^diff -ruN/d' \ |
67 |
> /var/www/html/patches/$pkg-locale-$(date +%F).patch |
68 |
done |
69 |
|
70 |
# Build console diffs |
71 |
pkg=$(ls -d smeserver-locale-* | sed 's@.update$@@') |
72 |
orig=/etc/pootle/cvs/smeserver/smeserver-locale/*7/$pkg/po |
73 |
rm /var/www/html/patches/$(echo $pkg | sed 's/-[^-]\+$//')-*-locale-*.patch |
74 |
diff -ruN $orig $pkg.update/po \ |
75 |
| sed 's@^\(---\|+++\) [^ ]\+/\([^/]\+/po/.*\)@\1 \2@;/^diff -ruN/d' \ |
76 |
>> /var/www/html/patches/$pkg-locale-$(date +%F).patch |
77 |
|