summaryrefslogtreecommitdiff
path: root/hacks/i18nup
blob: fa65bdfa2ec574e805c905b2223dbcbb1905162f (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
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
#!/bin/bash
changes=`git status -s | grep "^ M"`
check=`echo "$changes" | grep -v /po/`
if [ "$check" != "" ]; then
  echo "Non i18n updates would be committed"
  exit 1
fi

if [[ `echo $changes | grep de_DE` != "" ]]; then
  language="de_DE"
  translator="Carsten Kurz"
elif [[ `echo $changes | grep nl_NL` != "" ]]; then
  language="nl_NL"
  translator="Rob van Nieuwkerk"
elif [[ `echo $changes | grep es_ES` != "" ]]; then
  language="es_ES"
  translator="Manuel AC"
elif [[ `echo $changes | grep sv_SE` != "" ]]; then
  language="sv_SE"
  translator="Adam Klotblixt"
elif [[ `echo $changes | grep fr_FR` != "" ]]; then
  language="fr_FR"
  translator="Thierry Journet"
elif [[ `echo $changes | grep ru_RU` != "" ]]; then
  language="ru_RU"
  translator="Igor Voytovich"
elif [[ `echo $changes | grep uk_UA` != "" ]]; then
  language="uk_UA"
  translator="Igor Voytovich"
elif [[ `echo $changes | grep cs_CZ` != "" ]]; then
  language="cs_CZ"
  translator="Tomáš Begeni"
elif [[ `echo $changes | grep pt_BR` != "" ]]; then
  language="pt_BR"
  translator="Max M. Fuhlendorf"
elif [[ `echo $changes | grep zh_CN` != "" ]]; then
  language="zh_CN"
  translator="Rov (若文)"
elif [[ `echo $changes | grep da_DK` != "" ]]; then
  language="da_DK"
  translator="Anders Uhl Pedersen"
elif [[ `echo $changes | grep pl_PL` != "" ]]; then
  language="pl_PL"
  translator="Mike Mazur"
elif [[ `echo $changes | grep it_IT` != "" ]]; then
  language="it_IT"
  translator="Riccardo Mantani"
else
  echo "Unknown language"
  exit 1
fi

date=`date +%Y-%m-%d`

tag="$date  Carl Hetherington  <cth@carlh.net>"
msg="Updated $language translation from $translator."

echo "$tag" > /tmp/$$.changelog
echo "" >> /tmp/$$.changelog
echo -e "\t* $msg" >> /tmp/$$.changelog
echo "" >> /tmp/$$.changelog

if [[ `head -n 1 ChangeLog` == "$tag" ]]; then
    echo "Trimming!"
    tail -n +3 ChangeLog > /tmp/$$.trimmed
    mv /tmp/$$.trimmed ChangeLog
fi

cat /tmp/$$.changelog | cat - ChangeLog > /tmp/$$.joined
rm /tmp/$$.changelog
mv /tmp/$$.joined ChangeLog

git diff

echo "OK?"
read yes
if [ "$yes" == "y" ]; then
    git commit -a -m "$msg"
fi