From a5bf60bfaada25efe437b309823dc85a74055630 Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Sat, 25 Apr 2015 17:54:08 +0200 Subject: Added --locales-dir also to rpmdragora --- lib/ManaTools/Rpmdragora/init.pm | 55 +++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 23 deletions(-) (limited to 'lib/ManaTools/Rpmdragora') diff --git a/lib/ManaTools/Rpmdragora/init.pm b/lib/ManaTools/Rpmdragora/init.pm index f28af34..f029cfb 100644 --- a/lib/ManaTools/Rpmdragora/init.pm +++ b/lib/ManaTools/Rpmdragora/init.pm @@ -51,31 +51,40 @@ our @EXPORT = qw(init our @ARGV_copy = @ARGV; BEGIN { #- we want to run this code before the Gtk->init of the use-my_gtk - my $loc = ManaTools::Shared::Locales->new(domain_name => 'rpmdrake'); + my $locale_dir = undef; + $DB::single = 1; + if ("@ARGV" =~/--locales-dir(\s*(.+))/) { + $locale_dir = $2 ? $2 : $1; + } + my $loc = ManaTools::Shared::Locales->new( + domain_name => 'manatools', + dir_name => $locale_dir, + ); + my $basename = sub { local $_ = shift; s|/*\s*$||; s|.*/||; $_ }; any { /^--?h/ } @ARGV and do { - printf join("\n", $loc->N("Usage: %s [OPTION]...", $basename->($0)), -$loc->N(" --auto assume default answers to questions"), -$loc->N(" --changelog-first display changelog before filelist in the description window"), -$loc->N(" --media=medium1,.. limit to given media"), -$loc->N(" --merge-all-rpmnew propose to merge all .rpmnew/.rpmsave files found"), -$loc->N(" --mode=MODE set mode (install (default), remove, update)"), -$loc->N(" --justdb update the database, but do not modify the filesystem"), -$loc->N(" --no-confirmation don't ask first confirmation question in update mode"), -$loc->N(" --no-media-update don't update media at startup"), -$loc->N(" --no-verify-rpm don't verify package signatures"), -if_($0 !~ /dragoraUpdate/, $loc->N(" --parallel=alias,host be in parallel mode, use \"alias\" group, use \"host\" machine to show needed deps")), -$loc->N(" --rpm-root=path use another root for rpm installation"), -$loc->N(" --urpmi-root use another root for urpmi db & rpm installation"), -$loc->N(" --run-as-root force to run as root"), -$loc->N(" --search=pkg run search for \"pkg\""), -$loc->N(" --test only verify if the installation can be achieved correctly"), -chomp_($loc->N(" --version print this tool's version number -")), -"" -); - exit 0; + printf join("\n", $loc->N("Usage: %s [OPTION]...", $basename->($0)), + $loc->N(" --auto assume default answers to questions"), + $loc->N(" --changelog-first display changelog before filelist in the description window"), + $loc->N(" --media=medium1,.. limit to given media"), + $loc->N(" --merge-all-rpmnew propose to merge all .rpmnew/.rpmsave files found"), + $loc->N(" --mode=MODE set mode (install (default), remove, update)"), + $loc->N(" --justdb update the database, but do not modify the filesystem"), + $loc->N(" --no-confirmation don't ask first confirmation question in update mode"), + $loc->N(" --no-media-update don't update media at startup"), + $loc->N(" --no-verify-rpm don't verify package signatures"), + if_($0 !~ /dragoraUpdate/, $loc->N(" --parallel=alias,host be in parallel mode, use \"alias\" group, use \"host\" machine to show needed deps")), + $loc->N(" --rpm-root=path use another root for rpm installation"), + $loc->N(" --urpmi-root use another root for urpmi db & rpm installation"), + $loc->N(" --run-as-root force to run as root"), + $loc->N(" --search=pkg run search for \"pkg\""), + $loc->N(" --test only verify if the installation can be achieved correctly"), + chomp_($loc->N(" --version print this tool's version number + ")), + "" + ); + exit 0; }; } @@ -162,7 +171,7 @@ our $changelog_first = $ManaTools::rpmdragora::changelog_first_config->[0]; $changelog_first = 1 if $rpmdragora_options{'changelog-first'}; sub warn_about_user_mode() { - my $loc = ManaTools::Shared::Locales->new(domain_name => 'rpmdrake'); + my $loc = ManaTools::rpmdragora::locale(); my $title = $loc->N("Running in user mode"); my $msg = $loc->N("You are launching this program as a normal user.\n". "You will not be able to perform modifications on the system,\n". -- cgit v1.2.1