3
# Ensure we're running from the ubuntu-kylin-docs project root directory
4
if [ ! -d ubuntu-kylin-help ]; then
5
echo "ERROR: You must run this script from the ubuntu-kylin-docs project root directory."
9
# Ensure the URL to the translation files tarball has been specified
13
echo " FILE The tarball of .po files that Launchpad provides."
17
# Location to store downloaded tarball
20
if [ ! -e "$TMPDOCS" ]; then
21
echo "ERROR: File $TMPDOCS does not exist!"
25
echo "Extracting translations from $TMPDOCS..."
26
tar -zxf "$TMPDOCS" --exclude='*.pot'
28
echo "Renaming translation files..."
30
for i in ./ubuntu-help/*/ubuntu-help-*.po; do
32
NEWFILENAME=$(basename $i | sed -e 's/^ubuntu-help-//')
33
POLANG=$(basename $i .po | sed -e 's/^ubuntu-help-//')
34
POLANGS="$POLANGS $POLANG"
35
mkdir -p ./ubuntu-kylin-help/$POLANG
36
mv $OLDFILENAME ./ubuntu-kylin-help/$POLANG/$NEWFILENAME
39
echo "Updating Makefile.am..."
40
cp ./ubuntu-kylin-help/Makefile.am ./ubuntu-kylin-help/Makefile.am.old
41
sed "s/HELP_LINGUAS = .*$/HELP_LINGUAS =$POLANGS/" ./ubuntu-kylin-help/Makefile.am.old > ./ubuntu-kylin-help/Makefile.am
42
rm -fr ./ubuntu-kylin-help/Makefile.am.old