blob: 38bb244c6c08f03d61b17a55017a992d5e8bc1cb (
plain)
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
|
# Let's check if there is files in the import queue
[ -d po/import_queue/ ] || exit 0
# Let's fix the headers of the .po files in the import queue
for i in po/import_queue/*.po; do
b=`basename $i`;
po=${b#*-};
code=${po%.*}
lname=`head -n1 ${i} | sed 's/# \(.*\) translation.\{0,1\} for navit/\1/'`
if [[ $lname == "" ]]; then
echo "Cannot find the language name in the header of $i"
exit 1
fi
d=`date +"%Y"`
echo "# ${lname} translations for navit" > po/${po}.header
echo "# Copyright (C) 2006-${d} The Navit Team" >> po/${po}.header
echo "# This file is distributed under the same license as the navit package." >> po/${po}.header
echo "# Many thanks to the contributors of this translation:" >> po/${po}.header
# Build a clean list of the contributors
IFS=$'\n'
echo "Downloading https://translations.launchpad.net/navit/trunk/+pots/navit/${code}/+details"
contributors=`wget -q https://translations.launchpad.net/navit/trunk/+pots/navit/${code}/+details -O - | egrep '^ <a href=".+?" class="sprite person">'`
for user in $contributors; do
url=`echo $user|cut -d'"' -f2`
name=`echo $user|cut -d'>' -f2|cut -d'<' -f1`
echo "# $name $url" >> po/${po}.header
done
echo '' >> po/${po}.header
echo 'msgid ""' >> po/${po}.header
# We remove two tags that just generate noise
sed -i '/X-Launchpad-Export-Date/d' ${i}
sed -i '/X-Generator/d' ${i}
sed -i '/POT-Creation-Date/d' ${i}
# Let's put the translation from launchpad without the header
mv po/${po}.header po/${po}.in
sed '1,/msgid ""/ d' ${i} >> po/${po}.in
git rm -f $i
# Archive the po
[ -d $CIRCLE_ARTIFACTS/po ] || mkdir $CIRCLE_ARTIFACTS/po
cp po/${po}.in $CIRCLE_ARTIFACTS/po/
# Yay, we should have a clean .po file now!
git --no-pager diff po/${po}.in
done
|