From 984d50b3e31de17611c296885b151dee7198a47f Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 1 Feb 2010 15:52:12 +0100 Subject: [PATCH] =?utf8?q?scripts/locales.pl=20mit=20und=20ohne=20Argument?= =?utf8?q?=20ausf=C3=BChrbar=20gemacht?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Das locales.pl-Script kann wie folgt aufgerufen werden: 1. Aus einem locale-Unterverzeichnis, in dem 'all' und 'LANGUAGE' existieren: cd locale/de ../../scripts/locales.pl 2. Aus einem beliebigen Verzeichnis unter Angabe des Sprachkürzels: ./scripts/locales.pl de 3. Aus einem beliebigen Verzeichnis unter Angabe des relativen oder absoluten Pfades zum locale-Unterverzeichnis: ./scripts/locales.pl ./locale/de Conflicts: scripts/locales.pl --- scripts/locales.pl | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/scripts/locales.pl b/scripts/locales.pl index dd7c4ca37..f2bf87000 100755 --- a/scripts/locales.pl +++ b/scripts/locales.pl @@ -23,13 +23,12 @@ $OUTPUT_AUTOFLUSH = 1; my $opt_v = 0; my $opt_n = 0; my $opt_c = 0; -my $lang; my $debug = 0; parse_args(); -my $basedir = "."; -my $locales_dir = "$basedir/locale/$lang"; +my $basedir = "../.."; +my $locales_dir = "."; my $bindir = "$basedir/bin/mozilla"; my $dbupdir = "$basedir/sql/Pg-upgrade"; my $dbupdir2 = "$basedir/sql/Pg-upgrade2"; @@ -185,7 +184,25 @@ sub parse_args { exit 0; } - $lang = shift @ARGV || croak 'need language code as argument'; + if (@ARGV) { + my $arg = shift @ARGV; + my $ok = 0; + foreach my $dir ("../locale/$arg", "locale/$arg", "../$arg", $arg) { + next unless -d $dir && -f "$dir/all" && -f "$dir/LANGUAGE"; + $ok = chdir $dir; + last; + } + + if (!$ok) { + print "The locale directory '$arg' could not be found.\n"; + exit 1; + } + + } elsif (!-f 'all' || !-f 'LANGUAGE') { + print "locales.pl was not called from a locale/* subdirectory,\n" + . "and no locale directory name was given.\n"; + exit 1; + } } sub handle_file { -- 2.20.1