aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/ManaTools/MainDisplay.pm12
-rw-r--r--lib/ManaTools/Rpmdragora/init.pm55
-rw-r--r--lib/ManaTools/rpmdragora.pm32
3 files changed, 66 insertions, 33 deletions
diff --git a/lib/ManaTools/MainDisplay.pm b/lib/ManaTools/MainDisplay.pm
index f18503a..8f25dd6 100644
--- a/lib/ManaTools/MainDisplay.pm
+++ b/lib/ManaTools/MainDisplay.pm
@@ -162,9 +162,17 @@ sub new {
{
$self->{confDir} = "/etc/$self->{title}";
}
+ my $locale_dir = undef;
+ $pos = $cmdline->find("--locales-dir");
+ if ($pos > 0)
+ {
+ $locale_dir = $cmdline->arg($pos+1);
+ }
+ $self->{loc} = ManaTools::Shared::Locales->new(
+ domain_name => 'manatools',
+ dir_name => $locale_dir,
+ );
- # TODO localize
- $self->{loc} = ManaTools::Shared::Locales->new(domain_name => 'libDrakX-standalone');
$self->setupGui();
return $self;
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".
diff --git a/lib/ManaTools/rpmdragora.pm b/lib/ManaTools/rpmdragora.pm
index ecdf06f..d8a8f44 100644
--- a/lib/ManaTools/rpmdragora.pm
+++ b/lib/ManaTools/rpmdragora.pm
@@ -118,10 +118,6 @@ BEGIN { unshift @::textdomains, qw(rpmdragora urpmi rpm-summary-main rpm-summary
use yui;
use Glib;
-#ugtk2::add_icon_path('/usr/share/rpmdragora/icons');
-
-# Locale::gettext::bind_textdomain_codeset('rpmdragora', 'UTF8');
-my $loc = ManaTools::Shared::Locales->new(domain_name => 'rpmdrake');;
our $mageia_release = MDK::Common::File::cat_(
-e '/etc/mageia-release' ? '/etc/mageia-release' : '/etc/release'
@@ -131,20 +127,40 @@ our ($distro_version) = $mageia_release =~ /(\d+\.\d+)/;
our ($branded, %distrib);
$branded = -f '/etc/sysconfig/oem'
and %distrib = MDK::Common::System::distrib();
-our $myname_update = $branded ? $loc->N_("Software Update") : $loc->N_("Mageia Update");
@rpmdragora::prompt::ISA = 'urpm::prompt';
+# Locale::gettext::bind_textdomain_codeset('rpmdragora', 'UTF8');
+my $loc;
sub locale() {
+ my $lc;
- if (!defined($loc)) {
- $loc = ManaTools::Shared::Locales->new(domain_name => 'rpmdrake');
+ if (defined($loc)) {
+ $lc = $loc;
}
+ else {
+ my $cmdline = new yui::YCommandLine;
+ my $locale_dir = undef;
+ my $pos = $cmdline->find("--locales-dir");
+ if ($pos > 0)
+ {
+ $locale_dir = $cmdline->arg($pos+1);
+ }
+ $lc = ManaTools::Shared::Locales->new(
+ domain_name => 'manatools',
+ dir_name => $locale_dir,
+ );
+ }
- return $loc;
+ return $lc;
}
+# Locale::gettext::bind_textdomain_codeset('rpmdragora', 'UTF8');
+$loc = ManaTools::rpmdragora::locale();
+our $myname_update = $branded ? $loc->N_("Software Update") : $loc->N_("Mageia Update");
+
+
sub rpmdragora::prompt::prompt {
my ($self) = @_;
my @answers;