repos-to-tx.sh 2.29 KB
Newer Older
1 2
#!/bin/bash

3 4 5 6 7
#------------------------------------------------------------
# Short doc: launch this after big changes, so that 
# people who translate the project have the new strings ;) 
#------------------------------------------------------------

8 9
# USE IT INSIDE alternc/ folder which MUST BE a git clone
# 
10
# Long doc: 
11
# Take each sub-project of AlternC 
12
# (EXPECTED IN PARENT FOLDERS from here)
13 14 15
# and regenerate the .POT 
# then regenerate the .PO for each language
# then merge them into one big .po file and 
16
# put them in the lang/ folder
17
#
18 19 20
# finally, push en_US to transifex
# to be translated.

21 22 23 24 25
if [ ! -x /usr/bin/tx ] ; then
  echo "Package transifex-client is not installed."
  echo "Install it to run $0."
  exit 1
fi
26

27
pushd ..
28

29
langs="fr_FR de_DE en_US es_ES pt_BR it_IT nl_NL"
30

31 32
# external repositories : 
for project in alternc alternc-mailman
33
do
34
    pushd "$project/bureau/locales"
35 36 37 38
    make
    popd
done

39 40 41
# internal po files : 
for subproject in awstats 
do
42
    pushd "alternc/$subproject/bureau/locales"
43 44 45 46
    make
    popd
done

47
# now merge all the po's for each language
48 49 50 51
for lang in $langs
do
    sublang="`echo $lang | cut -c 1-2`"
    echo "doing lang $lang"
52 53
    rm -rf "alternc/tmp.$lang"
    mkdir "alternc/tmp.$lang"
54
    # po-debconf : (they are using only the language code, not lang_country
55
#    if [ "$sublang" != "en" ] ; then
56 57
	cp "alternc/debian/po/${sublang}.po" "alternc/tmp.$lang/alternc.debconf.po"
	cp "alternc-mailman/debian/po/${sublang}.po" "alternc/tmp.$lang/alternc-mailman.debconf.po"
58
#	cp "alternc/trunk/awstats/debian/po/${sublang}.po" "alternc/trunk/tmp.$lang/alternc-awstats.debconf.po"
59 60 61 62
#    else
#	cp "alternc/trunk/debian/po/templates.pot" "alternc/trunk/tmp.$lang/alternc.debconf.po"
#	cp "alternc-mailman/trunk/debian/po/templates.pot" "alternc/trunk/tmp.$lang/alternc-mailman.debconf.po"	
#    fi
63 64 65 66
    cp "alternc/bureau/locales/$lang/LC_MESSAGES/messages.po" \
	"alternc-mailman/bureau/locales/$lang/LC_MESSAGES/mailman.po" \
	"alternc/awstats/bureau/locales/$lang/LC_MESSAGES/aws.po" \
	"alternc/tmp.$lang/" 
67
    # now we have all .po files in one folder, merge them into one big catalog: 
68 69
    msgcat --use-first -o "alternc/lang/${lang}.po" alternc/tmp.$lang/*
    rm -rf "alternc/tmp.$lang"
70 71 72 73
   echo "done"
done

# Now pushing po files into transifex website:
74
cd alternc/lang/
75 76 77
tx push -s 

popd