~ubuntu-branches/ubuntu/maverick/kubuntu-docs/maverick

« back to all changes in this revision

Viewing changes to kubuntu/translate.sh

  • Committer: Bazaar Package Importer
  • Author(s): Richard A. Johnson
  • Date: 2008-08-18 10:49:14 UTC
  • Revision ID: james.westby@ubuntu.com-20080818104914-83r2er2hsmdp2o0l
Tags: 8.10-2
* Restructured kubuntu documentation package
  - Refer to the NEWS text located in the root directory of the package
* Removed the Firefox start page files
* debian/rules: updated to remove firefox files
* debian/control: removed perl deps due to removal of firefox files, bumped
  version to 3.8.0, updated kdelibs-data dep to kdelibs5-data

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
 
3
 
####################################################################################           
4
 
# Copyright (C) 2005-2006 Ubuntu Documentation Project (ubuntu-doc@lists.ubuntu.com)
5
 
#    This program is free software; you can redistribute it and/or modify
6
 
#    it under the terms of the GNU General Public License as published by
7
 
#    the Free Software Foundation; either version 2 of the License, or
8
 
#    (at your option) any later version. 
9
 
#
10
 
#    This program is distributed in the hope that it will be useful,
11
 
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
#    GNU General Public License for more details.
14
 
#
15
 
#    You should have received a copy of the GNU General Public License
16
 
#    along with this program; if not, write to the Free Software
17
 
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
 
#    On Debian based systems a copy of the GPL can be found 
19
 
#    at /usr/share/common-licenses/GPL
20
 
####################################################################################
21
 
 
22
 
# This script is for generating XML documents from po files downloaded from Launchpad
23
 
# Put your freshly downloaded po files into the po folder under each document, then run:
24
 
#
25
 
# $ translate.sh
26
 
#
27
 
# Optional parameters:
28
 
#       -d<documentname>
29
 
#       -l<language>
30
 
#
31
 
 
32
 
translate () {
33
 
        y=$(basename ${1} .po)
34
 
        echo " ${y}"
35
 
        mkdir -p ${y}
36
 
        for i in C/*xml; do
37
 
                j=$(basename ${i} C/)
38
 
                k=$(basename ${j} .xml)
39
 
                xml2po -e -p po/${y}.po C/${j} >${y}/${j}
40
 
        done
41
 
        if [ -e C/${document}-C.omf ]; then
42
 
                echo "  Generating omf file for ${document}"
43
 
            xml2po -e -p ${1} C/${document}-C.omf >${y}/${document}-${y}.omf
44
 
            sed -i -e s@\"C\"@\"${y}\"@g -e s@C/@${y}/@g ${y}/${document}-${y}.omf
45
 
        fi
46
 
}
47
 
 
48
 
choose_language () {
49
 
        echo "Entering ${1}"
50
 
        cd ${1}
51
 
        if [ ${2} ]; then
52
 
                translate "po/${2}.po"
53
 
        else
54
 
                for x in po/*; do
55
 
                        translate ${x}
56
 
                done
57
 
        fi
58
 
        rm .xml2po.mo
59
 
        cd ..
60
 
}
61
 
 
62
 
while getopts "d:l:" Option
63
 
do
64
 
        case ${Option} in
65
 
                d) document=${OPTARG};;
66
 
                l) lang=${OPTARG};;
67
 
                *) echo "Please specify an argument.";;
68
 
        esac
69
 
done
70
 
 
71
 
if [ ${document} ]; then
72
 
        choose_language ${document} ${lang}
73
 
else
74
 
        for doc in `cat libs/shipped-docs`
75
 
        do
76
 
                choose_language ${doc} ${lang}
77
 
        done
78
 
fi
79