From: Moritz Bunkus Date: Mon, 1 Feb 2010 14:52:12 +0000 (+0100) Subject: scripts/locales.pl mit und ohne Argument ausführbar gemacht X-Git-Tag: release-2.6.2beta1~260 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=984d50b3e31de17611c296885b151dee7198a47f;p=kivitendo-erp.git scripts/locales.pl mit und ohne Argument ausführbar gemacht 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 --- 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 {