diff options
author | nobody <nobody@localhost> | 2003-01-09 14:55:40 +0800 |
---|---|---|
committer | nobody <nobody@localhost> | 2003-01-09 14:55:40 +0800 |
commit | 4f34b87b2cd931be213c453c0a9c23e513a81953 (patch) | |
tree | 1e12040caec266ee2e16460c80583d4af3687d10 /help/update_po.pl | |
parent | 45d0c39700d2d6ee12f45c17778d69f3119ba078 (diff) | |
download | gsoc2013-evolution-GNOME_UTILS_2_2_1.tar gsoc2013-evolution-GNOME_UTILS_2_2_1.tar.gz gsoc2013-evolution-GNOME_UTILS_2_2_1.tar.bz2 gsoc2013-evolution-GNOME_UTILS_2_2_1.tar.lz gsoc2013-evolution-GNOME_UTILS_2_2_1.tar.xz gsoc2013-evolution-GNOME_UTILS_2_2_1.tar.zst gsoc2013-evolution-GNOME_UTILS_2_2_1.zip |
This commit was manufactured by cvs2svn to create tagGNOME_UTILS_2_2_1
'GNOME_UTILS_2_2_1'.
svn path=/tags/GNOME_UTILS_2_2_1/; revision=19339
Diffstat (limited to 'help/update_po.pl')
-rwxr-xr-x | help/update_po.pl | 212 |
1 files changed, 0 insertions, 212 deletions
diff --git a/help/update_po.pl b/help/update_po.pl deleted file mode 100755 index 7fa054e721..0000000000 --- a/help/update_po.pl +++ /dev/null @@ -1,212 +0,0 @@ -#!/usr/bin/perl -w -# -# Script for translators that extract .sgml files into .sgml.po ones -# -# Copyright (C) 2001 Héctor García Álvarez. -# -# This library 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 script 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 library; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# -# Authors: Héctor García Álvarez <hector@scouts-es.org> - -## Loaded modules -use strict; -use File::Basename; -use Getopt::Long; - -my $LANG = $ARGV[0]; -#my $OUTFILE = "./tmp/$FILE.h"; - -my %string = (); -my @elements; -my @items; -my $n=0; - -if (! $LANG){ - print "Usage: update_po.pl LANGCODE\n"; - exit; -} else { $LANG .=".po"; } - -if ( !(-d "./$LANG") ){ mkdir ("./$LANG", 0755) ; } - -chdir ("./C"); -if ( !(-d "./tmp") ) { mkdir ("./tmp", 0755) ; } - -my $comand=""; - -open FILES, "<POTFILES.in" ; -#open POTFILE, ">POTFILES.in.h"; -while (<FILES>) { - undef (%string); - s/\n//g; - my $Original_file = $_ ; - s/.\///g; - my $Converted_file = "./tmp/".$_.".h"; - # print $Original_file."\n"; - # print $Translated_file."\n"; - print "Converting ".$Original_file."\n" ; - system "rm -f $Converted_file"; - &Convert ($Original_file); - open OUT, ">>$Converted_file"; - &addMessages; - close OUT; - $comand = "xgettext --default-domain=$Original_file "; - $comand .="--directory=. --add-comments --keyword=_ --keyword=N_ "; - $comand .="$Converted_file "; - system ( $comand ); - print ("Updating $Original_file.po\n"); - system ("mv $Original_file.po ../$LANG/$Original_file.pot"); - - if ( -f "../$LANG/$Original_file.po") { - system ("cp ../$LANG/$Original_file.po ../$LANG/$Original_file.po.old"); - system ("msgmerge ../$LANG/$Original_file.po.old ../$LANG/$Original_file.pot -o ../$LANG/$Original_file.po"); - } else { - system ("mv ../$LANG/$Original_file.pot ../$LANG/$Original_file.po"); - } - - system ("msgfmt --statistics ../$LANG/$Original_file.po"); - system ("rm -f ../$LANG/$Original_file.pot"); -# print POTFILE $Converted_file."\n"; - print ".\n"; -} -close FILES; - -system ("rm -rf ./tmp "); -exit 0; - - -sub Convert() { - - ## Reading the file - open (IN, "<$_[0]") || die "can't open $_[0]: $!"; - - ### For translatable Sgml files ### - while (<IN>) { - if ( /<!--/ ) { - my $Salida = $_ ; - if ( (/-->/) ) { - $string{$Salida} = []; - } else { - while (<IN>) { - $Salida .= $_ ; - if ( /-->/ ) { last ; } - } - $string{$Salida} = []; - } - } - elsif ( /<para>/ ) { - my $number_of_para = 1; - my $Salida = $_ ; - if ( /<\/para>/ ) { - $string{$Salida} = []; - } else { - while (<IN>) { - if ( /<para>/ ) { $number_of_para++; } - $Salida .= $_ ; - if ( /<\/para>/ ) { - $number_of_para--; - if ( $number_of_para==0) {last ; } - } - } - $string{$Salida} = []; - } - } - elsif ( /<title>/ ) { - my $Salida = $_ ; - if ( /<\/title>/ ) { - $string{$Salida} = []; - } else { - while (<IN>) { - $Salida .= $_ ; - if ( /<\/title>/ ) { last ; } - } - $string{$Salida} = []; - } - } - elsif ( /<glossterm>/ ) { - my $Salida = $_ ; - if ( /<\/glossterm>/ ) { - $string{$Salida} = []; - } else { - while (<IN>) { - $Salida .= $_ ; - if ( /<\/glossterm>/ ) { last ; } - } - $string{$Salida} = []; - } - } - elsif ( /<guilabel>/ ) { - my $Salida = $_ ; - if ( /<\/guilabel>/ ) { - $string{$Salida} = []; - } else { - while (<IN>) { - $Salida .= $_ ; - if ( /<\/guilabel>/ ) { last ; } - } - $string{$Salida} = []; - } - } - } - close (IN); -} - -sub addMessages{ - - foreach my $theMessage (sort keys %string) { - - my ($tag) = $string{$theMessage} ; - - # Replace XML codes for special chars to - # geniune gettext syntax - #--------------------------------------- - $theMessage =~ s/"/\\"/mg; - $theMessage =~ s/\n/\\n\n/mg; - -# $theMessage =~ s/</</mg; -# $theMessage =~ s/>/>/mg; - - if ($theMessage =~ /\n/) { - #if ($tag) { print OUT "/* $tag */\n"; } - @elements = split (/\n/, $theMessage); - for ($n = 0; $n < @elements; $n++) { - - if ($n == 0) { - print OUT "gchar *s = N_"; - print OUT "(\"$elements[$n]\""; - if ($n == @elements - 1) { print OUT ");\n"; } - print OUT "\n"; - } - - elsif ($n == @elements - 1) { - print OUT " "; - print OUT "\"$elements[$n]\");\n\n"; - } - - elsif ($n > 0) { - print OUT " "; - print OUT "\"$elements[$n]\"\n"; - } - } - - } else { - -# if ($tag) { print OUT "/* $tag */\n"; } - print OUT "gchar *s = N_(\"$theMessage\");\n"; - } - - } -} - |