summaryrefslogtreecommitdiff
path: root/intltool-prepare.in
diff options
context:
space:
mode:
authormstachow <>2001-02-06 10:20:54 +0000
committermstachow <>2001-02-06 10:20:54 +0000
commit717041e168c12403724a84194c0718266d8ad9f1 (patch)
treee378795afa3ed1b67d30d56cfb9e71a3005c53d1 /intltool-prepare.in
parente544ffd6e5ac3d77758c4058eb926cf0e39c409f (diff)
downloadintltool-717041e168c12403724a84194c0718266d8ad9f1.tar.gz
reviewed by: George Lebl <jirka@eazel.com>
Robin * Slomkowski <rslomkow@eazel.com> Fixed bug 6199 (perl location is configured at xml-i18n-tools configure time -- not the configure time for a package that uses the tools) and 6250 (perl path hard-coded in selftest.pl). Also made 'make distcheck' work. * tests/Makefile.am: Screw around a bit so the self test script ends up executable after configure substitution. * tests/cases/.cvsignore: Ignore a new file * tests/cases/Makefile.am, tests/results/Makefile.am: Add missing files to EXTRA_DIST. * tests/selftest.pl.in: renamed from tests/selftest.pl, set perl path at configure time. * xml-i18n-unicodify.in: renamed from xml-i18n-unicodify, set perl path at configure time. * xml-i18n-extract.in.in, xml-i18n-merge.in.in, xml-i18n-prepare.in.in, xml-i18n-update.in.in: Renamed to .in.in from .in; substitute all variables except perl path at xml-i18n-tools configure time, so .in versions can be copied into modules when xml-i18n-toolizing. * xml-i18n-toolize.in: copy .in versions of tools into module. * xml-i18n-tools.Makefile.patch: don't change DISTFILES, this broke with the new changes. * xml-i18n-tools.m4: substitute xml-i18n-tools ; expect xml-i18n-* to be in builddir. * README: Updated instructions on how to use. * Makefile.am: Adjust what gets installed where. * configure.in: Adjust set of files being output.
Diffstat (limited to 'intltool-prepare.in')
-rwxr-xr-xintltool-prepare.in283
1 files changed, 0 insertions, 283 deletions
diff --git a/intltool-prepare.in b/intltool-prepare.in
deleted file mode 100755
index 8de2e64..0000000
--- a/intltool-prepare.in
+++ /dev/null
@@ -1,283 +0,0 @@
-#!/usr/bin/perl -w
-
-# XML I18N Desktop File Prepare Tool
-#
-# Copyright (C) 2001 Free Software Foundation.
-#
-# 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.
-#
-# Author(s): Gediminas Paulauskas <menesis@delfi.lt>
-# Kenneth Christiansen <kenneth@gnu.org>
-
-## Release information
-my $PROGRAM = "xml-i18n-extract";
-my $PACKAGE = "@PACKAGE@";
-my $VERSION = "@VERSION@";
-my $MAINTAINER = "<menesis\@delfi.lt>";
-
-## Loaded modules
-use strict;
-use Getopt::Long;
-use File::Find;
-
-## Scalars used by the option stuff
-my $HELP_ARG = "0";
-my $VERSION_ARG = "0";
-my $VERBOSE = "0";
-
-my @languages;
-my @desktop_files;
-my $new;
-my $file;
-
-my $desktop_extension = "(desktop|soundlist|keys|directory)+";
-my $desktop_find_regex = ".*desktop\\|soundlist\\|keys\\|directory";
-
-my $keywords = "Name|Comment|description";
-
-## Always print as the first thing
-$| = 1;
-
-## Handle options
-GetOptions (
- "help|h|?" => \$HELP_ARG,
- "version|v" => \$VERSION_ARG,
- "verbose|x" => \$VERBOSE
- ) or &invalid_option;
-
-
-## Use the supplied arguments
-## Check for options.
-## This section will check for the different options.
-
-sub split_on_argument {
-
- if ($VERSION_ARG) {
- &version;
-
- } elsif ($HELP_ARG) {
- &help;
-
- } else {
- &main;
- }
-}
-
-&split_on_argument;
-
-sub main
-{
- print "Working, please wait...\n" if (! $VERBOSE);
- &find_desktop_files;
- &append_keywords;
- &add_to_potfiles;
- &perform_rescue;
- &add_to_cvsignore;
- &generate_empty;
-}
-
-sub version{
-
- ## Print version information
- print "${PROGRAM} ${PACKAGE} $VERSION\n";
- print "Written by Gediminas Paulauskas <menesis\@delfi.lt>, 2000.\n\n";
- print "Copyright (C) 2000 Free Software Foundation, Inc.\n";
- print "This is free software; see the source for copying conditions. There is NO\n";
- print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n";
- exit;
-}
-
-sub help
-{
- ## Print usage information
- print "Usage: $PROGRAM [OPTION] KEYWORD ...\n";
- print "Updates pot files and merge them with the translations.\n";
- print "KEYWORD is additional key besides Name, Comment and description\n\n";
- print " -H, --help shows this help page\n";
- print " -X, --verbose show lots of feedback\n";
- print " -V, --version shows the version\n";
- print "Report bugs to $MAINTAINER.\n";
- exit;
-}
-
-sub invalid_option
-{
- ## Handle invalid arguments
- ## my $opt = $ARGV[0];
- ## print "$PROGRAM: invalid option -- $opt\n";
- print "Try `$PROGRAM --help' for more information.\n";
- exit 1;
-}
-
-sub append_keywords
-{
- my $arg;
- foreach $arg (@ARGV) {
- $keywords .= "|$arg";
- }
-}
-
-sub add_to_potfiles
-{
- open FILE, ">>po/POTFILES.in";
- my $intro = 0;
- foreach my $desktop (@desktop_files) {
- next if contains("po/POTFILES.in", "$desktop.in");
- # Print explanation comment only once
- unless ($intro) {
- print FILE "# files added by xml-i18n-prepare\n";
- $intro = 1;
- }
- print FILE "$desktop.in\n";
- }
- close FILE;
-}
-
-sub perform_rescue
-{
- foreach $file (@desktop_files) {
- &rescue_file($file);
- }
-}
-
-sub rescue_file
-{
- my ($filename) = @_;
- my ($msgid, $line, $lang);
-
- print "Rescuing translations from $filename ...\n" if $VERBOSE;
-
- open ORIG, "<$filename";
- $line = 1;
- while (<ORIG>) {
- chomp;
- $line++;
- my $entry = $_;
- if (($entry =~ /^($keywords)=(.*)$/) ||
- ($entry =~ /^(\s*description)=(.*)$/)) {
- $msgid = $2;
- $msgid =~ s/\"/\\"/;
- } elsif (($entry =~ /^($keywords)\[(.*?)\]=(.*)$/) ||
- ($entry =~ /^(\s*\[)(.*?)\]description=(.*)$/)) {
- $lang = $2;
- next if (!-s "po/$lang.po");
-
- my $msgstr = $3;
- $msgstr =~ s/"/\\"/g;
-
- $line--;
- next if contains("po/$lang.po", "msgid \"$msgid\"");
-
- open POFILE, ">>po/$lang.po";
-
- print POFILE "\n#: $filename.in:$line\n";
- print POFILE "msgid \"$msgid\"\n";
- print POFILE "msgstr \"$msgstr\"\n";
-
- close POFILE;
- }
- }
-}
-
-sub generate_empty
-{
- my $all = ' ';
- foreach my $full (@desktop_files) {
- $new = "$full.in";
- $all .= "$new ";
- print "Generating empty $new ...\n" if $VERBOSE;
- open FULL, "<$full";
- open NEW, ">$new";
-
- while (<FULL>) {
- unless (
- (/^($keywords)\[.*?\]=.*$/) ||
- (/^\s*\[(.*?)\]description=.*$/)
- ) {
- if (/^($keywords)=.*$/) {
- print NEW "_$_";
- } elsif (/^(\s*)(description=.*)$/) {
- print NEW "$1_$2\n";
- } else {
- print NEW;
- }
- }
- }
-
- close NEW;
- }
- print "*** Please add these files to CVS by following command: ***\n"
- . "cvs add$all\n";
-}
-
-sub add_to_cvsignore
-{
- my $all = ' ';
- my $ign;
- foreach $file (@desktop_files) {
- $file =~ /^(.*\/)*(.*?\.$desktop_extension$)$/;
- if ($1) {
- $ign = "$1.cvsignore";
- } else {
- $ign = ".cvsignore";
- }
- my $basename = $2;
-
- next if contains($ign, $basename);
-
- print "Appending $basename to $ign\n" if $VERBOSE;
- open FILE, ">>$ign";
- print FILE "$basename\n";
- $all .= "$file ";
- }
- close FILE;
- unless ($all eq ' ') {
- print "*** Please remove files from CVS by following command: ***\n"
- . "cvs remove -f$all\n";
- }
-}
-
-sub contains
-{
- my ($name, $expr) = @_;
- open CONT, "<$name";
- while (<CONT>) {
- return 1 if /^$expr$/;
- }
- return 0;
-}
-
-sub find_desktop_files
-{
- if ($VERBOSE) {
- print "Found these interesting files:\n";
- } else {
- print "Finding interesting files...";
- }
- find (\&wanted, '.');
- print "done\n" unless $VERBOSE;
-}
-
-sub wanted
-{
- if (/$desktop_extension$/) {
- my $file = $File::Find::name;
- $file =~ s/\.\///;
- push @desktop_files, $file;
- print "$file\n" if $VERBOSE;
- }
-}
-
-# vim: ts=4 sw=4 expandtab