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

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

# Long doc: 
9
# Take each sub-project of AlternC 
10
# (EXPECTED IN PARENT FOLDERS of alternc/trunk/)
11 12 13 14
# (yes, one day we will be united again ;) )
# and regenerate the .POT 
# then regenerate the .PO for each language
# then merge them into one big .po file and 
15
# put them in the lang/ folder
16
#
17 18 19
# finally, push en_US to transifex
# to be translated.

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

pushd ../..

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

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

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

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

# Now pushing po files into transifex website:
cd alternc/trunk/lang/
tx push -s 

popd