~ubuntu-branches/ubuntu/vivid/ubuntu-kylin-docs/vivid

« back to all changes in this revision

Viewing changes to update-translations.sh

  • Committer: Package Import Robot
  • Author(s): Lei Luo
  • Date: 2014-04-10 14:58:12 UTC
  • Revision ID: package-import@ubuntu.com-20140410145812-9mfgq3xleqy0l89f
Tags: 14.04.3

* Add "Replaces" field in debian control file to automatically remove
  ubuntu-docs before installation.
* Merge ubuntu-docs changes.
* Update zh_CN tranlation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
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."
 
6
    exit 1
 
7
fi
 
8
 
 
9
# Ensure the URL to the translation files tarball has been specified
 
10
if [ $# -lt 1 ]; then
 
11
    echo "Usage: $0 FILE"
 
12
    echo ""
 
13
    echo "    FILE         The tarball of .po files that Launchpad provides."
 
14
    exit 1
 
15
fi
 
16
 
 
17
# Location to store downloaded tarball
 
18
TMPDOCS="$1"
 
19
 
 
20
if [ ! -e "$TMPDOCS" ]; then
 
21
    echo "ERROR: File $TMPDOCS does not exist!"
 
22
    exit 1
 
23
fi
 
24
 
 
25
echo "Extracting translations from $TMPDOCS..."
 
26
tar -zxf "$TMPDOCS" --exclude='*.pot'
 
27
 
 
28
echo "Renaming translation files..."
 
29
POLANGS=""
 
30
for i in ./ubuntu-help/*/ubuntu-help-*.po; do
 
31
    OLDFILENAME=$i
 
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
 
37
done
 
38
 
 
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
 
43
 
 
44
echo "Done!"
 
45