Author: mdke Date: Sun Apr 8 10:30:17 2007 New Revision: 4079 Added: branches/feisty/generic/translate.sh (contents, props changed)
Log: translate script Added: branches/feisty/generic/translate.sh ============================================================================== --- (empty file) +++ branches/feisty/generic/translate.sh Sun Apr 8 10:30:17 2007 @@ -0,0 +1,85 @@ +#!/bin/sh + +#################################################################################### +# Copyright (C) 2005-2006 Ubuntu Documentation Project ([EMAIL PROTECTED]) +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# On Debian based systems a copy of the GPL can be found +# at /usr/share/common-licenses/GPL +#################################################################################### + +# NB - DON'T ATTEMPT TO USE THIS YET, IT HASN'T BEEN TESTED MUCH. +# +# This script is for generating XML documents from po files downloaded from Launchpad +# Put your freshly downloaded po files into the po folder under each document, then run: +# +# $ translate.sh +# +# Optional parameters: +# -d<documentname> +# -l<language> +# + +translate () { + y=$(basename ${1} .po) + echo " ${y}" + mkdir -p ${y} + for i in C/*xml; do + j=$(basename ${i} C/) + echo ${j} + k=$(basename ${j} .xml) + echo ${k} + xml2po -e -p po/${y}.po C/${j} >${y}/${j} + done + if [ -e C/${document}-C.omf ]; then + echo " Generating omf file for ${document}" + xml2po -e -p ${1} C/${document}-C.omf >${y}/${document}-${y}.omf + sed -i -e [EMAIL PROTECTED]"C\"@\"${y}\"@g -e [EMAIL PROTECTED]/@${y}/@g ${y}/${document}-${y}.omf + fi + ../../validate.sh ${y}/${document}.xml + svn add ${y} +} + +choose_language () { + echo "Entering ${1}" + cd ${1} + if [ ${2} ]; then + translate "po/${2}.po" + else + for x in po/*; do + translate ${x} + done + fi + rm .xml2po.mo + cd .. +} + +while getopts "d:l:" Option +do + case ${Option} in + d) document=${OPTARG};; + l) lang=${OPTARG};; + *) echo "Please specify an argument.";; + esac +done + +if [ ${document} ]; then + choose_language ${document} ${lang} +else + for doc in serverguide + do + choose_language ${doc} ${lang} + done +fi + -- ubuntu-doc-commits mailing list ubuntu-doc-commits@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-doc-commits