#!/bin/bash # # Copyright 2005 Zuza Software Foundation # # This file is part of The Translate Toolkit. # # The Translate Toolkit 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. # # translate 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 translate; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # popuretext - extracts all the source text from a directory of POT files, removes # po headers and optionally the accelerator keys. if [ $# -lt 2 ]; then echo "Usage: popuretext pot-dir file.txt [accelerator]" exit 1 fi potdir=$1 textfile=$2 accelerator=$3 tempdir=`mktemp -t /tmp -d` for pot in `cd $potdir; find . -name "*.pot"` do mkdir -p $tempdir/$(dirname $pot) msgen --no-wrap $potdir/$pot -o $tempdir/$(dirname $pot)/$(basename $pot .pot).po done cat /dev/null > $textfile for po in `find $tempdir -name "*.po"` do msgexec -i $po sed "s/$/\\n/g" | sed "/^_:/d" | sed "/^$/d" | sed "s/$accelerator//g" | sed "/^\(Project-Id-Version:\|Report-Msgid-Bugs-To:\|POT-Creation-Date:\|PO-Revision-Date:\|Last-Translator:\|Language-Team:\|MIME-Version:\|Content-Type:\|Content-Transfer-Encoding:\|Plural-Forms:\|X-Generator:\|X-Accelerator-Marker:\)/d" >> $textfile done