Alternc  latest
Alternc logiel libre pour l'hébergement
repos-to-tx.sh
Go to the documentation of this file.
1 #!/bin/bash
2 
3 #------------------------------------------------------------
4 # Short doc: launch this after big changes, so that
5 # people who translate the project have the new strings ;)
6 #------------------------------------------------------------
7 
8 # USE IT INSIDE alternc/ folder which MUST BE a git clone
9 #
10 # Long doc:
11 # Take each sub-project of AlternC
12 # (EXPECTED IN PARENT FOLDERS from here)
13 # and regenerate the .POT
14 # then regenerate the .PO for each language
15 # then merge them into one big .po file and
16 # put them in the lang/ folder
17 #
18 # finally, push en_US to transifex
19 # to be translated.
20 
21 if [ ! -x /usr/bin/tx ] ; then
22  echo "Package transifex-client is not installed."
23  echo "Install it to run $0."
24  exit 1
25 fi
26 
27 pushd debian
28 echo "Update of PO files in debian/"
29 debconf-updatepo
30 popd
31 
32 pushd ..
33 
34 langs="fr_FR de_DE en_US es_ES pt_BR it_IT nl_NL"
35 
36 # external repositories :
37 for project in alternc alternc-mailman
38 do
39  pushd "$project/bureau/locales"
40  make
41  popd
42 done
43 
44 # internal po files :
45 for subproject in awstats
46 do
47  pushd "alternc/$subproject/bureau/locales"
48  make
49  popd
50 done
51 
52 # now merge all the po's for each language
53 for lang in $langs
54 do
55  sublang="`echo $lang | cut -c 1-2`"
56  echo "doing lang $lang"
57  rm -rf "alternc/tmp.$lang"
58  mkdir "alternc/tmp.$lang"
59  # po-debconf : (they are using only the language code, not lang_country
60 # if [ "$sublang" != "en" ] ; then
61  cp "alternc/debian/po/${sublang}.po" "alternc/tmp.$lang/alternc.debconf.po"
62  cp "alternc-mailman/debian/po/${sublang}.po" "alternc/tmp.$lang/alternc-mailman.debconf.po"
63 # cp "alternc/trunk/awstats/debian/po/${sublang}.po" "alternc/trunk/tmp.$lang/alternc-awstats.debconf.po"
64 # else
65 # cp "alternc/trunk/debian/po/templates.pot" "alternc/trunk/tmp.$lang/alternc.debconf.po"
66 # cp "alternc-mailman/trunk/debian/po/templates.pot" "alternc/trunk/tmp.$lang/alternc-mailman.debconf.po"
67 # fi
68  cp "alternc/bureau/locales/$lang/LC_MESSAGES/messages.po" \
69  "alternc-mailman/bureau/locales/$lang/LC_MESSAGES/mailman.po" \
70  "alternc/awstats/bureau/locales/$lang/LC_MESSAGES/aws.po" \
71  "alternc/tmp.$lang/"
72  # now we have all .po files in one folder, merge them into one big catalog:
73  msgcat --use-first -o "alternc/lang/${lang}.po" alternc/tmp.$lang/*
74  rm -rf "alternc/tmp.$lang"
75  echo "done"
76 done
77 
78 # Now pushing po files into transifex website:
79 cd alternc/lang/
80 tx push -s
81 
82 popd