diff options
-rw-r--r-- | lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm | 2 | ||||
-rw-r--r-- | lib/AdminPanel/Rpmdragora/formatting.pm | 17 | ||||
-rw-r--r-- | lib/AdminPanel/Rpmdragora/gui.pm | 206 | ||||
-rw-r--r-- | lib/AdminPanel/Rpmdragora/icon.pm | 330 | ||||
-rw-r--r-- | lib/AdminPanel/Rpmdragora/init.pm | 42 | ||||
-rw-r--r-- | lib/AdminPanel/Rpmdragora/open_db.pm | 8 | ||||
-rw-r--r-- | lib/AdminPanel/Rpmdragora/pkg.pm | 172 | ||||
-rw-r--r-- | lib/AdminPanel/Rpmdragora/rpmnew.pm | 26 | ||||
-rw-r--r-- | lib/AdminPanel/rpmdragora.pm | 229 | ||||
-rwxr-xr-x | modules/rpmdragora/dragora-urpm-addmedia | 35 | ||||
-rwxr-xr-x | modules/rpmdragora/dragora-urpm-sources.pl | 12 | ||||
-rwxr-xr-x | modules/rpmdragora/dragoraUpdate | 11 | ||||
-rwxr-xr-x | modules/rpmdragora/rpmdragora | 270 |
13 files changed, 698 insertions, 662 deletions
diff --git a/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm b/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm index e7a9c71..584da65 100644 --- a/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm +++ b/lib/AdminPanel/Rpmdragora/edit_urpm_sources.pm @@ -50,7 +50,6 @@ our @ISA = qw(Exporter); our @EXPORT = qw(run); -my $loc = AdminPanel::Shared::Locales->new(domain_name => 'rpmdrake'); my $urpm; my ($mainw, $list_tv, $something_changed); @@ -64,6 +63,7 @@ my %col = ( }, ); +my $loc = AdminPanel::rpmdragora::locale(); sub get_medium_type { my ($medium) = @_; diff --git a/lib/AdminPanel/Rpmdragora/formatting.pm b/lib/AdminPanel/Rpmdragora/formatting.pm index ccbdf0c..c1d7aec 100644 --- a/lib/AdminPanel/Rpmdragora/formatting.pm +++ b/lib/AdminPanel/Rpmdragora/formatting.pm @@ -27,6 +27,7 @@ package AdminPanel::Rpmdragora::formatting; use strict; use utf8; use POSIX qw(strftime); +use AdminPanel::Shared::Locales; use AdminPanel::rpmdragora; use lib qw(/usr/lib/libDrakX); use MDK::Common::Various; # included for internal_error subroutine @@ -54,6 +55,7 @@ our @EXPORT = qw( urpm_name ); +my $loc = AdminPanel::rpmdragora::locale(); sub escape_text_for_TextView_markup_format { my ($str) = @_; @@ -85,6 +87,7 @@ sub ensure_utf8 { sub rpm_description { my ($description) = @_; ensure_utf8($description); + $DB::single = 1; my ($t, $tmp); foreach (split "\n", $description) { s/^\s*//; @@ -114,8 +117,8 @@ sub urpm_name { sub pkg2medium { my ($p, $urpm) = @_; return if !ref $p; - return { name => N("None (installed)") } if !defined($p->id); # if installed - URPM::pkg2media($urpm->{media}, $p) || { name => N("Unknown"), fake => 1 }; + return { name => $loc->N("None (installed)") } if !defined($p->id); # if installed + URPM::pkg2media($urpm->{media}, $p) || { name => $loc->N("Unknown"), fake => 1 }; } # [ duplicate urpmi's urpm::msg::localtime2changelog() ] @@ -141,7 +144,7 @@ sub format_changelog_string { if (/^\*/) { add2hash(\%attrs, \%date_attr); ($version) = /(\S*-\S*)\s*$/; - $highlight = $installed_version ne N("(none)") && 0 < URPM::rpmvercmp($version, $installed_version); + $highlight = $installed_version ne $loc->N("(none)") && 0 < URPM::rpmvercmp($version, $installed_version); } add2hash(\%attrs, \%update_attr) if $highlight; [ "$spacing$_\n", if_(%attrs, \%attrs) ]; @@ -177,14 +180,14 @@ sub format_field { sub format_size { my ($size) = @_; - $size >= 0 ? - N("%s of additional disk space will be used.", formatXiB($size)) : - N("%s of disk space will be freed.", formatXiB(-$size)); + $size >= 0 ? + $loc->N("%s of additional disk space will be used.", formatXiB($size)) : + $loc->N("%s of disk space will be freed.", formatXiB(-$size)); } sub format_filesize { my ($filesize) = @_; - $filesize ? N("%s of packages will be retrieved.", formatXiB($filesize)) : (); + $filesize ? $loc->N("%s of packages will be retrieved.", formatXiB($filesize)) : (); } sub format_list { join("\n", map { s/^(\s)/ $1/mg; "- $_" } sort { uc($a) cmp uc($b) } @_) } diff --git a/lib/AdminPanel/Rpmdragora/gui.pm b/lib/AdminPanel/Rpmdragora/gui.pm index 67f00d2..8bbf859 100644 --- a/lib/AdminPanel/Rpmdragora/gui.pm +++ b/lib/AdminPanel/Rpmdragora/gui.pm @@ -47,6 +47,7 @@ use AdminPanel::Rpmdragora::init; use AdminPanel::Rpmdragora::icon; use AdminPanel::Rpmdragora::pkg; use AdminPanel::Shared; +use AdminPanel::Shared::Locales; use yui; use feature 'state'; @@ -88,8 +89,10 @@ our @EXPORT = qw( fast_toggle ); +my $loc = AdminPanel::rpmdragora::locale(); + our ($descriptions, %filters, @filtered_pkgs, %filter_methods, $force_displaying_group, $force_rebuild, @initial_selection, $pkgs, $size_free, $size_selected, $urpm); -our ($results_ok, $results_none) = (N("Search results"), N("Search results (none)")); +our ($results_ok, $results_none) = ($loc->N("Search results"), $loc->N("Search results (none)")); our %grp_columns = ( label => 0, @@ -108,6 +111,7 @@ our %pkg_columns = ( selectable => 8, ); + sub compute_main_window_size { my ($w) = @_; ($typical_width) = string_size($w->{real_window}, translate("Graphical Environment") . "xmms-more-vis-plugins"); @@ -134,7 +138,7 @@ sub build_expander { $first = 1; slow_func($::main_window->window, sub { extract_header($pkg, $urpm, $type, $o_installed_version); - gtktext_insert($textview, $get_data->() || [ [ N("(Not available)") ] ]); + gtktext_insert($textview, $get_data->() || [ [ $loc->N("(Not available)") ] ]); }); })), $textview = gtknew('TextView') @@ -147,7 +151,7 @@ sub build_expander { sub get_advisory_link { my ($update_descr) = @_; - my $webref = "<br /><a href=\"". $update_descr->{URL} ."\">". N("Security advisory") ."</a><br />"; + my $webref = "<br /><a href=\"". $update_descr->{URL} ."\">". $loc->N("Security advisory") ."</a><br />"; # TODO manage on click as event from RichText # $link->set_uri_hook(\&run_help_callback); @@ -160,7 +164,7 @@ sub get_description { join("<br />", (eval { encode_entities($pkg->{description}) || encode_entities($update_descr->{description}); - } || '<i>'. N("No description").'</i>')); + } || '<i>'. $loc->N("No description").'</i>')); } sub get_string_from_keywords { @@ -171,27 +175,27 @@ sub get_string_from_keywords { @media_types = split(':', $distribconf->getvalue($medium_path, 'media_type')) if $distribconf; } - my $unsupported = N("It is <b>not supported</b> by Mageia."); - my $dangerous = N("It may <b>break</b> your system."); + my $unsupported = $loc->N("It is <b>not supported</b> by Mageia."); + my $dangerous = $loc->N("It may <b>break</b> your system."); my $s; - $s .= N("This package is not free software") . "\n" if member('non-free', @media_types); + $s .= $loc->N("This package is not free software") . "\n" if member('non-free', @media_types); if ($pkgs->{$name}{is_backport} || member('backport', @media_types)) { return join("\n", - N("This package contains a new version that was backported."), + $loc->N("This package contains a new version that was backported."), $unsupported, $dangerous, $s); } elsif (member('testing', @media_types)) { return join("\n", - N("This package is a potential candidate for an update."), + $loc->N("This package is a potential candidate for an update."), $unsupported, $dangerous, $s); } elsif (member('updates', @media_types)) { return join("\n", (member('official', @media_types) ? - N("This is an official update which is supported by Mageia.") - : (N("This is an unofficial update."), $unsupported)) + $loc->N("This is an official update which is supported by Mageia.") + : ($loc->N("This is an unofficial update."), $unsupported)) , $s); } else { - $s .= N("This is an official package supported by Mageia") . "\n" if member('official', @media_types); + $s .= $loc->N("This is an official package supported by Mageia") . "\n" if member('official', @media_types); return $s; } } @@ -200,16 +204,16 @@ sub get_main_text { my ($medium, $fullname, $name, $summary, $is_update, $update_descr) = @_; my $txt = get_string_from_keywords($medium, $fullname); - my $string = encode_entities($txt); - + # TODO my $string = encode_entities($txt); + ensure_utf8($txt); join("<br />", format_header(join(' - ', $name, $summary)), "<br />" , - if_($txt, format_field(N("Notice: ")) . $string), + if_($txt, format_field($loc->N("Notice: ")) . $txt), if_($is_update, # is it an update? - format_field(N("Importance: ")) . format_update_field($update_descr->{importance}), - format_field(N("Reason for update: ")) . format_update_field(rpm_description($update_descr->{pre})), + format_field($loc->N("Importance: ")) . format_update_field($update_descr->{importance}), + format_field($loc->N("Reason for update: ")) . format_update_field(rpm_description($update_descr->{pre})), ), '' # extra empty line ); @@ -218,12 +222,12 @@ sub get_main_text { sub get_details { my ($pkg, $upkg, $installed_version, $raw_medium) = @_; my @details = (); - push @details, format_field(N("Version: ")) . $upkg->EVR; - push @details, format_field(N("Currently installed version: ")) . $installed_version if($upkg->flag_installed); - push @details, format_field(N("Group: ")) . translate_group($upkg->group); - push @details, format_field(N("Architecture: ")) . $upkg->arch; - push @details, format_field(N("Size: ")) . N("%s KB", int($upkg->size/1024)); - push @details, eval { format_field(N("Medium: ")) . $raw_medium->{name} }; + push @details, format_field($loc->N("Version: ")) . $upkg->EVR; + push @details, format_field($loc->N("Currently installed version: ")) . $installed_version if($upkg->flag_installed); + push @details, format_field($loc->N("Group: ")) . translate_group($upkg->group); + push @details, format_field($loc->N("Architecture: ")) . $upkg->arch; + push @details, format_field($loc->N("Size: ")) . $loc->N("%s KB", int($upkg->size/1024)); + push @details, eval { format_field($loc->N("Medium: ")) . $raw_medium->{name} }; my @link = get_url_link($upkg, $pkg); push @details, join("<br /> ",@link) if(@link); @@ -236,7 +240,7 @@ sub get_new_deps { my $deps_textview; my @a = [ gtkadd( gtksignal_connect( - gtkshow(my $dependencies = Gtk2::Expander->new(format_field(N("New dependencies:")))), + gtkshow(my $dependencies = Gtk2::Expander->new(format_field($loc->N("New dependencies:")))), activate => sub { slow_func($::main_window->window, sub { my $state = {}; @@ -249,7 +253,7 @@ sub get_new_deps { undef $db; my @nodes_with_deps = map { urpm_name($_) } @requested; my @deps = sort { $a cmp $b } difference2(\@nodes_with_deps, [ urpm_name($upkg) ]); - @deps = N("All dependencies installed.") if !@deps; + @deps = $loc->N("All dependencies installed.") if !@deps; gtktext_insert($deps_textview, join("\n", @deps)); }); } @@ -272,7 +276,7 @@ sub get_url_link { return if !$url; my @a; - push @a, format_field(N("URL: "))."${spacing}$url"; + push @a, format_field($loc->N("URL: "))."${spacing}$url"; @a; } @@ -308,16 +312,16 @@ sub format_pkg_simplifiedinfo { push @$s, [ "\n" ]; my $installed_version = eval { find_installed_version($upkg) }; - #push @$s, [ gtkadd(gtkshow(my $details_exp = Gtk2::Expander->new(format_field(N("Details:")))), + #push @$s, [ gtkadd(gtkshow(my $details_exp = Gtk2::Expander->new(format_field($loc->N("Details:")))), # gtknew('TextView', text => get_details($pkg, $upkg, $installed_version, $raw_medium))) ]; my $details = get_details($pkg, $upkg, $installed_version, $raw_medium); utf8::encode($details); - push @$s, join("\n", format_field(N("Details:")). "\n" . $details); + push @$s, join("\n", format_field($loc->N("Details:")). "\n" . $details); #$details_exp->set_use_markup(1); push @$s, [ "\n\n" ]; - #push @$s, [ build_expander($pkg, N("Files:"), 'files', sub { files_format($pkg->{files}) }) ]; + #push @$s, [ build_expander($pkg, $loc->N("Files:"), 'files', sub { files_format($pkg->{files}) }) ]; push @$s, [ "\n\n" ]; - #push @$s, [ build_expander($pkg, N("Changelog:"), 'changelog', sub { $pkg->{changelog} }, $installed_version) ]; + #push @$s, [ build_expander($pkg, $loc->N("Changelog:"), 'changelog', sub { $pkg->{changelog} }, $installed_version) ]; push @$s, [ "\n\n" ]; if ($upkg->id) { # If not installed @@ -332,38 +336,38 @@ sub format_pkg_info { my $upkg = $pkg->{pkg}; my ($name, $version) = split_fullname($key); my @files = ( - format_field(N("Files:\n")), + format_field($loc->N("Files:\n")), exists $pkg->{files} ? '<tt>' . join("\n", map { "\x{200e}$_" } @{$pkg->{files}}) . '</tt>' #- to highlight information - : N("(Not available)"), + : $loc->N("(Not available)"), ); - my @chglo = (format_field(N("Changelog:\n")), ($pkg->{changelog} ? @{$pkg->{changelog}} : N("(Not available)"))); + my @chglo = (format_field($loc->N("Changelog:\n")), ($pkg->{changelog} ? @{$pkg->{changelog}} : $loc->N("(Not available)"))); my @source_info = ( $MODE eq 'remove' || !@$max_info_in_descr ? () : ( - format_field(N("Medium: ")) . pkg2medium($upkg, $urpm)->{name}, - format_field(N("Currently installed version: ")) . find_installed_version($upkg), + format_field($loc->N("Medium: ")) . pkg2medium($upkg, $urpm)->{name}, + format_field($loc->N("Currently installed version: ")) . find_installed_version($upkg), ) ); my @max_info = @$max_info_in_descr && $changelog_first ? (@chglo, @files) : (@files, '', @chglo); - ugtk2::markup_to_TextView_format(join("\n", format_field(N("Name: ")) . $name, - format_field(N("Version: ")) . $version, - format_field(N("Architecture: ")) . $upkg->arch, - format_field(N("Size: ")) . N("%s KB", int($upkg->size/1024)), + ugtk2::markup_to_TextView_format(join("\n", format_field($loc->N("Name: ")) . $name, + format_field($loc->N("Version: ")) . $version, + format_field($loc->N("Architecture: ")) . $upkg->arch, + format_field($loc->N("Size: ")) . $loc->N("%s KB", int($upkg->size/1024)), if_( $MODE eq 'update', - format_field(N("Importance: ")) . $descriptions->{$name}{importance} + format_field($loc->N("Importance: ")) . $descriptions->{$name}{importance} ), @source_info, '', # extra empty line - format_field(N("Summary: ")) . $upkg->summary, + format_field($loc->N("Summary: ")) . $upkg->summary, '', # extra empty line if_( $MODE eq 'update', - format_field(N("Reason for update: ")) . rpm_description($descriptions->{$name}{pre}), + format_field($loc->N("Reason for update: ")) . rpm_description($descriptions->{$name}{pre}), ), - format_field(N("Description: ")), ($pkg->{description} || $descriptions->{$name}{description} || N("No description")), + format_field($loc->N("Description: ")), ($pkg->{description} || $descriptions->{$name}{description} || $loc->N("No description")), @max_info, )); } @@ -374,18 +378,18 @@ sub warn_if_no_pkg { state $warned; if (!$warned) { $warned = 1; - interactive_msg(N("Warning"), + interactive_msg($loc->N("Warning"), join("\n", - N("The package \"%s\" was found.", $name), - N("However this package is not in the package list."), - N("You may want to update your urpmi database."), + $loc->N("The package \"%s\" was found.", $name), + $loc->N("However this package is not in the package list."), + $loc->N("You may want to update your urpmi database."), '', - N("Matching packages:"), + $loc->N("Matching packages:"), '', join("\n", sort map { #-PO: this is list fomatting: "- <package_name> (medium: <medium_name>)" #-PO: eg: "- rpmdragora (medium: "Main Release" - N("- %s (medium: %s)", $_, pkg2medium($pkgs->{$_}{pkg}, $urpm)->{name}); + $loc->N("- %s (medium: %s)", $_, pkg2medium($pkgs->{$_}{pkg}, $urpm)->{name}); } grep { /^$short_name/ } keys %$pkgs), ), scroll => 1, @@ -739,16 +743,16 @@ sub fast_toggle { my $name = $common->{table_item_list}[$item->index()]; my $urpm_obj = $pkgs->{$name}{pkg}; if ($urpm_obj->flag_base) { - interactive_msg(N("Warning"), N("Removing package %s would break your system", $name)); + interactive_msg($loc->N("Warning"), $loc->N("Removing package %s would break your system", $name)); return ''; } if ($urpm_obj->flag_skip) { - interactive_msg(N("Warning"), N("The \"%s\" package is in urpmi skip list.\nDo you want to select it anyway?", $name), yesno => 1) or return ''; + interactive_msg($loc->N("Warning"), $loc->N("The \"%s\" package is in urpmi skip list.\nDo you want to select it anyway?", $name), yesno => 1) or return ''; $urpm_obj->set_flag_skip(0); } if ($AdminPanel::Rpmdragora::pkg::need_restart && !$priority_up_alread_warned) { $priority_up_alread_warned = 1; - interactive_msg(N("Warning"), '<b>' . N("Rpmdragora or one of its priority dependencies needs to be updated first. Rpmdragora will then restart.") . '</b>' . "\n\n"); + interactive_msg($loc->N("Warning"), '<b>' . $loc->N("Rpmdragora or one of its priority dependencies needs to be updated first. Rpmdragora will then restart.") . '</b>' . "\n\n"); } # toggle_nodes($w->{tree}->window, $w->{detail_list_model}, \&set_leaf_state, $w->{detail_list_model}->get($iter, $pkg_columns{state}), my $state; @@ -837,19 +841,19 @@ sub ask_browse_tree_given_widgets_for_rpmdragora { my $urpm_obj = $pkgs->{$name}{pkg}; if ($urpm_obj->flag_base) { - interactive_msg(N("Warning"), - N("Removing package %s would break your system", $name)); + interactive_msg($loc->N("Warning"), + $loc->N("Removing package %s would break your system", $name)); return ''; } if ($urpm_obj->flag_skip) { - interactive_msg(N("Warning"), N("The \"%s\" package is in urpmi skip list.\nDo you want to select it anyway?", $name), yesno => 1) or return ''; + interactive_msg($loc->N("Warning"), $loc->N("The \"%s\" package is in urpmi skip list.\nDo you want to select it anyway?", $name), yesno => 1) or return ''; $urpm_obj->set_flag_skip(0); } if ($AdminPanel::Rpmdragora::pkg::need_restart && !$priority_up_alread_warned) { $priority_up_alread_warned = 1; - interactive_msg(N("Warning"), '<b>' . N("Rpmdragora or one of its priority dependencies needs to be updated first. Rpmdragora will then restart.") . '</b>' . "\n\n"); + interactive_msg($loc->N("Warning"), '<b>' . $loc->N("Rpmdragora or one of its priority dependencies needs to be updated first. Rpmdragora will then restart.") . '</b>' . "\n\n"); } # toggle_nodes($w->{tree}->window, $w->{detail_list_model}, \&set_leaf_state, $w->{detail_list_model}->get($iter, $pkg_columns{state}), @@ -979,10 +983,10 @@ sub callback_choices { is_locale_available($_) and return $pkg; } } - my $callback = sub { interactive_msg(N("More information on package..."), get_info($_[0]), scroll => 1) }; + my $callback = sub { interactive_msg($loc->N("More information on package..."), get_info($_[0]), scroll => 1) }; $choices = [ sort { $a->name cmp $b->name } @$choices ]; - my @choices = interactive_list_(N("Please choose"), (scalar(@$choices) == 1 ? - N("The following package is needed:") : N("One of the following packages is needed:")), + my @choices = interactive_list_($loc->N("Please choose"), (scalar(@$choices) == 1 ? + $loc->N("The following package is needed:") : $loc->N("One of the following packages is needed:")), [ map { urpm_name($_) } @$choices ], $callback, nocancel => 1); defined $choices[0] ? $choices->[$choices[0]] : undef; } @@ -991,7 +995,7 @@ sub callback_choices { sub _setInfoOnWidget { my ($pkgname, $infoWidget) = @_; $infoWidget->setValue(""); - $infoWidget->setValue("<h2>".N("Informations")."</h2>"); + $infoWidget->setValue("<h2>".$loc->N("Informations")."</h2>"); my @data = get_info($pkgname); for(@{$data[0]}){ @@ -1038,17 +1042,17 @@ sub deps_msg { my $msgBox = $factory->createRichText($vbox, $msg, 1); $factory->createVSpacing($vbox, 1); my $hbox = $factory->createHBox( $vbox ); - my $pkgList = $factory->createSelectionBox( $hbox, N("Select package") ); + my $pkgList = $factory->createSelectionBox( $hbox, $loc->N("Select package") ); - my $frame = $factory->createFrame ($hbox, N("Information on packages")); + my $frame = $factory->createFrame ($hbox, $loc->N("Information on packages")); my $frmVbox = $factory->createVBox( $frame ); my $infoBox = $factory->createRichText($frmVbox, "", 0); # my $treeWidget = $factory->createTree($frmVbox, ""); $factory->createVSpacing($vbox, 1); $hbox = $factory->createHBox( $vbox ); my $align = $factory->createRight($hbox); - my $cancelButton = $factory->createPushButton($align, N("Cancel")); - my $okButton = $factory->createPushButton($hbox, N("Ok")); + my $cancelButton = $factory->createPushButton($align, $loc->N("Cancel")); + my $okButton = $factory->createPushButton($hbox, $loc->N("Ok")); # adding packages to the list my $itemColl = new yui::YItemCollection; @@ -1110,28 +1114,28 @@ sub deps_msg { # $title, $msg . # format_list(map { scalar(urpm::select::translate_why_removed_one($urpm, $urpm->{state}, $_)) } @deps) # . "\n\n" . format_size($urpm->selected_size($urpm->{state})), -# yesno => [ N("Cancel"), N("More info"), N("Ok") ], +# yesno => [ $loc->N("Cancel"), $loc->N("More info"), $loc->N("Ok") ], # scroll => 1, # ); # if ($results eq # #-PO: Keep it short, this is gonna be on a button -# N("More info")) { +# $loc->N("More info")) { # interactive_packtable( -# N("Information on packages"), +# $loc->N("Information on packages"), # $::main_window, # undef, # [ map { my $pkg = $_; # [ gtknew('HBox', children_tight => [ gtkset_selectable(gtknew('Label', text => $pkg), 1) ]), -# gtknew('Button', text => N("More information on package..."), +# gtknew('Button', text => $loc->N("More information on package..."), # clicked => sub { -# interactive_msg(N("More information on package..."), get_info($pkg), scroll => 1); +# interactive_msg($loc->N("More information on package..."), get_info($pkg), scroll => 1); # }) ] } @deps ], -# [ gtknew('Button', text => N("Ok"), +# [ gtknew('Button', text => $loc->N("Ok"), # clicked => sub { Gtk2->main_quit }) ] # ); # goto deps_msg_again; # } else { -# return $results eq N("Ok"); +# return $results eq $loc->N("Ok"); # } } @@ -1146,12 +1150,12 @@ sub toggle_nodes { my @nodes_with_deps; - my $bar_id = statusbar_msg(N("Checking dependencies of package..."), 0); + my $bar_id = statusbar_msg($loc->N("Checking dependencies of package..."), 0); my $warn_about_additional_packages_to_remove = sub { my ($msg) = @_; statusbar_msg_remove($bar_id); - deps_msg(N("Some additional packages need to be removed"), + deps_msg($loc->N("Some additional packages need to be removed"), formatAlaTeX($msg) . "\n\n", \@nodes, \@nodes_with_deps) or @nodes_with_deps = (); }; @@ -1162,13 +1166,13 @@ sub toggle_nodes { slow_func($widget, sub { @remove = closure_removal(@nodes) }); @nodes_with_deps = grep { !$pkgs->{$_}{selected} && !/^basesystem/ } @remove; $warn_about_additional_packages_to_remove->( - N("Because of their dependencies, the following package(s) also need to be removed:")); + $loc->N("Because of their dependencies, the following package(s) also need to be removed:")); my @impossible_to_remove; foreach (grep { exists $pkgs->{$_}{base} } @remove) { ${$pkgs->{$_}{base}} == 1 ? push @impossible_to_remove, $_ : ${$pkgs->{$_}{base}}--; } - @impossible_to_remove and interactive_msg(N("Some packages cannot be removed"), - N("Removing these packages would break your system, sorry:\n\n") . + @impossible_to_remove and interactive_msg($loc->N("Some packages cannot be removed"), + $loc->N("Removing these packages would break your system, sorry:\n\n") . format_list(@impossible_to_remove)); @nodes_with_deps = difference2(\@nodes_with_deps, \@impossible_to_remove); } else { @@ -1176,7 +1180,7 @@ sub toggle_nodes { grep { $pkgs->{$_}{selected} && !member($_, @nodes) } keys %$pkgs; push @nodes_with_deps, @nodes; $warn_about_additional_packages_to_remove->( - N("Because of their dependencies, the following package(s) must be unselected now:\n\n")); + $loc->N("Because of their dependencies, the following package(s) must be unselected now:\n\n")); $pkgs->{$_}{base} && ${$pkgs->{$_}{base}}++ foreach @nodes_with_deps; } } else { @@ -1200,8 +1204,8 @@ sub toggle_nodes { ); @nodes_with_deps = map { urpm_name($_) } @requested; statusbar_msg_remove($bar_id); - if (!deps_msg(N("Additional packages needed"), - formatAlaTeX(N("To satisfy dependencies, the following package(s) also need to be installed:\n\n")) . "\n\n", + if (!deps_msg($loc->N("Additional packages needed"), + formatAlaTeX($loc->N("To satisfy dependencies, the following package(s) also need to be installed:\n\n")) . "\n\n", \@nodes, \@nodes_with_deps)) { @nodes_with_deps = (); $urpm->disable_selected(open_rpm_db(), $urpm->{state}, @requested); @@ -1209,7 +1213,7 @@ sub toggle_nodes { } if (my $conflicting_msg = urpm::select::conflicting_packages_msg($urpm, $urpm->{state})) { - if (!interactive_msg(N("Conflicting Packages"), $conflicting_msg, yesno => 1, scroll => 1)) { + if (!interactive_msg($loc->N("Conflicting Packages"), $conflicting_msg, yesno => 1, scroll => 1)) { @nodes_with_deps = (); $urpm->disable_selected(open_rpm_db(), $urpm->{state}, @requested); goto packages_selection_ok; @@ -1223,14 +1227,14 @@ sub toggle_nodes { my $unsel = find { $_ eq $cant } @ask_unselect; $unsel ? join("\n", urpm::select::translate_why_unselected($urpm, $urpm->{state}, $unsel)) - : ($pkgs->{$_}{pkg}->flag_skip ? N("%s (belongs to the skip list)", $cant) : $cant); + : ($pkgs->{$_}{pkg}->flag_skip ? $loc->N("%s (belongs to the skip list)", $cant) : $cant); } @cant; my $count = @reasons; interactive_msg( - ($count == 1 ? N("One package cannot be installed") : N("Some packages cannot be installed")), + ($count == 1 ? $loc->N("One package cannot be installed") : $loc->N("Some packages cannot be installed")), ($count == 1 ? - N("Sorry, the following package cannot be selected:\n\n%s", format_list(@reasons)) - : N("Sorry, the following packages cannot be selected:\n\n%s", format_list(@reasons))), + $loc->N("Sorry, the following package cannot be selected:\n\n%s", format_list(@reasons)) + : $loc->N("Sorry, the following packages cannot be selected:\n\n%s", format_list(@reasons))), scroll => 1, ); foreach (@cant) { @@ -1246,8 +1250,8 @@ sub toggle_nodes { map { $pkgs->{$_}{pkg} } @nodes); @nodes_with_deps = map { urpm_name($_) } @unrequested; statusbar_msg_remove($bar_id); - if (!deps_msg(N("Some packages need to be removed"), - N("Because of their dependencies, the following package(s) must be unselected now:\n\n"), + if (!deps_msg($loc->N("Some packages need to be removed"), + $loc->N("Because of their dependencies, the following package(s) must be unselected now:\n\n"), \@nodes, \@nodes_with_deps)) { @nodes_with_deps = (); $urpm->resolve_requested(open_rpm_db(), $urpm->{state}, { map { $_->id => 1 } @unrequested }); @@ -1283,7 +1287,7 @@ sub is_there_selected_packages() { sub real_quit() { if (is_there_selected_packages()) { - return interactive_msg(N("Some packages are selected."), N("Some packages are selected.") . "\n" . N("Do you really want to quit?"), yesno => 1); + return interactive_msg($loc->N("Some packages are selected."), $loc->N("Some packages are selected.") . "\n" . $loc->N("Do you really want to quit?"), yesno => 1); } return 1; @@ -1293,17 +1297,17 @@ sub do_action__real { my ($options, $callback_action, $o_info) = @_; require urpm::sys; if (!urpm::sys::check_fs_writable()) { - $urpm->{fatal}(1, N("Error: %s appears to be mounted read-only.", $urpm::sys::mountpoint)); + $urpm->{fatal}(1, $loc->N("Error: %s appears to be mounted read-only.", $urpm::sys::mountpoint)); return 1; } if (!$AdminPanel::Rpmdragora::pkg::need_restart && !is_there_selected_packages()) { - interactive_msg(N("You need to select some packages first."), N("You need to select some packages first.")); + interactive_msg($loc->N("You need to select some packages first."), $loc->N("You need to select some packages first.")); return 1; } my $size_added = sum(map { if_($_->flag_selected && !$_->flag_installed, $_->size) } @{$urpm->{depslist}}); if ($MODE eq 'install' && $size_free - $size_added/1024 < 50*1024) { - interactive_msg(N("Too many packages are selected"), - N("Warning: it seems that you are attempting to add so many + interactive_msg($loc->N("Too many packages are selected"), + $loc->N("Warning: it seems that you are attempting to add so many packages that your filesystem may run out of free diskspace, during or after package installation ; this is particularly dangerous and should be considered with care. @@ -1330,8 +1334,8 @@ sub do_action { my $err = $@; # FIXME: offer to report the problem into bugzilla: if ($err && $err !~ /cancel_perform/) { - interactive_msg(N("Fatal error"), - N("A fatal error occurred: %s.", $err)); + interactive_msg($loc->N("Fatal error"), + $loc->N("A fatal error occurred: %s.", $err)); } $res; } @@ -1368,7 +1372,7 @@ sub build_tree { $old_mode = $mode; undef $force_rebuild; my @elems; - my $wait; $wait = statusbar_msg(N("Please wait, listing packages...")) if $MODE ne 'update'; + my $wait; $wait = statusbar_msg($loc->N("Please wait, listing packages...")) if $MODE ne 'update'; { my @keys = @filtered_pkgs; if (member($mode, qw(all_updates security bugfix normal))) { @@ -1378,10 +1382,10 @@ sub build_tree { || ! $descriptions->{$name}{importance}; } @keys; if (@keys == 0) { - add_node('', N("(none)"), { nochild => 1 }); + add_node('', $loc->N("(none)"), { nochild => 1 }); state $explanation_only_once; - $explanation_only_once or interactive_msg(N("No update"), - N("The list of updates is empty. This means that either there is + $explanation_only_once or interactive_msg($loc->N("No update"), + $loc->N("The list of updates is empty. This means that either there is no available update for the packages installed on your computer, or you already installed all of them.")); $explanation_only_once = 1; @@ -1409,7 +1413,7 @@ or you already installed all of them.")); } else { if (0 && $MODE eq 'update') { foreach ($sortmethods{flat}->(@elems)){ - add_node($tree->currentItem()->label(), $_->[0], N("All")) + add_node($tree->currentItem()->label(), $_->[0], $loc->N("All")) } $tree->expand_row($tree_model->get_path($tree_model->get_iter_first), 0); } elsif ($::mode->[0] eq 'by_source') { @@ -1420,8 +1424,8 @@ or you already installed all of them.")); _build_tree($tree, $elems, map { my $pkg = $pkgs->{$_->[0]}{pkg}; [ $_->[0], $pkg->flag_installed ? - (!$pkg->flag_skip && $pkg->flag_upgrade ? N("Upgradable") : N("Installed")) - : N("Addable") ]; + (!$pkg->flag_skip && $pkg->flag_upgrade ? $loc->N("Upgradable") : $loc->N("Installed")) + : $loc->N("Addable") ]; } $sortmethods{flat}->(@elems)); } else { _build_tree($tree, $elems, @elems); @@ -1434,7 +1438,7 @@ or you already installed all of them.")); sub get_info { my ($key, $widget) = @_; #- the package information hasn't been loaded. Instead of rescanning the media, just give up. - exists $pkgs->{$key} or return [ [ N("Description not available for this package\n") ] ]; + exists $pkgs->{$key} or return [ [ $loc->N("Description not available for this package\n") ] ]; #- get the description if needed: exists $pkgs->{$key}{description} or slow_func($widget, sub { extract_header($pkgs->{$key}, $urpm, 'info', find_installed_version($pkgs->{$key}{pkg})) }); format_pkg_simplifiedinfo($pkgs, $key, $urpm, $descriptions); diff --git a/lib/AdminPanel/Rpmdragora/icon.pm b/lib/AdminPanel/Rpmdragora/icon.pm index 1dee4e5..282555d 100644 --- a/lib/AdminPanel/Rpmdragora/icon.pm +++ b/lib/AdminPanel/Rpmdragora/icon.pm @@ -30,184 +30,186 @@ use lib qw(/usr/lib/libDrakX); use POSIX; use common; -# TO WORKAROUND LOCALIZATION ISSUE -use AdminPanel::Rpmdragora::localization; +use AdminPanel::rpmdragora; +use AdminPanel::Shared::Locales; + +my $loc = AdminPanel::rpmdragora::locale(); our @EXPORT = qw(get_icon_path); #- /usr/share/rpmlint/config (duplicates are normal, so that we are not too far away from .py) my %group_icons = ( - N("All") => 'system_section', - N("Accessibility") => 'accessibility_section', - N("Archiving") => 'archiving_section', - join('|', N("Archiving"), N("Backup")) => 'backup_section', - join('|', N("Archiving"), N("Cd burning")) => 'cd_burning_section', - join('|', N("Archiving"), N("Compression")) => 'compression_section', - join('|', N("Archiving"), N("Other")) => 'other_archiving', - N("Communications") => 'communications_section', - join('|', N("Communications"), N("Bluetooth")) => 'communications_bluetooth_section', - join('|', N("Communications"), N("Dial-Up")) => 'communications_dialup_section', - join('|', N("Communications"), N("Fax")) => 'communications_fax_section', - join('|', N("Communications"), N("Mobile")) => 'communications_mobile_section', - join('|', N("Communications"), N("Radio")) => 'communications_radio_section', - join('|', N("Communications"), N("Serial")) => 'communications_serial_section', - join('|', N("Communications"), N("Telephony")) => 'communications_phone_section', - N("Databases") => 'databases_section', - N("Development") => 'development_section', - join('|', N("Development"), N("Basic")) => '', - join('|', N("Development"), N("C")) => '', - join('|', N("Development"), N("C++")) => '', - join('|', N("Development"), N("C#")) => '', - join('|', N("Development"), N("Databases")) => 'databases_section', - join('|', N("Development"), N("Debug")) => '', - join('|', N("Development"), N("Erlang")) => '', - join('|', N("Development"), N("GNOME and GTK+")) => 'gnome_section', - join('|', N("Development"), N("Java")) => '', - join('|', N("Development"), N("KDE and Qt")) => 'kde_section', - join('|', N("Development"), N("Kernel")) => '', - join('|', N("Development"), N("OCaml")) => '', - join('|', N("Development"), N("Other")) => '', - join('|', N("Development"), N("Perl")) => '', - join('|', N("Development"), N("PHP")) => '', - join('|', N("Development"), N("Python")) => '', - join('|', N("Development"), N("Tools")) => 'development_tools_section', - join('|', N("Development"), N("X11")) => '', - N("Documentation") => 'documentation_section', - N("Editors") => 'editors_section', - N("Education") => 'education_section', - N("Emulators") => 'emulators_section', - N("File tools") => 'file_tools_section', - N("Games") => 'amusement_section', - join('|', N("Games"), N("Adventure")) => 'adventure_section', - join('|', N("Games"), N("Arcade")) => 'arcade_section', - join('|', N("Games"), N("Boards")) => 'boards_section', - join('|', N("Games"), N("Cards")) => 'cards_section', - join('|', N("Games"), N("Other")) => 'other_amusement', - join('|', N("Games"), N("Puzzles")) => 'puzzle_section', - join('|', N("Games"), N("Shooter")) => 'shooter_section', - join('|', N("Games"), N("Simulation")) => 'simulation_section', - join('|', N("Games"), N("Sports")) => 'sport_section', - join('|', N("Games"), N("Strategy")) => 'strategy_section', - N("Geography") => 'geography_section', - N("Graphical desktop") => 'graphical_desktop_section', - join('|', N("Graphical desktop"), + $loc->N("All") => 'system_section', + $loc->N("Accessibility") => 'accessibility_section', + $loc->N("Archiving") => 'archiving_section', + join('|', $loc->N("Archiving"), $loc->N("Backup")) => 'backup_section', + join('|', $loc->N("Archiving"), $loc->N("Cd burning")) => 'cd_burning_section', + join('|', $loc->N("Archiving"), $loc->N("Compression")) => 'compression_section', + join('|', $loc->N("Archiving"), $loc->N("Other")) => 'other_archiving', + $loc->N("Communications") => 'communications_section', + join('|', $loc->N("Communications"), $loc->N("Bluetooth")) => 'communications_bluetooth_section', + join('|', $loc->N("Communications"), $loc->N("Dial-Up")) => 'communications_dialup_section', + join('|', $loc->N("Communications"), $loc->N("Fax")) => 'communications_fax_section', + join('|', $loc->N("Communications"), $loc->N("Mobile")) => 'communications_mobile_section', + join('|', $loc->N("Communications"), $loc->N("Radio")) => 'communications_radio_section', + join('|', $loc->N("Communications"), $loc->N("Serial")) => 'communications_serial_section', + join('|', $loc->N("Communications"), $loc->N("Telephony")) => 'communications_phone_section', + $loc->N("Databases") => 'databases_section', + $loc->N("Development") => 'development_section', + join('|', $loc->N("Development"), $loc->N("Basic")) => '', + join('|', $loc->N("Development"), $loc->N("C")) => '', + join('|', $loc->N("Development"), $loc->N("C++")) => '', + join('|', $loc->N("Development"), $loc->N("C#")) => '', + join('|', $loc->N("Development"), $loc->N("Databases")) => 'databases_section', + join('|', $loc->N("Development"), $loc->N("Debug")) => '', + join('|', $loc->N("Development"), $loc->N("Erlang")) => '', + join('|', $loc->N("Development"), $loc->N("GNOME and GTK+")) => 'gnome_section', + join('|', $loc->N("Development"), $loc->N("Java")) => '', + join('|', $loc->N("Development"), $loc->N("KDE and Qt")) => 'kde_section', + join('|', $loc->N("Development"), $loc->N("Kernel")) => '', + join('|', $loc->N("Development"), $loc->N("OCaml")) => '', + join('|', $loc->N("Development"), $loc->N("Other")) => '', + join('|', $loc->N("Development"), $loc->N("Perl")) => '', + join('|', $loc->N("Development"), $loc->N("PHP")) => '', + join('|', $loc->N("Development"), $loc->N("Python")) => '', + join('|', $loc->N("Development"), $loc->N("Tools")) => 'development_tools_section', + join('|', $loc->N("Development"), $loc->N("X11")) => '', + $loc->N("Documentation") => 'documentation_section', + $loc->N("Editors") => 'editors_section', + $loc->N("Education") => 'education_section', + $loc->N("Emulators") => 'emulators_section', + $loc->N("File tools") => 'file_tools_section', + $loc->N("Games") => 'amusement_section', + join('|', $loc->N("Games"), $loc->N("Adventure")) => 'adventure_section', + join('|', $loc->N("Games"), $loc->N("Arcade")) => 'arcade_section', + join('|', $loc->N("Games"), $loc->N("Boards")) => 'boards_section', + join('|', $loc->N("Games"), $loc->N("Cards")) => 'cards_section', + join('|', $loc->N("Games"), $loc->N("Other")) => 'other_amusement', + join('|', $loc->N("Games"), $loc->N("Puzzles")) => 'puzzle_section', + join('|', $loc->N("Games"), $loc->N("Shooter")) => 'shooter_section', + join('|', $loc->N("Games"), $loc->N("Simulation")) => 'simulation_section', + join('|', $loc->N("Games"), $loc->N("Sports")) => 'sport_section', + join('|', $loc->N("Games"), $loc->N("Strategy")) => 'strategy_section', + $loc->N("Geography") => 'geography_section', + $loc->N("Graphical desktop") => 'graphical_desktop_section', + join('|', $loc->N("Graphical desktop"), #-PO: This is a package/product name. Only translate it if needed: - N("Enlightenment")) => 'enlightment_section', - join('|', N("Graphical desktop"), + $loc->N("Enlightenment")) => 'enlightment_section', + join('|', $loc->N("Graphical desktop"), #-PO: This is a package/product name. Only translate it if needed: - N("GNOME")) => 'gnome_section', - join('|', N("Graphical desktop"), + $loc->N("GNOME")) => 'gnome_section', + join('|', $loc->N("Graphical desktop"), #-PO: This is a package/product name. Only translate it if needed: - N("Icewm")) => 'icewm_section', - join('|', N("Graphical desktop"), + $loc->N("Icewm")) => 'icewm_section', + join('|', $loc->N("Graphical desktop"), #-PO: This is a package/product name. Only translate it if needed: - N("KDE")) => 'kde_section', - join('|', N("Graphical desktop"), N("Other")) => 'more_applications_other_section', - join('|', N("Graphical desktop"), + $loc->N("KDE")) => 'kde_section', + join('|', $loc->N("Graphical desktop"), $loc->N("Other")) => 'more_applications_other_section', + join('|', $loc->N("Graphical desktop"), #-PO: This is a package/product name. Only translate it if needed: - N("WindowMaker")) => 'windowmaker_section', - join('|', N("Graphical desktop"), + $loc->N("WindowMaker")) => 'windowmaker_section', + join('|', $loc->N("Graphical desktop"), #-PO: This is a package/product name. Only translate it if needed: - N("Xfce")) => 'xfce_section', - N("Graphics") => 'graphics_section', - join('|', N("Graphics"), N("3D")) => 'graphics_3d_section', - join('|', N("Graphics"), N("Editors and Converters")) => 'graphics_editors_section', - join('|', N("Graphics"), N("Utilities")) => 'graphics_utilities_section', - join('|', N("Graphics"), N("Photography")) => 'graphics_photography_section', - join('|', N("Graphics"), N("Scanning")) => 'graphics_scanning_section', - join('|', N("Graphics"), N("Viewers")) => 'graphics_viewers_section', - N("Monitoring") => 'monitoring_section', - N("Networking") => 'networking_section', - join('|', N("Networking"), N("File transfer")) => 'file_transfer_section', - join('|', N("Networking"), N("IRC")) => 'irc_section', - join('|', N("Networking"), N("Instant messaging")) => 'instant_messaging_section', - join('|', N("Networking"), N("Mail")) => 'mail_section', - join('|', N("Networking"), N("News")) => 'news_section', - join('|', N("Networking"), N("Other")) => 'other_networking', - join('|', N("Networking"), N("Remote access")) => 'remote_access_section', - join('|', N("Networking"), N("WWW")) => 'networking_www_section', - N("Office") => 'office_section', - join('|', N("Office"), N("Dictionary")) => 'office_dictionary_section', - join('|', N("Office"), N("Finance")) => 'finances_section', - join('|', N("Office"), N("Management")) => 'timemanagement_section', - join('|', N("Office"), N("Organizer")) => 'timemanagement_section', - join('|', N("Office"), N("Utilities")) => 'office_accessories_section', - join('|', N("Office"), N("Spreadsheet")) => 'spreadsheet_section', - join('|', N("Office"), N("Suite")) => 'office_suite', - join('|', N("Office"), N("Word processor")) => 'wordprocessor_section', - N("Publishing") => 'publishing_section', - N("Sciences") => 'sciences_section', - join('|', N("Sciences"), N("Astronomy")) => 'astronomy_section', - join('|', N("Sciences"), N("Biology")) => 'biology_section', - join('|', N("Sciences"), N("Chemistry")) => 'chemistry_section', - join('|', N("Sciences"), N("Computer science")) => 'computer_science_section', - join('|', N("Sciences"), N("Geosciences")) => 'geosciences_section', - join('|', N("Sciences"), N("Mathematics")) => 'mathematics_section', - join('|', N("Sciences"), N("Other")) => 'other_sciences', - join('|', N("Sciences"), N("Physics")) => 'physics_section', - N("Security") => 'security_section', - N("Shells") => 'shells_section', - N("Sound") => 'sound_section', - join('|', N("Sound"), N("Editors and Converters")) => 'sound_editors_section', - join('|', N("Sound"), N("Midi")) => 'sound_midi_section', - join('|', N("Sound"), N("Mixers")) => 'sound_mixers_section', - join('|', N("Sound"), N("Players")) => 'sound_players_section', - join('|', N("Sound"), N("Utilities")) => 'sound_utilities_section', - N("System") => 'system_section', - join('|', N("System"), N("Base")) => 'system_section', - join('|', N("System"), N("Boot and Init")) => 'boot_init_section', - join('|', N("System"), N("Cluster")) => 'parallel_computing_section', - join('|', N("System"), N("Configuration")) => 'configuration_section', - join('|', N("System"), N("Fonts")) => 'chinese_section', - join('|', N("System"), N("Fonts"), N("True type")) => '', - join('|', N("System"), N("Fonts"), N("Type1")) => '', - join('|', N("System"), N("Fonts"), N("X11 bitmap")) => '', - join('|', N("System"), N("Internationalization")) => 'chinese_section', - join('|', N("System"), N("Kernel and hardware")) => 'hardware_configuration_section', - join('|', N("System"), N("Libraries")) => 'system_section', - join('|', N("System"), N("Networking")) => 'networking_configuration_section', - join('|', N("System"), N("Packaging")) => 'packaging_section', - join('|', N("System"), N("Printing")) => 'printing_section', - join('|', N("System"), N("Servers")) => 'servers_section', - join('|', N("System"), + $loc->N("Xfce")) => 'xfce_section', + $loc->N("Graphics") => 'graphics_section', + join('|', $loc->N("Graphics"), $loc->N("3D")) => 'graphics_3d_section', + join('|', $loc->N("Graphics"), $loc->N("Editors and Converters")) => 'graphics_editors_section', + join('|', $loc->N("Graphics"), $loc->N("Utilities")) => 'graphics_utilities_section', + join('|', $loc->N("Graphics"), $loc->N("Photography")) => 'graphics_photography_section', + join('|', $loc->N("Graphics"), $loc->N("Scanning")) => 'graphics_scanning_section', + join('|', $loc->N("Graphics"), $loc->N("Viewers")) => 'graphics_viewers_section', + $loc->N("Monitoring") => 'monitoring_section', + $loc->N("Networking") => 'networking_section', + join('|', $loc->N("Networking"), $loc->N("File transfer")) => 'file_transfer_section', + join('|', $loc->N("Networking"), $loc->N("IRC")) => 'irc_section', + join('|', $loc->N("Networking"), $loc->N("Instant messaging")) => 'instant_messaging_section', + join('|', $loc->N("Networking"), $loc->N("Mail")) => 'mail_section', + join('|', $loc->N("Networking"), $loc->N("News")) => 'news_section', + join('|', $loc->N("Networking"), $loc->N("Other")) => 'other_networking', + join('|', $loc->N("Networking"), $loc->N("Remote access")) => 'remote_access_section', + join('|', $loc->N("Networking"), $loc->N("WWW")) => 'networking_www_section', + $loc->N("Office") => 'office_section', + join('|', $loc->N("Office"), $loc->N("Dictionary")) => 'office_dictionary_section', + join('|', $loc->N("Office"), $loc->N("Finance")) => 'finances_section', + join('|', $loc->N("Office"), $loc->N("Management")) => 'timemanagement_section', + join('|', $loc->N("Office"), $loc->N("Organizer")) => 'timemanagement_section', + join('|', $loc->N("Office"), $loc->N("Utilities")) => 'office_accessories_section', + join('|', $loc->N("Office"), $loc->N("Spreadsheet")) => 'spreadsheet_section', + join('|', $loc->N("Office"), $loc->N("Suite")) => 'office_suite', + join('|', $loc->N("Office"), $loc->N("Word processor")) => 'wordprocessor_section', + $loc->N("Publishing") => 'publishing_section', + $loc->N("Sciences") => 'sciences_section', + join('|', $loc->N("Sciences"), $loc->N("Astronomy")) => 'astronomy_section', + join('|', $loc->N("Sciences"), $loc->N("Biology")) => 'biology_section', + join('|', $loc->N("Sciences"), $loc->N("Chemistry")) => 'chemistry_section', + join('|', $loc->N("Sciences"), $loc->N("Computer science")) => 'computer_science_section', + join('|', $loc->N("Sciences"), $loc->N("Geosciences")) => 'geosciences_section', + join('|', $loc->N("Sciences"), $loc->N("Mathematics")) => 'mathematics_section', + join('|', $loc->N("Sciences"), $loc->N("Other")) => 'other_sciences', + join('|', $loc->N("Sciences"), $loc->N("Physics")) => 'physics_section', + $loc->N("Security") => 'security_section', + $loc->N("Shells") => 'shells_section', + $loc->N("Sound") => 'sound_section', + join('|', $loc->N("Sound"), $loc->N("Editors and Converters")) => 'sound_editors_section', + join('|', $loc->N("Sound"), $loc->N("Midi")) => 'sound_midi_section', + join('|', $loc->N("Sound"), $loc->N("Mixers")) => 'sound_mixers_section', + join('|', $loc->N("Sound"), $loc->N("Players")) => 'sound_players_section', + join('|', $loc->N("Sound"), $loc->N("Utilities")) => 'sound_utilities_section', + $loc->N("System") => 'system_section', + join('|', $loc->N("System"), $loc->N("Base")) => 'system_section', + join('|', $loc->N("System"), $loc->N("Boot and Init")) => 'boot_init_section', + join('|', $loc->N("System"), $loc->N("Cluster")) => 'parallel_computing_section', + join('|', $loc->N("System"), $loc->N("Configuration")) => 'configuration_section', + join('|', $loc->N("System"), $loc->N("Fonts")) => 'chinese_section', + join('|', $loc->N("System"), $loc->N("Fonts"), $loc->N("True type")) => '', + join('|', $loc->N("System"), $loc->N("Fonts"), $loc->N("Type1")) => '', + join('|', $loc->N("System"), $loc->N("Fonts"), $loc->N("X11 bitmap")) => '', + join('|', $loc->N("System"), $loc->N("Internationalization")) => 'chinese_section', + join('|', $loc->N("System"), $loc->N("Kernel and hardware")) => 'hardware_configuration_section', + join('|', $loc->N("System"), $loc->N("Libraries")) => 'system_section', + join('|', $loc->N("System"), $loc->N("Networking")) => 'networking_configuration_section', + join('|', $loc->N("System"), $loc->N("Packaging")) => 'packaging_section', + join('|', $loc->N("System"), $loc->N("Printing")) => 'printing_section', + join('|', $loc->N("System"), $loc->N("Servers")) => 'servers_section', + join('|', $loc->N("System"), #-PO: This is a package/product name. Only translate it if needed: - N("X11")) => 'x11_section', - N("Terminals") => 'terminals_section', - N("Text tools") => 'text_tools_section', - N("Toys") => 'toys_section', - N("Video") => 'video_section', - join('|', N("Video"), N("Editors and Converters")) => 'video_editors_section', - join('|', N("Video"), N("Players")) => 'video_players_section', - join('|', N("Video"), N("Television")) => 'video_television_section', - join('|', N("Video"), N("Utilities")) => 'video_utilities_section', + $loc->N("X11")) => 'x11_section', + $loc->N("Terminals") => 'terminals_section', + $loc->N("Text tools") => 'text_tools_section', + $loc->N("Toys") => 'toys_section', + $loc->N("Video") => 'video_section', + join('|', $loc->N("Video"), $loc->N("Editors and Converters")) => 'video_editors_section', + join('|', $loc->N("Video"), $loc->N("Players")) => 'video_players_section', + join('|', $loc->N("Video"), $loc->N("Television")) => 'video_television_section', + join('|', $loc->N("Video"), $loc->N("Utilities")) => 'video_utilities_section', # for Mageia Choice: - N("Workstation") => 'system_section', - join('|', N("Workstation"), N("Configuration")) => 'configuration_section', - join('|', N("Workstation"), N("Console Tools")) => 'interpreters_section', - join('|', N("Workstation"), N("Documentation")) => 'documentation_section', - join('|', N("Workstation"), N("Game station")) => 'amusement_section', - join('|', N("Workstation"), N("Internet station")) => 'networking_section', - join('|', N("Workstation"), N("Multimedia station")) => 'multimedia_section', - join('|', N("Workstation"), N("Network Computer (client)")) => 'other_networking', - join('|', N("Workstation"), N("Office Workstation")) => 'office_section', - join('|', N("Workstation"), N("Scientific Workstation")) => 'sciences_section', - N("Graphical Environment") => 'graphical_desktop_section', + $loc->N("Workstation") => 'system_section', + join('|', $loc->N("Workstation"), $loc->N("Configuration")) => 'configuration_section', + join('|', $loc->N("Workstation"), $loc->N("Console Tools")) => 'interpreters_section', + join('|', $loc->N("Workstation"), $loc->N("Documentation")) => 'documentation_section', + join('|', $loc->N("Workstation"), $loc->N("Game station")) => 'amusement_section', + join('|', $loc->N("Workstation"), $loc->N("Internet station")) => 'networking_section', + join('|', $loc->N("Workstation"), $loc->N("Multimedia station")) => 'multimedia_section', + join('|', $loc->N("Workstation"), $loc->N("Network Computer (client)")) => 'other_networking', + join('|', $loc->N("Workstation"), $loc->N("Office Workstation")) => 'office_section', + join('|', $loc->N("Workstation"), $loc->N("Scientific Workstation")) => 'sciences_section', + $loc->N("Graphical Environment") => 'graphical_desktop_section', - join('|', N("Graphical Environment"), N("GNOME Workstation")) => 'gnome_section', - join('|', N("Graphical Environment"), N("IceWm Desktop")) => 'icewm_section', - join('|', N("Graphical Environment"), N("KDE Workstation")) => 'kde_section', - join('|', N("Graphical Environment"), N("Other Graphical Desktops")) => 'more_applications_other_section', - N("Development") => 'development_section', - join('|', N("Development"), N("Development")) => 'development_section', - join('|', N("Development"), N("Documentation")) => 'documentation_section', - N("Server") => 'servers_section', - join('|', N("Server"), N("DNS/NIS")) => 'networking_section', - join('|', N("Server"), N("Database")) => 'databases_section', - join('|', N("Server"), N("Firewall/Router")) => 'networking_section', - join('|', N("Server"), N("Mail")) => 'mail_section', - join('|', N("Server"), N("Mail/Groupware/News")) => 'mail_section', - join('|', N("Server"), N("Network Computer server")) => 'networking_section', - join('|', N("Server"), N("Web/FTP")) => 'networking_www_section', + join('|', $loc->N("Graphical Environment"), $loc->N("GNOME Workstation")) => 'gnome_section', + join('|', $loc->N("Graphical Environment"), $loc->N("IceWm Desktop")) => 'icewm_section', + join('|', $loc->N("Graphical Environment"), $loc->N("KDE Workstation")) => 'kde_section', + join('|', $loc->N("Graphical Environment"), $loc->N("Other Graphical Desktops")) => 'more_applications_other_section', + $loc->N("Development") => 'development_section', + join('|', $loc->N("Development"), $loc->N("Development")) => 'development_section', + join('|', $loc->N("Development"), $loc->N("Documentation")) => 'documentation_section', + $loc->N("Server") => 'servers_section', + join('|', $loc->N("Server"), $loc->N("DNS/NIS")) => 'networking_section', + join('|', $loc->N("Server"), $loc->N("Database")) => 'databases_section', + join('|', $loc->N("Server"), $loc->N("Firewall/Router")) => 'networking_section', + join('|', $loc->N("Server"), $loc->N("Mail")) => 'mail_section', + join('|', $loc->N("Server"), $loc->N("Mail/Groupware/News")) => 'mail_section', + join('|', $loc->N("Server"), $loc->N("Network Computer server")) => 'networking_section', + join('|', $loc->N("Server"), $loc->N("Web/FTP")) => 'networking_www_section', ); diff --git a/lib/AdminPanel/Rpmdragora/init.pm b/lib/AdminPanel/Rpmdragora/init.pm index ba22835..18b7905 100644 --- a/lib/AdminPanel/Rpmdragora/init.pm +++ b/lib/AdminPanel/Rpmdragora/init.pm @@ -34,6 +34,7 @@ BEGIN { $::no_global_argv_parsing = 1 } require urpm::args; use AdminPanel::Privileges; +use AdminPanel::Shared::Locales; use Exporter; our @ISA = qw(Exporter); @@ -49,25 +50,27 @@ 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 = AdminPanel::Shared::Locales->new(domain_name => 'rpmdrake'); + my $basename = sub { local $_ = shift; s|/*\s*$||; s|.*/||; $_ }; any { /^--?h/ } @ARGV and do { - printf join("\n", N("Usage: %s [OPTION]...", $basename->($0)), -N(" --auto assume default answers to questions"), -N(" --changelog-first display changelog before filelist in the description window"), -N(" --media=medium1,.. limit to given media"), -N(" --merge-all-rpmnew propose to merge all .rpmnew/.rpmsave files found"), -N(" --mode=MODE set mode (install (default), remove, update)"), -N(" --justdb update the database, but do not modify the filesystem"), -N(" --no-confirmation don't ask first confirmation question in update mode"), -N(" --no-media-update don't update media at startup"), -N(" --no-verify-rpm don't verify package signatures"), -if_($0 !~ /MageiaUpdate/, N(" --parallel=alias,host be in parallel mode, use \"alias\" group, use \"host\" machine to show needed deps")), -N(" --rpm-root=path use another root for rpm installation"), -N(" --urpmi-root use another root for urpmi db & rpm installation"), -N(" --run-as-root force to run as root"), -N(" --search=pkg run search for \"pkg\""), -N(" --test only verify if the installation can be achieved correctly"), -chomp_(N(" --version print this tool's version number + 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 !~ /MageiaUpdate/, $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 ")), "" ); @@ -158,8 +161,9 @@ our $changelog_first = $AdminPanel::rpmdragora::changelog_first_config->[0]; $changelog_first = 1 if $rpmdragora_options{'changelog-first'}; sub warn_about_user_mode() { - my $title = N("Running in user mode"); - my $msg = N("You are launching this program as a normal user.\n". + my $loc = AdminPanel::Shared::Locales->new(domain_name => 'rpmdrake'); + 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". "but you may still browse the existing database."); diff --git a/lib/AdminPanel/Rpmdragora/open_db.pm b/lib/AdminPanel/Rpmdragora/open_db.pm index dafe076..615e841 100644 --- a/lib/AdminPanel/Rpmdragora/open_db.pm +++ b/lib/AdminPanel/Rpmdragora/open_db.pm @@ -45,6 +45,8 @@ our @EXPORT = qw(fast_open_urpmi_db open_urpmi_db ); +my $loc = AdminPanel::rpmdragora::locale(); + # because rpm blocks some signals when rpm DB is opened, we don't keep open around: sub open_rpm_db { @@ -82,8 +84,8 @@ sub fast_open_urpmi_db() { my $error_happened; $urpm->{fatal} = sub { $error_happened = 1; - interactive_msg(N("Fatal error"), - N("A fatal error occurred: %s.", $_[1])); + interactive_msg($loc->N("Fatal error"), + $loc->N("A fatal error occurred: %s.", $_[1])); }; urpm::set_files($urpm, $::rpmdragora_options{'urpmi-root'}[0]) if $::rpmdragora_options{'urpmi-root'}[0]; @@ -129,7 +131,7 @@ sub is_it_a_devel_distro() { sub get_backport_media { my ($urpm) = @_; - grep { $_->{name} =~ /backport/i && + grep { $_->{name} =~ /backport/i && $_->{name} !~ /debug|sources|testing/i } @{$urpm->{media}}; } diff --git a/lib/AdminPanel/Rpmdragora/pkg.pm b/lib/AdminPanel/Rpmdragora/pkg.pm index 465fbc4..793de8f 100644 --- a/lib/AdminPanel/Rpmdragora/pkg.pm +++ b/lib/AdminPanel/Rpmdragora/pkg.pm @@ -31,6 +31,7 @@ use common; use POSIX qw(_exit ceil); use URPM; use utf8; +use AdminPanel::rpmdragora; use AdminPanel::Rpmdragora::open_db; use AdminPanel::Rpmdragora::gurpm; use AdminPanel::Rpmdragora::formatting; @@ -46,6 +47,7 @@ use urpm::select; use urpm::main_loop; use urpm::args qw(); +my $loc = AdminPanel::rpmdragora::locale(); use Exporter; our @ISA = qw(Exporter); @@ -112,7 +114,7 @@ sub extract_header { if ($p->flag_installed && !$p->flag_upgrade) { my @files = map { chomp_($_) } run_rpm("rpm -ql $name"); - add2hash($pkg, { files => [ @files ? @files : N("(none)") ], + add2hash($pkg, { files => [ @files ? @files : $loc->N("(none)") ], description => rpm_description(scalar(run_rpm("rpm -q --qf '%{description}' $name"))), changelog => format_changelog_string($o_installed_version, scalar(run_rpm("rpm -q --changelog $name"))) }); } else { @@ -124,14 +126,14 @@ sub extract_header { $local_source = "$dir/" . $p->filename if $dir; print "local_source: $local_source\n"; if (-e $local_source) { - $bar_id = statusbar_msg(N("Getting information from %s...", $dir), 0); + $bar_id = statusbar_msg($loc->N("Getting information from %s...", $dir), 0); $urpm->{log}("getting information from rpms from $dir"); } else { my $gurpm; - $bar_id = statusbar_msg(N("Getting '%s' from XML meta-data...", $xml_info), 0); + $bar_id = statusbar_msg($loc->N("Getting '%s' from XML meta-data...", $xml_info), 0); my $_gurpm_clean_guard = before_leaving { undef $gurpm }; if (my $xml_info_file = eval { urpm::media::any_xml_info($urpm, $medium, $xml_info, undef, sub { - $gurpm ||= AdminPanel::Rpmdragora::gurpm->new(N("Please wait"), + $gurpm ||= AdminPanel::Rpmdragora::gurpm->new($loc->N("Please wait"), '', # FIXME: add a real string after cooker transient => $::main_window); download_callback($gurpm, @_) @@ -145,9 +147,9 @@ sub extract_header { put_in_hash($xml_info_pkgs{$name} ||= {}, $nodes{$name}); } else { if ($xml_info eq 'info') { - $urpm->{info}(N("No xml info for medium \"%s\", only partial result for package %s", $medium->{name}, $name)); + $urpm->{info}($loc->N("No xml info for medium \"%s\", only partial result for package %s", $medium->{name}, $name)); } else { - $urpm->{error}(N("No xml info for medium \"%s\", unable to return any result for package %s", $medium->{name}, $name)); + $urpm->{error}($loc->N("No xml info for medium \"%s\", unable to return any result for package %s", $medium->{name}, $name)); } } } @@ -159,7 +161,7 @@ sub extract_header { goto header_non_available; }; my @files = $p->files; - @files = N("(none)") if !@files; + @files = $loc->N("(none)") if !@files; add2hash($pkg, { description => rpm_description($p->description), files => \@files, url => $p->url, @@ -172,7 +174,7 @@ sub extract_header { }); } elsif ($xml_info eq 'files') { my @files = map { chomp_(to_utf8($_)) } split("\n", $xml_info_pkgs{$name}{files}); - add2hash($pkg, { files => [ @files ? @files : N("(none)") ] }); + add2hash($pkg, { files => [ @files ? @files : $loc->N("(none)") ] }); } elsif ($xml_info eq 'changelog') { add2hash($pkg, { changelog => format_changelog_changelogs($o_installed_version, @@ -184,7 +186,7 @@ sub extract_header { } return; header_non_available: - add2hash($pkg, { summary => $p->summary || N("(Not available)"), description => undef }); + add2hash($pkg, { summary => $p->summary || $loc->N("(Not available)"), description => undef }); } } @@ -192,7 +194,7 @@ sub find_installed_version { my ($p) = @_; my $version; open_rpm_db()->traverse_tag_find('name', $p->name, sub { $version = $_[0]->EVR }); - $version || N("(none)"); + $version || $loc->N("(none)"); } my $canceled; @@ -200,15 +202,15 @@ sub download_callback { my ($gurpm, $mode, $file, $percent, $total, $eta, $speed) = @_; $canceled = 0; if ($mode eq 'start') { - $gurpm->label(N("Downloading package `%s'...", basename($file))); - $gurpm->validate_cancel(but(N("Cancel")), sub { $canceled = 1 }); + $gurpm->label($loc->N("Downloading package `%s'...", basename($file))); + $gurpm->validate_cancel(but($loc->N("Cancel")), sub { $canceled = 1 }); } elsif ($mode eq 'progress') { $gurpm->label( join("\n", - N("Downloading package `%s'...", basename($file)), + $loc->N("Downloading package `%s'...", basename($file)), (defined $total && defined $eta ? - N(" %s%% of %s completed, ETA = %s, speed = %s", $percent, $total, $eta, $speed) - : N(" %s%% completed, speed = %s", $percent, $speed) + $loc->N(" %s%% of %s completed, ETA = %s, speed = %s", $percent, $total, $eta, $speed) + : $loc->N(" %s%% completed, speed = %s", $percent, $speed) ) =~ /^\s*(.*)/ ), ); @@ -247,12 +249,12 @@ sub warn_about_media { if (@update_medias > 0) { if (!$options{skip_updating_mu} && !$is_update_media_already_asked) { $is_update_media_already_asked = 1; - $::rpmdragora_options{'no-confirmation'} or interactive_msg(N("Confirmation"), -N("I need to contact the mirror to get latest update packages. + $::rpmdragora_options{'no-confirmation'} or interactive_msg($loc->N("Confirmation"), +$loc->N("I need to contact the mirror to get latest update packages. Please check that your network is currently running. Is it ok to continue?"), yesno => 1 -# TODO widget => gtknew('CheckButton', text => N("Do not ask me next time"), +# TODO widget => gtknew('CheckButton', text => $loc->N("Do not ask me next time"), # active_ref => \$::rpmdragora_options{'no-confirmation'} # ) ) or myexit(-1); @@ -262,27 +264,27 @@ Is it ok to continue?"), yesno => 1 } } else { if (any { $_->{update} } @{$urpm->{media}}) { - interactive_msg(N("Already existing update media"), -N("You already have at least one update medium configured, but + interactive_msg($loc->N("Already existing update media"), +$loc->N("You already have at least one update medium configured, but all of them are currently disabled. You should run the Software Media Manager to enable at least one (check it in the \"%s\" column). -Then, restart \"%s\".", N("Enabled"), $AdminPanel::rpmdragora::myname_update)); +Then, restart \"%s\".", $loc->N("Enabled"), $AdminPanel::rpmdragora::myname_update)); myexit(-1); } my ($mirror) = choose_mirror($urpm, transient => $w->{real_window} || $::main_window, message => join("\n\n", - N("You have no configured update media. MageiaUpdate cannot operate without any update media."), - N("I need to contact the Mageia website to get the mirror list. + $loc->N("You have no configured update media. MageiaUpdate cannot operate without any update media."), + $loc->N("I need to contact the Mageia website to get the mirror list. Please check that your network is currently running. Is it ok to continue?"), ), ); my $m = ref($mirror) ? $mirror->{url} : ''; - $m or interactive_msg(N("How to choose manually your mirror"), -N("You may also choose your desired mirror manually: to do so, + $m or interactive_msg($loc->N("How to choose manually your mirror"), +$loc->N("You may also choose your desired mirror manually: to do so, launch the Software Media Manager, and then add a `Security updates' medium. @@ -437,7 +439,7 @@ sub get_pkgs { my (%options) = @_; my $w = $::main_window; - my $gurpm = AdminPanel::Rpmdragora::gurpm->new(1 ? N("Please wait") : N("Package installation..."), N("Initializing..."), transient => $::main_window); + my $gurpm = AdminPanel::Rpmdragora::gurpm->new(1 ? $loc->N("Please wait") : $loc->N("Package installation..."), $loc->N("Initializing..."), transient => $::main_window); my $_gurpm_clean_guard = before_leaving { undef $gurpm }; #my $_flush_guard = Gtk2::GUI_Update_Guard->new; @@ -452,24 +454,24 @@ sub get_pkgs { # update media list in case warn_about_media() added some: @update_medias = get_update_medias($urpm); - $gurpm->label(N("Reading updates description")); + $gurpm->label($loc->N("Reading updates description")); $gurpm->progress(100); #- parse the description file my $update_descr = urpm::get_updates_description($urpm, @update_medias); - my $_unused = N("Please wait, finding available packages..."); + my $_unused = $loc->N("Please wait, finding available packages..."); # find out installed packages: init_progress_bar($urpm); - $gurpm->label(N("Please wait, listing base packages...")); + $gurpm->label($loc->N("Please wait, listing base packages...")); $gurpm->progress(ceil($level*100)); my $db = eval { open_rpm_db() }; if (my $err = $@) { - interactive_msg(N("Error"), N("A fatal error occurred: %s.", $err)); + interactive_msg($loc->N("Error"), $loc->N("A fatal error occurred: %s.", $err)); return; } @@ -477,7 +479,7 @@ sub get_pkgs { local $SIG{INT} = $sig_handler; local $SIG{QUIT} = $sig_handler; - $gurpm->label(N("Please wait, finding installed packages...")); + $gurpm->label($loc->N("Please wait, finding installed packages...")); $level = 0.33*100; $gurpm->progress(ceil($level)); reset_pbar_count(0.66*100); @@ -494,7 +496,7 @@ sub get_pkgs { $urpm->{state} = {}; - $gurpm->label(N("Please wait, finding available packages...")); + $gurpm->label($loc->N("Please wait, finding available packages...")); $level = 0.66*100; $gurpm->progress(ceil($level)); @@ -597,9 +599,9 @@ sub display_READMEs_if_needed { my %Readmes = %{$urpm->{readmes}}; if (keys %Readmes) { #- display the README*.urpmi files interactive_packtable( - N("Upgrade information"), + $loc->N("Upgrade information"), $w, - N("These packages come with upgrade information"), + $loc->N("These packages come with upgrade information"), [ map { my $fullname = $_; [ gtkpack__( @@ -607,17 +609,17 @@ sub display_READMEs_if_needed { gtkset_selectable(gtknew('Label', text => $Readmes{$fullname}),1), ), gtksignal_connect( - gtknew('Button', text => N("Upgrade information about this package")), + gtknew('Button', text => $loc->N("Upgrade information about this package")), clicked => sub { interactive_msg( - N("Upgrade information about package %s", $Readmes{$fullname}), + $loc->N("Upgrade information about package %s", $Readmes{$fullname}), (join '' => map { s/$/\n/smg; $_ } formatAlaTeX(scalar cat_($fullname))), scroll => 1, ); }, ), ] } keys %Readmes ], - [ gtknew('Button', text => N("Ok"), clicked => sub { Gtk2->main_quit }) ] + [ gtknew('Button', text => $loc->N("Ok"), clicked => sub { Gtk2->main_quit }) ] ); } } @@ -631,13 +633,13 @@ sub perform_parallel_install { if ($res) { $$statusbar_msg_id = statusbar_msg( - #N("Everything installed successfully"), - N("All requested packages were installed successfully."), + #$loc->N("Everything installed successfully"), + $loc->N("All requested packages were installed successfully."), ); } else { interactive_msg( - N("Problem during installation"), - N("There was a problem during the installation:\n\n%s", join("\n", @error_msgs)), + $loc->N("Problem during installation"), + $loc->N("There was a problem during the installation:\n\n%s", join("\n", @error_msgs)), scroll => 1, ); } @@ -656,8 +658,8 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-( my $fatal_msg = $_[1]; printf STDERR "Fatal: %s\n", $fatal_msg; undef $gurpm; - interactive_msg(N("Installation failed"), - N("There was a problem during the installation:\n\n%s", $fatal_msg)); + interactive_msg($loc->N("Installation failed"), + $loc->N("There was a problem during the installation:\n\n%s", $fatal_msg)); goto return_with_exit_code; }; local $urpm->{error} = sub { printf STDERR "Error: %s\n", $_[0]; push @error_msgs, $_[0] }; @@ -679,7 +681,7 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-( } my $state = $priority_state || $probe_only_for_updates ? { } : $urpm->{rpmdragora_state}; - my $bar_id = statusbar_msg(N("Checking validity of requested packages..."), 0); + my $bar_id = statusbar_msg($loc->N("Checking validity of requested packages..."), 0); # FIXME: THIS SET flag_requested on all packages!!!! # select packages to install / enssure selected pkg set is consistant: @@ -698,9 +700,9 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-( my ($local_sources, $blist) = urpm::get_pkgs::selected2local_and_blists($urpm, $state->{selected}); if (!$local_sources && (!$blist || !@$blist)) { interactive_msg( - N("Unable to get source packages."), - N("Unable to get source packages, sorry. %s", - @error_msgs ? N("\n\nError(s) reported:\n%s", join("\n", @error_msgs)) : ''), + $loc->N("Unable to get source packages."), + $loc->N("Unable to get source packages, sorry. %s", + @error_msgs ? $loc->N("\n\nError(s) reported:\n%s", join("\n", @error_msgs)) : ''), scroll => 1, ); goto return_with_exit_code; @@ -717,21 +719,21 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-( my ($size, $filesize) = $urpm->selected_size_filesize($state); my $install_count = int(@pkgs); my $to_install = $install_count == 0 ? '' : - ($priority_state ? '<b>' . N("Rpmdragora or one of its priority dependencies needs to be updated first. Rpmdragora will then restart.") . '</b>' . "\n\n" : '') . + ($priority_state ? '<b>' . $loc->N("Rpmdragora or one of its priority dependencies needs to be updated first. Rpmdragora will then restart.") . '</b>' . "\n\n" : '') . (P("The following package is going to be installed:", "The following %d packages are going to be installed:", $install_count, $install_count) . "\n\n" . format_list(map { s!.*/!!; $_ } @pkgs)); my $remove_count = scalar(@to_remove); - interactive_msg(($to_install ? N("Confirmation") : N("Some packages need to be removed")), + interactive_msg(($to_install ? $loc->N("Confirmation") : $loc->N("Some packages need to be removed")), join("\n\n", ($r ? (!$to_install ? (P("Remove one package?", "Remove %d packages?", $remove_count, $remove_count), $r) : (($remove_count == 1 ? - N("The following package has to be removed for others to be upgraded:") - : N("The following packages have to be removed for others to be upgraded:")), $r), if_($to_install, $to_install)) + $loc->N("The following package has to be removed for others to be upgraded:") + : $loc->N("The following packages have to be removed for others to be upgraded:")), $r), if_($to_install, $to_install)) : $to_install), format_size($size), format_filesize($filesize), - N("Is it ok to continue?")), + $loc->N("Is it ok to continue?")), scroll => 1, yesno => 1) or return 1; @@ -740,14 +742,14 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-( # select packages to uninstall for !update mode: perform_removal($urpm, { map { $_ => $pkgs->{$_} } @to_remove }) if !$probe_only_for_updates; - # $gurpm = AdminPanel::Rpmdragora::gurpm->new(1 ? N("Please wait") : N("Package installation..."), N("Initializing..."), transient => $::main_window); + # $gurpm = AdminPanel::Rpmdragora::gurpm->new(1 ? $loc->N("Please wait") : $loc->N("Package installation..."), $loc->N("Initializing..."), transient => $::main_window); # my $_gurpm_clean_guard = before_leaving { undef $gurpm }; my $something_installed; if (@to_install && $::rpmdragora_options{auto_orphans}) { urpm::orphans::compute_future_unrequested_orphans($urpm, $state); if (my @orphans = map { scalar $_->fullname } @{$state->{orphans_to_remove}}) { - interactive_msg(N("Orphan packages"), P("The following orphan package will be removed.", + interactive_msg($loc->N("Orphan packages"), P("The following orphan package will be removed.", "The following orphan packages will be removed.", scalar(@orphans)) . "\n" . urpm::orphans::add_leading_spaces(join("\n", @orphans) . "\n"), scroll => 1); } @@ -763,13 +765,13 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-( my $pkg = defined $id ? $urpm->{depslist}[$id] : undef; if ($subtype eq 'start') { if ($type eq 'trans') { - print(1 ? N("Preparing package installation...") : N("Preparing package installation transaction...")); - # $gurpm->label(1 ? N("Preparing package installation...") : N("Preparing package installation transaction...")); + print(1 ? $loc->N("Preparing package installation...") : $loc->N("Preparing package installation transaction...")); + # $gurpm->label(1 ? $loc->N("Preparing package installation...") : $loc->N("Preparing package installation transaction...")); } elsif (defined $pkg) { $something_installed = 1; - print(N("Installing package `%s' (%s/%s)...", $pkg->name, ++$transaction_progress_nb, scalar(@{$transaction->{upgrade}}))."\n" . N("Total: %s/%s", ++$progress_nb, $install_count)); - # $gurpm->label(N("Installing package `%s' (%s/%s)...", $pkg->name, ++$transaction_progress_nb, scalar(@{$transaction->{upgrade}})) - # . "\n" . N("Total: %s/%s", ++$progress_nb, $install_count)); + print($loc->N("Installing package `%s' (%s/%s)...", $pkg->name, ++$transaction_progress_nb, scalar(@{$transaction->{upgrade}}))."\n" . $loc->N("Total: %s/%s", ++$progress_nb, $install_count)); + # $gurpm->label($loc->N("Installing package `%s' (%s/%s)...", $pkg->name, ++$transaction_progress_nb, scalar(@{$transaction->{upgrade}})) + # . "\n" . $loc->N("Total: %s/%s", ++$progress_nb, $install_count)); } } elsif ($subtype eq 'progress') { $gurpm->progress($total ? ceil(($amount/$total)*100) : 100); @@ -833,19 +835,19 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-( copy_removable => sub { my ($medium) = @_; interactive_msg( - N("Change medium"), - N("Please insert the medium named \"%s\"", $medium), - yesno => 1, text => { no => N("Cancel"), yes => N("Ok") }, + $loc->N("Change medium"), + $loc->N("Please insert the medium named \"%s\"", $medium), + yesno => 1, text => { no => $loc->N("Cancel"), yes => $loc->N("Ok") }, ); }, - pre_check_sig => sub { $gurpm->label(N("Verifying package signatures...")) }, + pre_check_sig => sub { $gurpm->label($loc->N("Verifying package signatures...")) }, check_sig => sub { $gurpm->progress(ceil(++$progress/$total)*100) }, bad_signature => sub { my ($msg, $msg2) = @_; local $::main_window = $gurpm->{real_window}; $msg =~ s/:$/\n\n/m; # FIXME: to be fixed in urpmi after 2008.0 interactive_msg( - N("Warning"), "$msg\n\n$msg2", yesno => 1, if_(10 < ($msg =~ tr/\n/\n/), scroll => 1), + $loc->N("Warning"), "$msg\n\n$msg2", yesno => 1, if_(10 < ($msg =~ tr/\n/\n/), scroll => 1), ); }, post_download => sub { @@ -855,30 +857,30 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-( need_restart => sub { my ($need_restart_formatted) = @_; # FIXME: offer to restart the system - interactive_msg(N("Warning"), join("\n", values %$need_restart_formatted), scroll => 1); + interactive_msg($loc->N("Warning"), join("\n", values %$need_restart_formatted), scroll => 1); }, trans_error_summary => sub { my ($nok, $errors) = @_; interactive_msg( - N("Problem during installation"), - if_($nok, N("%d installation transactions failed", $nok) . "\n\n") . - N("There was a problem during the installation:\n\n%s", + $loc->N("Problem during installation"), + if_($nok, $loc->N("%d installation transactions failed", $nok) . "\n\n") . + $loc->N("There was a problem during the installation:\n\n%s", join("\n\n", @$errors, @error_msgs)), scroll => 1, ); }, need_restart => sub { my ($need_restart_formatted) = @_; - interactive_msg(N("Warning"), + interactive_msg($loc->N("Warning"), join("\n\n", values %$need_restart_formatted)); }, success_summary => sub { if (!($done || @to_remove)) { - interactive_msg(N("Error"), - N("Unrecoverable error: no package found for installation, sorry.")); + interactive_msg($loc->N("Error"), + $loc->N("Unrecoverable error: no package found for installation, sorry.")); return; } - my $id = statusbar_msg(N("Inspecting configuration files..."), 0); + my $id = statusbar_msg($loc->N("Inspecting configuration files..."), 0); my %pkg2rpmnew; foreach my $id (@rpms_upgrade) { my $pkg = $urpm->{depslist}[$id]; @@ -886,20 +888,20 @@ sub perform_installation { #- (partially) duplicated from /usr/sbin/urpmi :-( $pkg2rpmnew{$pkg->fullname} = [ grep { -r "$_.rpmnew" || -r "$_.rpmsave" } $pkg->conf_files ]; } statusbar_msg_remove($id); - dialog_rpmnew(N("The installation is finished; everything was installed correctly. + dialog_rpmnew($loc->N("The installation is finished; everything was installed correctly. Some configuration files were created as `.rpmnew' or `.rpmsave', you may now inspect some in order to take actions:"), %pkg2rpmnew) - and statusbar_msg(N("All requested packages were installed successfully."), 1); - statusbar_msg(N("Looking for \"README\" files..."), 1); + and statusbar_msg($loc->N("All requested packages were installed successfully."), 1); + statusbar_msg($loc->N("Looking for \"README\" files..."), 1); display_READMEs_if_needed($urpm, $w); }, already_installed_or_not_installable => sub { my ($msg1, $msg2) = @_; my $msg = join("\n", @$msg1, @$msg2); return if !$msg; # workaround missing state - interactive_msg(N("Error"), $msg); + interactive_msg($loc->N("Error"), $msg); }, }, ); @@ -925,16 +927,16 @@ you may now inspect some in order to take actions:"), exit(0); } - my $_s1 = N("RPM transaction %d/%d", 0, 0); - my $_s2 = N("Unselect all"); - my $_s3 = N("Details"); + my $_s1 = $loc->N("RPM transaction %d/%d", 0, 0); + my $_s2 = $loc->N("Unselect all"); + my $_s3 = $loc->N("Details"); statusbar_msg_remove($statusbar_msg_id); #- XXX maybe remove this if ($exit_code == 0 && !$::rpmdragora_options{auto_orphans}) { if (urpm::orphans::check_unrequested_orphans_after_auto_select($urpm)) { if (my $msg = urpm::orphans::get_now_orphans_gui_msg($urpm)) { - interactive_msg(N("Orphan packages"), $msg, scroll => 1); + interactive_msg($loc->N("Orphan packages"), $msg, scroll => 1); } } } @@ -950,7 +952,7 @@ sub perform_removal { my ($urpm, $pkgs) = @_; my @toremove = map { if_($pkgs->{$_}{selected}, $pkgs->{$_}{urpm_name}) } keys %$pkgs; return if !@toremove; - my $gurpm = AdminPanel::Rpmdragora::gurpm->new(1 ? N("Please wait") : N("Please wait, removing packages..."), N("Initializing..."), transient => $::main_window); + my $gurpm = AdminPanel::Rpmdragora::gurpm->new(1 ? $loc->N("Please wait") : $loc->N("Please wait, removing packages..."), $loc->N("Initializing..."), transient => $::main_window); my $_gurpm_clean_guard = before_leaving { undef $gurpm }; my $may_be_orphans = 1; @@ -970,7 +972,7 @@ sub perform_removal { my @results; slow_func_statusbar( - N("Please wait, removing packages..."), + $loc->N("Please wait, removing packages..."), $::main_window, sub { @results = $::rpmdragora_options{parallel} @@ -983,15 +985,15 @@ sub perform_removal { ); if (@results) { interactive_msg( - N("Problem during removal"), - N("There was a problem during the removal of packages:\n\n%s", join("\n", @results)), + $loc->N("Problem during removal"), + $loc->N("There was a problem during the removal of packages:\n\n%s", join("\n", @results)), if_(@results > 1, scroll => 1), ); return 1; } else { if ($may_be_orphans && !$::rpmdragora_options{auto_orphans}) { if (my $msg = urpm::orphans::get_now_orphans_gui_msg($urpm)) { - interactive_msg(N("Information"), $msg, scroll => 1); + interactive_msg($loc->N("Information"), $msg, scroll => 1); } } return 0; diff --git a/lib/AdminPanel/Rpmdragora/rpmnew.pm b/lib/AdminPanel/Rpmdragora/rpmnew.pm index 3c4335d..5d86638 100644 --- a/lib/AdminPanel/Rpmdragora/rpmnew.pm +++ b/lib/AdminPanel/Rpmdragora/rpmnew.pm @@ -36,6 +36,8 @@ use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(dialog_rpmnew do_merge_if_needed); +my $loc = AdminPanel::rpmdragora::locale(); + # /var/lib/nfs/etab /var/lib/nfs/rmtab /var/lib/nfs/xtab /var/cache/man/whatis my %ignores_rpmnew = map { $_ => 1 } qw( /etc/adjtime @@ -77,8 +79,8 @@ sub inspect { local $ENV{$_} = $ENV{$_} . '.UTF-8' if $ENV{$_} && $ENV{$_} !~ /UTF-8/; } my @diff = map { ensure_utf8($_); $_ } `/usr/bin/diff -u '$file' '$rpmnew'`; - @diff = N("(none)") if !@diff; - my $d = ugtk2->new(N("Inspecting %s", $file), grab => 1, transient => $::main_window); + @diff = $loc->N("(none)") if !@diff; + my $d = ugtk2->new($loc->N("Inspecting %s", $file), grab => 1, transient => $::main_window); my $save_wsize = sub { @inspect_wsize = $d->{rwindow}->get_size }; my %texts; require Gtk2::SourceView2; @@ -103,7 +105,7 @@ sub inspect { ), gtkpack_( gtknew('VBox'), - 0, gtknew('Label', text => N("Changes:")), + 0, gtknew('Label', text => $loc->N("Changes:")), 1, gtknew('ScrolledWindow', child => $texts{diff} = Gtk2::SourceView2::View->new), ), resize1 => 1, @@ -112,21 +114,21 @@ sub inspect { 0, gtknew('WrappedLabel', # prevent bad sizing of Gtk2::WrappedLabel: width => $inspect_wsize[0], - text => N("You can either remove the .%s file, use it as main file or do nothing. If unsure, keep the current file (\"%s\").", - $rpmfile, N("Remove .%s", $rpmfile)), + text => $loc->N("You can either remove the .%s file, use it as main file or do nothing. If unsure, keep the current file (\"%s\").", + $rpmfile, $loc->N("Remove .%s", $rpmfile)), ), 0, gtkpack__( gtknew('HButtonBox'), gtksignal_connect( - gtknew('Button', text => N("Remove .%s", $rpmfile)), + gtknew('Button', text => $loc->N("Remove .%s", $rpmfile)), clicked => sub { $save_wsize->(); unlink $rpmnew; Gtk2->main_quit }, ), gtksignal_connect( - gtknew('Button', text => N("Use .%s as main file", $rpmfile)), + gtknew('Button', text => $loc->N("Use .%s as main file", $rpmfile)), clicked => sub { $save_wsize->(); renamef($rpmnew, $file); Gtk2->main_quit }, ), gtksignal_connect( - gtknew('Button', text => N("Do nothing")), + gtknew('Button', text => $loc->N("Do nothing")), clicked => sub { $save_wsize->(); Gtk2->main_quit }, ), ) @@ -154,7 +156,7 @@ sub dialog_rpmnew { my $sum_rpmnew = sum(map { int @{$p2r{$_}} } keys %p2r); $sum_rpmnew == 0 and return 1; interactive_packtable( - N("Installation finished"), + $loc->N("Installation finished"), $::main_window, $msg, [ map { my $pkg = $_; @@ -169,7 +171,7 @@ sub dialog_rpmnew { ) ), gtksignal_connect( - $b = gtknew('Button', text => N("Inspect...")), + $b = gtknew('Button', text => $loc->N("Inspect...")), clicked => sub { inspect($f); -r "$f.rpmnew" || -r "$f.rpmsave" or $b->set_sensitive(0); @@ -177,7 +179,7 @@ sub dialog_rpmnew { ) ]; } @{$p2r{$pkg}}; } keys %p2r ], - [ gtknew('Button', text => N("Ok"), + [ gtknew('Button', text => $loc->N("Ok"), clicked => sub { Gtk2->main_quit }) ] ); return 0; @@ -187,7 +189,7 @@ sub dialog_rpmnew { sub do_merge_if_needed() { if ($rpmdragora_options{'merge-all-rpmnew'}) { my %pkg2rpmnew; - my $wait = wait_msg(N("Please wait, searching...")); + my $wait = wait_msg($loc->N("Please wait, searching...")); print "Searching .rpmnew and .rpmsave files...\n"; # costly: open_rpm_db()->traverse(sub { diff --git a/lib/AdminPanel/rpmdragora.pm b/lib/AdminPanel/rpmdragora.pm index 78a257a..f4eaac9 100644 --- a/lib/AdminPanel/rpmdragora.pm +++ b/lib/AdminPanel/rpmdragora.pm @@ -47,6 +47,7 @@ use Locale::gettext; use feature 'state'; use AdminPanel::Shared; +use AdminPanel::Shared::Locales; use AdminPanel::Shared::GUI; our @ISA = qw(Exporter); @@ -72,6 +73,7 @@ our @EXPORT = qw( $typical_width $clean_cache $auto_select + locale add_distrib_update_media add_medium_and_check but @@ -115,7 +117,8 @@ use yui; use Glib; #ugtk2::add_icon_path('/usr/share/rpmdragora/icons'); -Locale::gettext::bind_textdomain_codeset('rpmdragora', 'UTF8'); +# Locale::gettext::bind_textdomain_codeset('rpmdragora', 'UTF8'); +my $loc = AdminPanel::Shared::Locales->new(domain_name => 'rpmdrake');; our $mageia_release = MDK::Common::File::cat_( -e '/etc/mageia-release' ? '/etc/mageia-release' : '/etc/release' @@ -125,10 +128,20 @@ 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 ? N_("Software Update") : N_("Mageia Update"); +our $myname_update = $branded ? $loc->N_("Software Update") : $loc->N_("Mageia Update"); @rpmdragora::prompt::ISA = 'urpm::prompt'; + +sub locale() { + + if (!defined($loc)) { + $loc = AdminPanel::Shared::Locales->new(domain_name => 'rpmdrake'); + } + + return $loc; +} + sub rpmdragora::prompt::prompt { my ($self) = @_; my @answers; @@ -144,7 +157,7 @@ sub rpmdragora::prompt::prompt { Gtk2::Label->new($self->{prompts}[$_]), $answers[$_] = gtkset_visibility(gtkentry(), !$self->{hidden}[$_]), ) } 0 .. $#{$self->{prompts}}), - gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub { Gtk2->main_quit }), + gtksignal_connect(Gtk2::Button->new($loc->N("Ok")), clicked => sub { Gtk2->main_quit }), ), ); $d->main; @@ -152,8 +165,8 @@ sub rpmdragora::prompt::prompt { } $urpm::download::PROMPT_PROXY = new rpmdragora::prompt( - N_("Please enter your credentials for accessing proxy\n"), - [ N_("User name:"), N_("Password:") ], + $loc->N_("Please enter your credentials for accessing proxy\n"), + [ $loc->N_("User name:"), $loc->N_("Password:") ], undef, [ 0, 1 ], ); @@ -238,12 +251,12 @@ sub getbanner() { $::MODE or return undef; if (0) { +{ - remove => N("Software Packages Removal"), - update => N("Software Packages Update"), - install => N("Software Packages Installation"), + remove => $loc->N("Software Packages Removal"), + update => $loc->N("Software Packages Update"), + install => $loc->N("Software Packages Installation"), }; } -# Gtk2::Banner->new($ugtk2::wm_icon, $::MODE eq 'update' ? N("Software Packages Update") : N("Software Management")); +# Gtk2::Banner->new($ugtk2::wm_icon, $::MODE eq 'update' ? $loc->N("Software Packages Update") : $loc->N("Software Management")); } # return value: @@ -273,12 +286,12 @@ sub interactive_msg { if ($options{yesno}) { $dlg = $factory->createDialogBox($yui::YMGAMessageBox::B_TWO); - $dlg->setButtonLabel($options{text}{yes} || N("Yes"), $yui::YMGAMessageBox::B_ONE); - $dlg->setButtonLabel($options{text}{no} || N("No"), $yui::YMGAMessageBox::B_TWO); + $dlg->setButtonLabel($options{text}{yes} || $loc->N("Yes"), $yui::YMGAMessageBox::B_ONE); + $dlg->setButtonLabel($options{text}{no} || $loc->N("No"), $yui::YMGAMessageBox::B_TWO); } else { $dlg = $factory->createDialogBox($yui::YMGAMessageBox::B_ONE); - $dlg->setButtonLabel(N("Ok"), $yui::YMGAMessageBox::B_ONE ); + $dlg->setButtonLabel($loc->N("Ok"), $yui::YMGAMessageBox::B_ONE ); } $dlg->setTitle($info->{title}) if (exists $info->{title}); @@ -323,7 +336,7 @@ sub interactive_list { my $factory = yui::YUI::widgetFactory; my $mainw = $factory->createPopupDialog(); my $vbox = $factory->createVBox($mainw); - my $lbltitle = $factory->createLabel($vbox, N("Dependencies")); + my $lbltitle = $factory->createLabel($vbox, $loc->N("Dependencies")); my $radiobuttongroup = $factory->createRadioButtonGroup($vbox); my $rbbox = $factory->createVBox($radiobuttongroup); foreach my $item(@$list){ @@ -331,7 +344,7 @@ sub interactive_list { $radiobutton->setNotify(0); $radiobuttongroup->addRadioButton($radiobutton); } - my $submitButton = $factory->createIconButton($vbox,"", N("OK")); + my $submitButton = $factory->createIconButton($vbox,"", $loc->N("OK")); my $choice; while(1) { @@ -366,7 +379,7 @@ sub fatal_msg { sub wait_msg { my ($msg, %options) = @_; - #OLD my $mainw = ugtk2->new(N("Please wait"), grab => 1, if_(exists $options{transient}, transient => $options{transient})); + #OLD my $mainw = ugtk2->new($loc->N("Please wait"), grab => 1, if_(exists $options{transient}, transient => $options{transient})); #$mainw->{real_window}->set_position($options{transient} ? 'center_on_parent' : 'center_always'); #my $label = $factory->createLabel($vbox, $msg); #OLD my $label = ref($msg) =~ /^Gtk/ ? $msg : Gtk2::WrappedLabel->new($msg); @@ -381,7 +394,7 @@ sub wait_msg { my $factory = yui::YUI::widgetFactory; my $mainw = $factory->createPopupDialog(); my $vbox = $factory->createVBox($mainw); - my $title = $factory->createLabel($vbox, N("Please wait")); + my $title = $factory->createLabel($vbox, $loc->N("Please wait")); #$mainw->recalcLayout(); #$mainw->doneMultipleChanges(); $mainw->waitForEvent(10); @@ -466,50 +479,50 @@ sub slow_func_statusbar ($$&) { } my %u2l = ( - ar => N_("Argentina"), - at => N_("Austria"), - au => N_("Australia"), - by => N_("Belarus"), - be => N_("Belgium"), - br => N_("Brazil"), - gb => N_("Britain"), - ca => N_("Canada"), - ch => N_("Switzerland"), - cr => N_("Costa Rica"), - cz => N_("Czech Republic"), - de => N_("Germany"), - dk => N_("Danmark"), - ec => N_("Ecuador"), - el => N_("Greece"), - es => N_("Spain"), - fi => N_("Finland"), - fr => N_("France"), - gr => N_("Greece"), - hu => N_("Hungary"), - id => N_("Indonesia"), - il => N_("Israel"), - it => N_("Italy"), - jp => N_("Japan"), - ko => N_("Korea"), - nl => N_("Netherlands"), - no => N_("Norway"), - pl => N_("Poland"), - pt => N_("Portugal"), - ru => N_("Russia"), - se => N_("Sweden"), - sg => N_("Singapore"), - sk => N_("Slovakia"), - za => N_("South Africa"), - tw => N_("Taiwan"), - th => N_("Thailand"), - tr => N_("Turkey"), - uk => N_("United Kingdom"), - cn => N_("China"), - us => N_("United States"), - com => N_("United States"), - org => N_("United States"), - net => N_("United States"), - edu => N_("United States"), + ar => $loc->N_("Argentina"), + at => $loc->N_("Austria"), + au => $loc->N_("Australia"), + by => $loc->N_("Belarus"), + be => $loc->N_("Belgium"), + br => $loc->N_("Brazil"), + gb => $loc->N_("Britain"), + ca => $loc->N_("Canada"), + ch => $loc->N_("Switzerland"), + cr => $loc->N_("Costa Rica"), + cz => $loc->N_("Czech Republic"), + de => $loc->N_("Germany"), + dk => $loc->N_("Danmark"), + ec => $loc->N_("Ecuador"), + el => $loc->N_("Greece"), + es => $loc->N_("Spain"), + fi => $loc->N_("Finland"), + fr => $loc->N_("France"), + gr => $loc->N_("Greece"), + hu => $loc->N_("Hungary"), + id => $loc->N_("Indonesia"), + il => $loc->N_("Israel"), + it => $loc->N_("Italy"), + jp => $loc->N_("Japan"), + ko => $loc->N_("Korea"), + nl => $loc->N_("Netherlands"), + no => $loc->N_("Norway"), + pl => $loc->N_("Poland"), + pt => $loc->N_("Portugal"), + ru => $loc->N_("Russia"), + se => $loc->N_("Sweden"), + sg => $loc->N_("Singapore"), + sk => $loc->N_("Slovakia"), + za => $loc->N_("South Africa"), + tw => $loc->N_("Taiwan"), + th => $loc->N_("Thailand"), + tr => $loc->N_("Turkey"), + uk => $loc->N_("United Kingdom"), + cn => $loc->N_("China"), + us => $loc->N_("United States"), + com => $loc->N_("United States"), + org => $loc->N_("United States"), + net => $loc->N_("United States"), + edu => $loc->N_("United States"), ); my $us = [ qw(us com org net edu) ]; my %t2l = ( @@ -587,9 +600,9 @@ sub add_medium_and_check { } if (@error_msgs) { interactive_msg( - N("Error"), - N("Unable to add medium, errors reported:\n\n%s", - join("\n", map { MDK::Common::String::formatAlaTeX($_) } @error_msgs)) . "\n\n" . N("Medium: ") . "$_[0] ($_[1])", + $loc->N("Error"), + $loc->N("Unable to add medium, errors reported:\n\n%s", + join("\n", map { MDK::Common::String::formatAlaTeX($_) } @error_msgs)) . "\n\n" . $loc->N("Medium: ") . "$_[0] ($_[1])", scroll => 1, ); return 0; @@ -599,7 +612,7 @@ sub add_medium_and_check { urpm::download::set_proxy_config($_, $options->{proxy}{$_}, $name) foreach keys %{$options->{proxy} || {}}; } - if (update_sources_check($urpm, $options, N_("Unable to add medium, errors reported:\n\n%s"), @newnames)) { + if (update_sources_check($urpm, $options, $loc->N_("Unable to add medium, errors reported:\n\n%s"), @newnames)) { urpm::media::write_config($urpm); $options->{proxy} and urpm::download::dump_proxy_config(); } else { @@ -611,13 +624,13 @@ sub add_medium_and_check { if (any { exists $newnames{$_->{name}} } @{$urpm->{media}}) { return 1; } else { - interactive_msg(N("Error"), N("Unable to create medium.")); + interactive_msg($loc->N("Error"), $loc->N("Unable to create medium.")); return 0; } fatal_error: - interactive_msg(N("Failure when adding medium"), - N("There was a problem adding medium:\n\n%s", $fatal_msg)); + interactive_msg($loc->N("Failure when adding medium"), + $loc->N("There was a problem adding medium:\n\n%s", $fatal_msg)); return 0; } @@ -629,7 +642,7 @@ sub update_sources_check { update_sources($urpm, %$options, noclean => 1, medialist => \@media); fatal_error: if (@error_msgs) { - interactive_msg(N("Error"), translate($error_msg, join("\n", map { formatAlaTeX($_) } @error_msgs)), scroll => 1); + interactive_msg($loc->N("Error"), translate($error_msg, join("\n", map { formatAlaTeX($_) } @error_msgs)), scroll => 1); return 0; } return 1; @@ -643,13 +656,13 @@ sub update_sources { my $factory = yui::YUI::widgetFactory; ## set new title to get it in dialog - yui::YUI::app()->setApplicationTitle(N("rpmdragora")); + yui::YUI::app()->setApplicationTitle($loc->N("rpmdragora")); my $dlg = $factory->createPopupDialog(); my $minSize = $factory->createMinSize( $dlg, 80, 5 ); my $vbox = $factory->createVBox($minSize); my $hbox = $factory->createHBox($factory->createLeft($vbox)); - my $label = $factory->createRichText($hbox, N("Please wait, updating media..."), 1 ); + my $label = $factory->createRichText($hbox, $loc->N("Please wait, updating media..."), 1 ); $label->setWeight($yui::YD_HORIZ, 1); $label->setWeight($yui::YD_VERT, 1); @@ -672,8 +685,8 @@ sub update_sources { my ($type, $media) = @_; goto cancel_update if $type !~ /^(?:start|progress|end)$/ && @media && !member($media, @media); if ($type eq 'failed') { - $urpm->{fatal}->(N("Error retrieving packages"), -N("It's impossible to retrieve the list of new packages from the media + $urpm->{fatal}->($loc->N("Error retrieving packages"), +$loc->N("It's impossible to retrieve the list of new packages from the media `%s'. Either this update media is misconfigured, and in this case you should use the Software Media Manager to remove it and re-add it in order to reconfigure it, either it is currently unreachable and you should retry @@ -701,37 +714,37 @@ sub show_urpm_progress { if ($mode eq 'copy') { $pb->setValue(0); - $label->setValue(N("Copying file for medium `%s'...", $file)); + $label->setValue($loc->N("Copying file for medium `%s'...", $file)); } elsif ($mode eq 'parse') { $pb->setValue(0); - $label->setValue(N("Examining file of medium `%s'...", $file)); + $label->setValue($loc->N("Examining file of medium `%s'...", $file)); } elsif ($mode eq 'retrieve') { $pb->setValue(0); - $label->setValue(N("Examining remote file of medium `%s'...", $file)); + $label->setValue($loc->N("Examining remote file of medium `%s'...", $file)); $medium = $file; } elsif ($mode eq 'done') { $pb->setValue(100); - $label->setValue($label->value() . N(" done.")); + $label->setValue($label->value() . $loc->N(" done.")); $medium = undef; } elsif ($mode eq 'failed') { $pb->setValue(100); - $label->setValue($label->value() . N(" failed!")); + $label->setValue($label->value() . $loc->N(" failed!")); $medium = undef; } else { # FIXME: we're displaying misplaced quotes such as "downloading `foobar from 'medium Main Updates'´" $file = $medium && length($file) < 40 ? #-PO: We're downloading the said file from the said medium - N("%s from medium %s", basename($file), $medium) + $loc->N("%s from medium %s", basename($file), $medium) : basename($file); if ($mode eq 'start') { $pb->setValue(0); - $label->setValue(N("Starting download of `%s'...", $file)); + $label->setValue($loc->N("Starting download of `%s'...", $file)); } elsif ($mode eq 'progress') { if (defined $total && defined $eta) { $pb->setValue($percent); - $label->setValue(N("Download of `%s'\ntime to go:%s, speed:%s", $file, $eta, $speed)); + $label->setValue($loc->N("Download of `%s'\ntime to go:%s, speed:%s", $file, $eta, $speed)); } else { $pb->setValue($percent); - $label->setValue(N("Download of `%s'\nspeed:%s", $file, $speed)); + $label->setValue($loc->N("Download of `%s'\nspeed:%s", $file, $speed)); } } } @@ -743,14 +756,14 @@ sub update_sources_interactive { my @media = grep { ! $_->{ignore} } @{$urpm->{media}}; unless (@media) { - interactive_msg(N("Warning"), N("No active medium found. You must enable some media to be able to update them.")); + interactive_msg($loc->N("Warning"), $loc->N("No active medium found. You must enable some media to be able to update them.")); return 0; } my $appTitle = yui::YUI::app()->applicationTitle(); ## set new title to get it in dialog - yui::YUI::app()->setApplicationTitle(N("Update media")); + yui::YUI::app()->setApplicationTitle($loc->N("Update media")); my $retVal = 0; my $mageiaPlugin = "mga"; @@ -764,7 +777,7 @@ sub update_sources_interactive { my $yTableHeader = new yui::YTableHeader(); $yTableHeader->addColumn("", $yui::YAlignBegin); - $yTableHeader->addColumn(N("Media"), $yui::YAlignBegin); + $yTableHeader->addColumn($loc->N("Media"), $yui::YAlignBegin); my $mediaTable = $mgaFactory->createCBTable($vbox, $yTableHeader, $yui::YCBTableCheckBoxOnFirstColumn); @@ -782,9 +795,9 @@ sub update_sources_interactive { ## Window push buttons my $hbox = $factory->createHBox( $vbox ); - my $cancelButton = $factory->createPushButton($hbox, N("Cancel") ); - my $selectButton = $factory->createPushButton($hbox, N("Select all") ); - my $updateButton = $factory->createPushButton($hbox, N("Update") ); + my $cancelButton = $factory->createPushButton($hbox, $loc->N("Cancel") ); + my $selectButton = $factory->createPushButton($hbox, $loc->N("Select all") ); + my $updateButton = $factory->createPushButton($hbox, $loc->N("Update") ); while(1) { my $event = $dialog->waitForEvent(); @@ -863,7 +876,7 @@ sub update_sources_noninteractive { update_sources_check( $urpm, {}, - N_("Unable to update medium; it will be automatically disabled.\n\nErrors:\n%s"), + $loc->N_("Unable to update medium; it will be automatically disabled.\n\nErrors:\n%s"), @$media, ); return 1; @@ -888,15 +901,15 @@ sub warn_for_network_need { my ($message, %options) = @_; $message ||= $branded - ? N("I need to access internet to get the mirror list. + ? $loc->N("I need to access internet to get the mirror list. Please check that your network is currently running. Is it ok to continue?") - : N("I need to contact the Mageia website to get the mirror list. + : $loc->N("I need to contact the Mageia website to get the mirror list. Please check that your network is currently running. Is it ok to continue?"); - interactive_msg(N("Mirror choice"), $message, yesno => 1, %options) or return ''; + interactive_msg($loc->N("Mirror choice"), $message, yesno => 1, %options) or return ''; } sub choose_mirror { @@ -908,22 +921,22 @@ sub choose_mirror { my $error = $@; if ($error) { $error = "\n$error\n"; - interactive_msg(N("Error during download"), + interactive_msg($loc->N("Error during download"), ($branded - ? N("There was an error downloading the mirror list:\n%s\n + ? $loc->N("There was an error downloading the mirror list:\n%s\n The network, or the website, may be unavailable. Please try again later.", $error) - : N("There was an error downloading the mirror list:\n%s\n + : $loc->N("There was an error downloading the mirror list:\n%s\n The network, or the Mageia website, may be unavailable. Please try again later.", $error)), %options ); return ''; } - !@mirrors and interactive_msg(N("No mirror"), + !@mirrors and interactive_msg($loc->N("No mirror"), ($branded - ? N("I can't find any suitable mirror.") - : N("I can't find any suitable mirror.\n + ? $loc->N("I can't find any suitable mirror.") + : $loc->N("I can't find any suitable mirror.\n There can be many reasons for this problem; the most frequent is the case when the architecture of your processor is not supported by Mageia Official Updates.")), %options @@ -932,8 +945,8 @@ by Mageia Official Updates.")), %options my @mirrorlist = map {$_->{country} . "|" . $_->{url}} @mirrors; my $sh_gui = AdminPanel::Shared::GUI->new(); - my $mirror = $sh_gui->ask_fromTreeList({title => N("Mirror choice"), - header => N("Please choose the desired mirror."), + my $mirror = $sh_gui->ask_fromTreeList({title => $loc->N("Mirror choice"), + header => $loc->N("Please choose the desired mirror."), default_button => 1, item_separator => "|", default_item => $mirrors[0]->{url}, @@ -958,12 +971,12 @@ sub check_update_media_version { foreach (@_) { if ($_->{name} =~ /(\d+\.\d+).*\bftp\du\b/ && $1 ne $distro_version) { interactive_msg( - N("Warning"), + $loc->N("Warning"), $branded - ? N("Your medium `%s', used for updates, does not match the version of %s you're running (%s). + ? $loc->N("Your medium `%s', used for updates, does not match the version of %s you're running (%s). It will be disabled.", $_->{name}, $distrib{system}, $distrib{product}) - : N("Your medium `%s', used for updates, does not match the version of Mageia you're running (%s). + : $loc->N("Your medium `%s', used for updates, does not match the version of Mageia you're running (%s). It will be disabled.", $_->{name}, $distro_version) ); @@ -993,8 +1006,8 @@ sub mirrors { # display a message in statusbar (if availlable): $::statusbar and $id = statusbar_msg( $branded - ? N("Please wait, downloading mirror addresses.") - : N("Please wait, downloading mirror addresses from the Mageia website."), + ? $loc->N("Please wait, downloading mirror addresses.") + : $loc->N("Please wait, downloading mirror addresses from the Mageia website."), 0); my $_clean_guard = before_leaving { undef $gurpm; @@ -1008,14 +1021,14 @@ sub mirrors { dir => $cachedir, callback => sub { $gurpm ||= - AdminPanel::Rpmdragora::gurpm->new(N("Please wait"), + AdminPanel::Rpmdragora::gurpm->new($loc->N("Please wait"), transient => $::main_window); $canceled ||= !AdminPanel::Rpmdragora::pkg::download_callback($gurpm, @_); $gurpm->flush(); }, ); - $res or die N("retrieval of [%s] failed", $file) . "\n"; + $res or die $loc->N("retrieval of [%s] failed", $file) . "\n"; return $canceled ? () : MDK::Common::File::cat_($file); }); my @mirrors = @{ mirror::list(common::parse_LDAP_namespace_structure(MDK::Common::File::cat_('/etc/product.id')), 'distrib') || [] }; @@ -1051,8 +1064,8 @@ sub open_help { my ($mode) = @_; use run_program; run_program::raw({ detach => 1, as_user => 1 }, 'drakhelp', '--id', $mode ? "software-management-$mode" : 'software-management'); - my $_s = N("Help launched in background"); - statusbar_msg(N("The help window has been started, it should appear shortly on your desktop."), 1); + my $_s = $loc->N("Help launched in background"); + statusbar_msg($loc->N("The help window has been started, it should appear shortly on your desktop."), 1); } sub run_drakbug { diff --git a/modules/rpmdragora/dragora-urpm-addmedia b/modules/rpmdragora/dragora-urpm-addmedia index 3aafbf2..b49840f 100755 --- a/modules/rpmdragora/dragora-urpm-addmedia +++ b/modules/rpmdragora/dragora-urpm-addmedia @@ -1,23 +1,23 @@ #!/usr/bin/perl #***************************************************************************** -# +# # Copyright (c) 2004 Guillaume Cottenceau (gc at mandrakesoft dot com) # Copyright (c) 2006-2007 Thierry Vignaud <tvignaud@mandriva.com> # Copyright (c) 2004-2007 Mandriva SA -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2, as # published by the Free Software Foundation. -# +# # This program 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 program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# +# #***************************************************************************** # # $Id: gurpmi.addmedia 261187 2009-10-01 14:44:34Z tv $ @@ -45,15 +45,18 @@ and [options] are from }; } use AdminPanel::Rpmdragora::init; +use AdminPanel::rpmdragora; use AdminPanel::Rpmdragora::open_db; use AdminPanel::Rpmdragora::formatting; - +use AdminPanel::Shared::Locales; use AdminPanel::Privileges; use lib qw(/usr/lib/libDrakX); use urpm::media; use MDK::Common::Func; -use common qw(N); + +my $loc = AdminPanel::rpmdragora::locale(); + # if (AdminPanel::Privileges::is_root_capability_required()) { @@ -61,7 +64,7 @@ if (AdminPanel::Privileges::is_root_capability_required()) { my $sh_gui = AdminPanel::Shared::GUI->new(); $sh_gui->warningMsgBox({ title => "gurpmi.addmedia", - text => N("root privileges required"), + text => $loc->N("root privileges required"), }); exit (-1); } @@ -110,7 +113,7 @@ while (@ARGV) { } elsif ($url !~ m,^(([^:]*):/)?/,) { AdminPanel::rpmdragora::interactive_msg('gurpmi.addmedia', AdminPanel::Rpmdragora::formatting::escape_text_for_TextView_markup_format( - N("bad <url> (for local directory, the path must be absolute)") . "\n\n$url")); + $loc->N("bad <url> (for local directory, the path must be absolute)") . "\n\n$url")); AdminPanel::rpmdragora::myexit(-1); } push @addmedia_args, [ $name, $url ]; @@ -124,18 +127,18 @@ if ($mirrorlist && $distrib && !@addmedia_args) { $fromfile and do { AdminPanel::rpmdragora::interactive_msg('gurpmi.addmedia', -N("%s +$loc->N("%s Is it ok to continue?", $distrib || !@names -? N("You are about to add new package media. +? $loc->N("You are about to add new package media. That means you will be able to add new software packages to your system from these new media.") : 1 < @names -? N("You are about to add new package medium, %s. +? $loc->N("You are about to add new package medium, %s. That means you will be able to add new software packages to your system from these new media.", join ", ", @names) -: N("You are about to add a new package medium, `%s'. +: $loc->N("You are about to add a new package medium, `%s'. That means you will be able to add new software packages to your system from that new medium.", $names[0]) ), @@ -159,10 +162,10 @@ foreach (@addmedia_args) { } if ($success) { my $message = - $distrib ? N("Successfully added media.") + $distrib ? $loc->N("Successfully added media.") : @names > 1 - ? N("Successfully added media %s.", join ", ", @names) - : N("Successfully added medium `%s'.", $names[0]); + ? $loc->N("Successfully added media %s.", join ", ", @names) + : $loc->N("Successfully added medium `%s'.", $names[0]); AdminPanel::rpmdragora::interactive_msg('gurpmi.addmedia', $message) if !$silent_success; AdminPanel::rpmdragora::myexit(0); } else { diff --git a/modules/rpmdragora/dragora-urpm-sources.pl b/modules/rpmdragora/dragora-urpm-sources.pl index 64a15e8..1bd4d62 100755 --- a/modules/rpmdragora/dragora-urpm-sources.pl +++ b/modules/rpmdragora/dragora-urpm-sources.pl @@ -1,23 +1,23 @@ #!/usr/bin/perl #***************************************************************************** -# +# # Copyright (c) 2002 Guillaume Cottenceau # Copyright (c) 2002-2007 Thierry Vignaud <tvignaud@mandriva.com> # Copyright (c) 2002-2007 Mandriva Linux -# +# # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2, as # published by the Free Software Foundation. -# +# # This program 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 program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# +# #***************************************************************************** # # $Id: edit-urpm-sources.pl 244763 2008-09-04 16:12:52Z tv $ @@ -29,7 +29,7 @@ use AdminPanel::Rpmdragora::edit_urpm_sources; use AdminPanel::Privileges; use AdminPanel::Shared::Locales; -my $loc = AdminPanel::Shared::Locales->new(domain_name => 'rpmdrake'); +my $loc = AdminPanel::rpmdragora::locale(); if (AdminPanel::Privileges::is_root_capability_required()) { require AdminPanel::Shared::GUI; diff --git a/modules/rpmdragora/dragoraUpdate b/modules/rpmdragora/dragoraUpdate index 34db3a0..1c06f9d 100755 --- a/modules/rpmdragora/dragoraUpdate +++ b/modules/rpmdragora/dragoraUpdate @@ -31,8 +31,8 @@ use MDK::Common::Func 'any'; use AdminPanel::Rpmdragora::init; -# use standalone; #- standalone must be loaded very first, for 'explanations', but after rpmdragora::init -# use rpmdrake; + +use AdminPanel::rpmdragora; use AdminPanel::Rpmdragora::gui; use AdminPanel::Rpmdragora::rpmnew; use AdminPanel::Rpmdragora::formatting; @@ -41,9 +41,6 @@ use AdminPanel::Shared::Locales; use yui; -my $loc = AdminPanel::Shared::Locales->new(domain_name => 'rpmdrake'); - - #use mygtk2 qw(gtknew); #- do not import anything else, especially gtkadd() which conflicts with ugtk2 one #use ugtk2 qw(:all); # use Gtk2::SimpleList; @@ -66,6 +63,7 @@ my $loc = AdminPanel::Shared::Locales->new(domain_name => 'rpmdrake'); our $w; # TODO try to see if we can Moosify all! our $statusbar; +my $loc = AdminPanel::rpmdragora::locale(); warn_about_user_mode(); @@ -116,7 +114,7 @@ sub _refresh_packages_list { my $medium = !$raw_medium->{fake} ? $raw_medium->{name} : undef; my $icon = ""; - my $item = new yui::YCBTableItem("", $name . "\n" . $summary, $version, $release, $arch); + my $item = new yui::YCBTableItem("", $name , $summary, $version, $release, $arch); my $importance = $medium && $descriptions->{$medium}{$name}{importance}; if ($importance) { @@ -211,6 +209,7 @@ sub run_treeview_dialog { # icon $yTableHeader->addColumn("", $yui::YAlignCenter); $yTableHeader->addColumn($loc->N("Name"), $yui::YAlignBegin); + $yTableHeader->addColumn($loc->N("Summary"), $yui::YAlignBegin); $yTableHeader->addColumn($loc->N("Version"), $yui::YAlignCenter); $yTableHeader->addColumn($loc->N("Release"), $yui::YAlignBegin); $yTableHeader->addColumn($loc->N("Arch"), $yui::YAlignBegin); diff --git a/modules/rpmdragora/rpmdragora b/modules/rpmdragora/rpmdragora index 22ef910..ccb53f4 100755 --- a/modules/rpmdragora/rpmdragora +++ b/modules/rpmdragora/rpmdragora @@ -39,6 +39,7 @@ use AdminPanel::Rpmdragora::init; use standalone; #- standalone must be loaded very first, for 'explanations', but after rpmdragora::init use AdminPanel::rpmdragora; use AdminPanel::Shared; +use AdminPanel::Shared::Locales; use AdminPanel::Rpmdragora::open_db; use AdminPanel::Rpmdragora::gui; use AdminPanel::Rpmdragora::rpmnew; @@ -68,6 +69,7 @@ my @itemsToBeInstalled; our $w; our $statusbar; +my $loc = AdminPanel::rpmdragora::locale(); my %elems; @@ -186,7 +188,7 @@ sub detaillist_changeditem_callback { } if ($found == 0) { push(@itemsToBeRemoved, $changedItem); - # $pkgs->{$options->{table_item_list}[$changedItem->index()]}{selected} = 0; + # $pkgs->{$options->{table_item_list}[$changedItem->index()]}{selected} = 0; # toggle_veloce($options->{table_item_list}[$changedItem->index()],"to_remove"); fast_toggle($changedItem); } @@ -198,7 +200,7 @@ sub detaillist_changeditem_callback { sub detaillist_callback { my ($selection, $info, $options) = @_; $info->setValue(""); - $info->setValue("<h2>".N("Informations")."</h2>"); + $info->setValue("<h2>" . $loc->N("Informations") . "</h2>"); return if( ref $selection ne "yui::YItem"); my @data = get_info($options->{table_item_list}[$selection->index()],$info->parent()->parent()); for(@{$data[0]}){ @@ -255,23 +257,23 @@ sub do_search($$$$$$$) { } } else { my $searchstop; - #my $searchw = ugtk2->new(N("Software Management"), grab => 1, transient => $w->{real_window}); + #my $searchw = ugtk2->new($loc->N("Software Management"), grab => 1, transient => $w->{real_window}); my $searchw = $factory->createPopupDialog; my $vbox = $factory->createVBox($searchw); - my $lblWIP = $factory->createLabel($vbox, N("Please wait, searching...")); + my $lblWIP = $factory->createLabel($vbox, $loc->N("Please wait, searching...")); my $searchprogress = $factory->createProgressBar($vbox, 'ProgressBar'); - my $stop_button = $factory->createIconButton($vbox,"",N("Stop")); - + my $stop_button = $factory->createIconButton($vbox,"",$loc->N("Stop")); + #gtkadd( #$searchw->{window}, #gtkpack__( #gtknew('VBox', spacing => 5), - #gtknew('Label', text => N("Please wait, searching...")), + #gtknew('Label', text => $loc->N("Please wait, searching...")), #my $searchprogress = gtknew('ProgressBar', width => 300), #gtkpack__( #gtknew('HButtonBox', layout => 'spread'), #gtksignal_connect( - #Gtk2::Button->new(but(N("Stop"))), + #Gtk2::Button->new(but($loc->N("Stop"))), #clicked => sub { $searchstop = 1 }, #), #), @@ -296,19 +298,19 @@ sub do_search($$$$$$$) { $searchstop and last; my $gurpm; # per medium download progress bar (if needed) my $_gurpm_clean_guard = before_leaving { undef $gurpm }; - my $xml_info_file = + my $xml_info_file = urpm::media::any_xml_info($urpm, $medium, ($current_search_type eq 'files' ? 'files' : 'info'), - undef, + undef, sub { - $gurpm ||= AdminPanel::Rpmdragora::gurpm->new(N("Please wait"), + $gurpm ||= AdminPanel::Rpmdragora::gurpm->new($loc->N("Please wait"), transient => $::main_window); download_callback($gurpm, @_) or do { $searchstop = 1; }; }); if (!$xml_info_file) { - $urpm->{error}(N("no xml-info available for medium \"%s\"", $medium->{name})); + $urpm->{error}($loc->N("no xml-info available for medium \"%s\"", $medium->{name})); next; } $searchstop and last; @@ -324,10 +326,10 @@ sub do_search($$$$$$$) { local $_; while (<$F>) { if ($searchstop) { - statusbar_msg(N("Search aborted"), 1); + statusbar_msg($loc->N("Search aborted"), 1); goto end_search; } - if (m!^<!) { + if (m!^<!) { ($fn) = /fn="(.*)"/; $update_search_pb->(); } elsif (/$entry_rx/) { @@ -352,7 +354,7 @@ sub do_search($$$$$$$) { }; my $err = $@; if ($err =~ /search aborted/) { - statusbar_msg(N("Search aborted"), 1); + statusbar_msg($loc->N("Search aborted"), 1); } } } @@ -369,18 +371,18 @@ sub do_search($$$$$$$) { $elems{$results_ok} = [ map { [ $_, $results_ok ] } @search_results ]; $iter = $options->{add_parent}->($tree, $results_ok); $options->{add_nodes}->(map { [ $_, $results_ok . ($options->{tree_mode} eq 'by_presence' - ? '|' . ($pkgs->{$_}{pkg}->flag_installed ? N("Upgradable") : N("Addable")) + ? '|' . ($pkgs->{$_}{pkg}->flag_installed ? $loc->N("Upgradable") : $loc->N("Addable")) : ($options->{tree_mode} eq 'by_selection' - ? '|' . ($pkgs->{$_}{selected} ? N("Selected") : N("Not selected")) + ? '|' . ($pkgs->{$_}{selected} ? $loc->N("Selected") : $loc->N("Not selected")) : '')) ] } @search_results); } else { $iter = $options->{add_parent}->($tree, $results_none); # clear package list: $options->{add_nodes}->(); - my $string = $default_list_mode eq 'all' && $filter->[0] eq 'all' ? N("No search results.") : - N("No search results. You may want to switch to the '%s' view and to the '%s' filter", - N("All"), N("All"),); + my $string = $default_list_mode eq 'all' && $filter->[0] eq 'all' ? $loc->N("No search results.") : + $loc->N("No search results. You may want to switch to the '%s' view and to the '%s' filter", + $loc->N("All"), $loc->N("All"),); statusbar_msg($string , 1); #gtkset_mousecursor_normal($::w->{rwindow}->window); } @@ -418,7 +420,7 @@ sub run_treeview_dialog { @$unsel < @$sel; }, get_status => sub { - N("Selected: %s / Free disk space: %s", formatXiB($size_selected), formatXiB($size_free*1024)); + $loc->N("Selected: %s / Free disk space: %s", formatXiB($size_selected), formatXiB($size_free*1024)); }, rebuild_tree => sub { $tree->rebuildTree(); }, }; @@ -430,14 +432,14 @@ sub run_treeview_dialog { my $head_align_right = $factory->createRight($hbox_headbar); my $headbar = $factory->createHBox($head_align_left); my $headRight = $factory->createHBox($head_align_right); - + #Line for logo and title my $hbox_iconbar = $factory->createHBox($vbox); $head_align_left = $factory->createLeft($hbox_iconbar); $hbox_iconbar = $factory->createHBox($head_align_left); $factory->createImage($hbox_iconbar, $wm_icon); - - $factory->createHeading($hbox_iconbar, $::MODE eq 'update' ? N("Software Packages Update") : N("Software Management")); + + $factory->createHeading($hbox_iconbar, $::MODE eq 'update' ? $loc->N("Software Packages Update") : $loc->N("Software Management")); my $hbox_top = $factory->createHBox($vbox); my $hbox_middle = $factory->createHBox($vbox); @@ -469,7 +471,7 @@ sub run_treeview_dialog { # "Glib::String", # "Glib::String", # "Glib::String", - # "Glib::String", + # "Glib::String", # "Glib::Boolean"); #OLD $detail_list = Gtk2::TreeView->new_with_model($detail_list_model); my $detail_list_header = new yui::YTableHeader(); @@ -489,25 +491,25 @@ sub run_treeview_dialog { my %columns = ( 'name' => { - title => N("Package"), + title => $loc->N("Package"), markup => $pkg_columns{short_name}, }, 'version' => { - title => N("Version"), + title => $loc->N("Version"), text => $pkg_columns{version}, }, 'release' => { - title => N("Release"), + title => $loc->N("Release"), text => $pkg_columns{release}, }, if_($display_arch_col, 'arch' => { title => #-PO: "Architecture" but to be kept *small* !!! - N("Arch."), + $loc->N("Arch."), text => $pkg_columns{arch}, }), 'mark' => { - title => N("ToInst"), + title => $loc->N("ToInst"), } ); ## check column is first no title needed here, but we need to add it @@ -529,7 +531,7 @@ sub run_treeview_dialog { #OLD $columns{name}{widget}->set_property('expand', '1'); #OLD $columns{name}{renderer}->set_property('ellipsize', 'end'); #OLD $columns{$_}{renderer}->set_property('xpad', '6') foreach @columns; - #OLD $columns{name}{widget}->set_resizable(1); + #OLD $columns{name}{widget}->set_resizable(1); #OLD $detail_list_model->set_sort_column_id($pkg_columns{text}, 'ascending'); #OLD $detail_list_model->set_sort_func($pkg_columns{version}, \&sort_callback); #OLD $detail_list->set_rules_hint(1); @@ -538,13 +540,13 @@ sub run_treeview_dialog { # my $pixcolumn = # Gtk2::TreeViewColumn->new_with_attributes( # #-PO: "Status" should be kept *small* !!! - # N("Status"), + # $loc->N("Status"), # my $rdr = Gtk2::CellRendererPixbuf->new, # 'pixbuf' => $pkg_columns{state_icon}) # ); #$rdr->set_fixed_size(34, 24); #$pixcolumn->set_sort_column_id($pkg_columns{state}); - $detail_list_header->addColumn(N("Status")); + $detail_list_header->addColumn($loc->N("Status")); # it should be istanciated this way $detail_list = $mgaFactory->createCBTable($hbox_middle,$detail_list_header,$yui::YCBTableCheckBoxOnFirstColumn); @@ -560,7 +562,7 @@ sub run_treeview_dialog { gtkset_mousecursor_normal($tree->window); undef $cursor_to_restore; },) foreach $tree, $detail_list; - + $tree->currentItem(changed => sub { my ($model, $iter) = $_[0]->get_selected; return if !$iter; @@ -586,9 +588,9 @@ sub run_treeview_dialog { my $is_backports = get_inactive_backport_media(fast_open_urpmi_db()); - my %filters = (all => N("All"), - installed => N("Installed"), - non_installed => N("Not installed"), + my %filters = (all => $loc->N("All"), + installed => $loc->N("Installed"), + non_installed => $loc->N("Not installed"), ); my %rfilters = reverse %filters; @@ -603,27 +605,27 @@ sub run_treeview_dialog { $options->{tree_mode} = $default_list_mode; my %modes = ( - flat => N("All packages, alphabetical"), - by_group => N("All packages, by group"), - by_leaves => N("Leaves only, sorted by install date"), - by_presence => N("All packages, by update availability"), - by_selection => N("All packages, by selection state"), - by_size => N("All packages, by size"), - by_source => N("All packages, by medium repository"), + flat => $loc->N("All packages, alphabetical"), + by_group => $loc->N("All packages, by group"), + by_leaves => $loc->N("Leaves only, sorted by install date"), + by_presence => $loc->N("All packages, by update availability"), + by_selection => $loc->N("All packages, by selection state"), + by_size => $loc->N("All packages, by size"), + by_source => $loc->N("All packages, by medium repository"), ); - my %views = (all => N("All"), + my %views = (all => $loc->N("All"), if_($is_backports, backports => #-PO: Backports media are newer but less-tested versions of some packages in main #-PO: See http://wiki.mandriva.com/en/Policies/SoftwareMedia#.2Fmain.2Fbackports - N("Backports")), - meta_pkgs => N("Meta packages"), - gui_pkgs => N("Packages with GUI"), - all_updates => N("All updates"), - security => N("Security updates"), - bugfix => N("Bugfixes updates"), - normal => N("General updates") + $loc->N("Backports")), + meta_pkgs => $loc->N("Meta packages"), + gui_pkgs => $loc->N("Packages with GUI"), + all_updates => $loc->N("All updates"), + security => $loc->N("Security updates"), + bugfix => $loc->N("Bugfixes updates"), + normal => $loc->N("General updates") ); my %rviews = reverse %views; $options->{rviews} = \%rviews; @@ -659,7 +661,7 @@ sub run_treeview_dialog { 'ComboBox', list => [ qw(all installed non_installed) ], text => $filters{$filter->[0]}, format => sub { $filters{$_[0]} }, - tip => N("Filter"), + tip => $loc->N("Filter"), changed => sub { state $oldval; my $val = $_[0]->get_text; @@ -702,7 +704,7 @@ sub run_treeview_dialog { my $search_menu = $factory->createComboBox($hbox_top,""); my $i = 0; my $previous; - foreach (N("in names"), N("in descriptions"), N("in summaries"), N("in file names")) { + foreach ($loc->N("in names"), $loc->N("in descriptions"), $loc->N("in summaries"), $loc->N("in file names")) { my ($name, $val) = ($_, $i); #OLD $search_menu->append(gtksignal_connect(gtkshow( # $previous = Gtk2::RadioMenuItem->new_with_label($previous, $name)), @@ -712,9 +714,9 @@ sub run_treeview_dialog { } $find_entry = $factory->createInputField($hbox_top, ""); - my $find_button = $factory->createIconButton($hbox_top, "/usr/share/mcc/themes/default/logdrake-mdk.png", N("Search")); + my $find_button = $factory->createIconButton($hbox_top, "/usr/share/mcc/themes/default/logdrake-mdk.png", $loc->N("Search")); $find_button->setWeight(0,6); - my $reset_search_button = $factory->createIconButton($hbox_top, "/usr/share/icons/gnome/22x22/actions/gtk-clear.png", N("Reset")); + my $reset_search_button = $factory->createIconButton($hbox_top, "/usr/share/icons/gnome/22x22/actions/gtk-clear.png", $loc->N("Reset")); $reset_search_button->setWeight(0,7); $find_entry->setWeight(0,10); @@ -731,15 +733,15 @@ sub run_treeview_dialog { do_search($find_entry, $tree, $tree_model, $options, $current_search_type, $urpm, $pkgs); }; - my $select_all_button = $factory->createIconButton($hbox_footbar,"",N("Select all")); + my $select_all_button = $factory->createIconButton($hbox_footbar,"",$loc->N("Select all")); $select_all_button->setWeight(0,6); - my $apply_button = $factory->createIconButton($hbox_footbar,"",N("Apply")); + my $apply_button = $factory->createIconButton($hbox_footbar,"",$loc->N("Apply")); $apply_button->setWeight(0,6); - my $QuitButton = $factory->createIconButton($hbox_footbar,"",N("Exit")); + my $QuitButton = $factory->createIconButton($hbox_footbar,"",$loc->N("Exit")); $QuitButton->setWeight(0,6); - + #my $hpaned = gtknew('HPaned', position => $typical_width*0.9, # child1 => gtknew('ScrolledWindow', child => $tree), @@ -767,21 +769,21 @@ sub run_treeview_dialog { my $checkbox_show_autoselect; my %check_boxes; my $auto_select_string = - N("/_Options") . N("/_Select dependencies without asking"); - my $clean_cache_string = - N("/_Options") . "/" . - N("Clear download cache after successful install"); - my $updates_string = N("/_Options") . N("/_Compute updates on startup"); - my $NVR_string = N("/_Options") . "/" . N("Search in _full package names"); - my $regexp_search_string = N("/_Options") . "/" . N("Use _regular expressions in searches"); - + $loc->N("/_Options") . $loc->N("/_Select dependencies without asking"); + my $clean_cache_string = + $loc->N("/_Options") . "/" . + $loc->N("Clear download cache after successful install"); + my $updates_string = $loc->N("/_Options") . $loc->N("/_Compute updates on startup"); + my $NVR_string = $loc->N("/_Options") . "/" . $loc->N("Search in _full package names"); + my $regexp_search_string = $loc->N("/_Options") . "/" . $loc->N("Use _regular expressions in searches"); + # build File menu my %fileMenu = ( - widget => $factory->createMenuButton($headbar,N("File")), - update => new yui::YMenuItem(N("Update media")), - reset_sel => new yui::YMenuItem(N("Reset the selection")), - reload => new yui::YMenuItem(N("Reload the packages list")), - quit => new yui::YMenuItem(N("&Quit")), + widget => $factory->createMenuButton($headbar,$loc->N("File")), + update => new yui::YMenuItem($loc->N("Update media")), + reset_sel => new yui::YMenuItem($loc->N("Reset the selection")), + reload => new yui::YMenuItem($loc->N("Reload the packages list")), + quit => new yui::YMenuItem($loc->N("&Quit")), ); my @ordered_menu_lines = qw(update reset_sel reload quit); @@ -791,10 +793,10 @@ sub run_treeview_dialog { $fileMenu{ widget }->rebuildMenuTree(); # build View menu - my $view_menu = $factory->createMenuButton($headbar,N("View")); - + my $view_menu = $factory->createMenuButton($headbar,$loc->N("View")); + # build Option menu - my $option_menu = $factory->createMenuButton($headbar,N("Options")); + my $option_menu = $factory->createMenuButton($headbar,$loc->N("Options")); my $a_s_string = $auto_select_string; my $c_c_string = $clean_cache_string; # stripping gtk-related stuff @@ -802,18 +804,18 @@ sub run_treeview_dialog { $c_c_string =~s/\/.+\/_//g; my $optMnuItemAutoSelect = new yui::YMenuItem($a_s_string); my $optMnuItemCleanCache = new yui::YMenuItem($c_c_string); - + $option_menu->addItem($optMnuItemAutoSelect); $option_menu->addItem($optMnuItemCleanCache); - + $option_menu->rebuildMenuTree(); - + # build help menu my %helpMenu = ( - widget => $factory->createMenuButton($headRight, N("&Help")), - help => new yui::YMenuItem(N("Manual")), - report_bug => new yui::YMenuItem(N("Report Bug")), - about => new yui::YMenuItem(N("&About")), + widget => $factory->createMenuButton($headRight, $loc->N("&Help")), + help => new yui::YMenuItem($loc->N("Manual")), + report_bug => new yui::YMenuItem($loc->N("Report Bug")), + about => new yui::YMenuItem($loc->N("&About")), ); @ordered_menu_lines = qw(help report_bug about); foreach (@ordered_menu_lines) { @@ -821,25 +823,25 @@ sub run_treeview_dialog { } $helpMenu{ widget }->rebuildMenuTree(); - + $statusbar = $factory->createBusyIndicator($hbox_footbar, "" ); =for comment my ($menu, $factory) = create_factory_menu( $w->{real_window}, - [ N("/_File"), undef, undef, undef, '<Branch>' ], + [ $loc->N("/_File"), undef, undef, undef, '<Branch>' ], if_( ! $>, - [ N("/_File") . N("/_Update media"), undef, sub { + [ $loc->N("/_File") . $loc->N("/_Update media"), undef, sub { update_sources_interactive($urpm, transient => $w->{real_window}) and $reload_db_and_clear_all->(); }, undef, '<Item>' ] ), - [ N("/_File") . N("/_Reset the selection"), undef, sub { + [ $loc->N("/_File") . $loc->N("/_Reset the selection"), undef, sub { if ($MODE ne 'remove') { my $db = eval { open_rpm_db() }; if (!ref($db)) { - statusbar_msg(N("Reset aborted (RPM DB is locked by another process)"), 1); + statusbar_msg($loc->N("Reset aborted (RPM DB is locked by another process)"), 1); return; } $urpm->disable_selected( @@ -855,12 +857,12 @@ sub run_treeview_dialog { $tree_selection->select_path(Gtk2::TreePath->new_from_string('0')) if !$tree_selection->get_selected; $tree_selection->signal_emit('changed'); }, undef, '<Item>' ], - [ N("/_File") . N("/Reload the _packages list"), undef, $reload_db_and_clear_all, undef, '<Item>' ], - [ N("/_File") . N("/_Quit"), N("<control>Q"), \&quit, undef, '<Item>', ], - #[ N("/_View"), undef, undef, undef, '<Branch>' ], + [ $loc->N("/_File") . $loc->N("/Reload the _packages list"), undef, $reload_db_and_clear_all, undef, '<Item>' ], + [ $loc->N("/_File") . $loc->N("/_Quit"), $loc->N("<control>Q"), \&quit, undef, '<Item>', ], + #[ $loc->N("/_View"), undef, undef, undef, '<Branch>' ], if_(!$>, - [ N("/_Options"), undef, undef, undef, '<Branch>' ], - [ $auto_select_string, undef, + [ $loc->N("/_Options"), undef, undef, undef, '<Branch>' ], + [ $auto_select_string, undef, sub { my $box = $check_boxes{$auto_select_string}; $auto_select->[0] = $box->get_active; @@ -868,18 +870,18 @@ sub run_treeview_dialog { $urpm->{options}{auto} = $box->get_active; }, undef, '<CheckItem>' ], - [ $clean_cache_string, undef, + [ $clean_cache_string, undef, sub { - $clean_cache->[0] = + $clean_cache->[0] = $check_boxes{$clean_cache_string}->get_active; $::noclean = !$clean_cache->[0]; - }, + }, undef, '<CheckItem>' ], - [ N("/_Options") . N("/_Media Manager"), undef, sub { + [ $loc->N("/_Options") . $loc->N("/_Media Manager"), undef, sub { require AdminPanel::Rpmdragora::edit_urpm_sources; AdminPanel::Rpmdragora::edit_urpm_sources::run() && $reload_db_and_clear_all->(); }, undef, '<Item>' ], - [ N("/_Options") . N("/_Show automatically selected packages"), undef, sub { + [ $loc->N("/_Options") . $loc->N("/_Show automatically selected packages"), undef, sub { $dont_show_selections->[0] = !$checkbox_show_autoselect->get_active; }, undef, '<CheckItem>' ], @@ -893,34 +895,34 @@ sub run_treeview_dialog { $use_regexp->[0] = $check_boxes{$regexp_search_string}->get_active; }, undef, '<CheckItem>' ], ), - [ N("/_View"), undef, undef, undef, '<Branch>' ], + [ $loc->N("/_View"), undef, undef, undef, '<Branch>' ], (map { state ($idx, $previous); - my $type = $idx ? join('/', N("/_View"), $previous) : '<RadioItem>'; + my $type = $idx ? join('/', $loc->N("/_View"), $previous) : '<RadioItem>'; $type =~ s/_//g; # gtk+ retrieve widgets by their path w/o any shortcut marks $previous = $modes{$_}; $idx++; my $val = $_; - [ N("/_View") . '/' . $modes{$_}, undef, sub { $view_callback->($val) }, 0, $type ]; + [ $loc->N("/_View") . '/' . $modes{$_}, undef, sub { $view_callback->($val) }, 0, $type ]; } qw(flat by_group by_leaves by_presence by_selection by_size by_source)), - [ N("/_Help"), undef, undef, undef, '<Branch>' ], - [ N("/_Help") . N("/_Report Bug"), undef, sub { run_drakbug('rpmdragora') }, undef, '<Item>' ], - [ N("/_Help") . N("/_Help"), undef, sub { AdminPanel::rpmdragora::open_help('') }, undef, '<Item>' ], - [ N("/_Help") . N("/_About..."), undef, sub { + [ $loc->N("/_Help"), undef, undef, undef, '<Branch>' ], + [ $loc->N("/_Help") . $loc->N("/_Report Bug"), undef, sub { run_drakbug('rpmdragora') }, undef, '<Item>' ], + [ $loc->N("/_Help") . $loc->N("/_Help"), undef, sub { AdminPanel::rpmdragora::open_help('') }, undef, '<Item>' ], + [ $loc->N("/_Help") . $loc->N("/_About..."), undef, sub { my $license = formatAlaTeX(translate($::license)); $license =~ s/\n/\n\n/sg; # nicer formatting - my $w = gtknew('AboutDialog', name => N("Rpmdragora"), + my $w = gtknew('AboutDialog', name => $loc->N("Rpmdragora"), version => $AdminPanel::Rpmdragora::init::version, - copyright => N("Copyright (C) %s by Mandriva", '2002-2009')."\n".N("Copyright (C) %s by Mageia.Org", '2010-2013'), + copyright => $loc->N("Copyright (C) %s by Mandriva", '2002-2009')."\n".$loc->N("Copyright (C) %s by Mageia.Org", '2010-2013'), license => $license, wrap_license => 1, - comments => N("Rpmdragora is the Mageia package management tool."), + comments => $loc->N("Rpmdragora is the Mageia package management tool."), website => 'http://www.mageia.org', - website_label => N("Mageia"), + website_label => $loc->N("Mageia"), authors => "Thierry Vignaud <vignaud@mandriva.com>\nAngelo Naselli <anaselli@gmail.com>\nMatteo Pasotti <matteo.pasotti@gmail.com>", artists => 'Hélène Durosini <ln@mandriva.com>', translator_credits => #-PO: put here name(s) and email(s) of translator(s) (eg: "John Smith <jsmith@nowhere.com>") - N("_: Translator(s) name(s) & email(s)\n"), + $loc->N("_: Translator(s) name(s) & email(s)\n"), transient_for => $::main_window, modal => 1, position_policy => 'center-on-parent', ); $w->show_all; @@ -933,7 +935,7 @@ sub run_treeview_dialog { # to retrieve a path, one must prevent "accelerators completion": my $get_path = sub { return join('', map { my $i = $_; $i =~ s/_//g; $i } @_) }; - if (my $widget = $factory->get_item('<main>' . $get_path->(N("/_View") . '/' . $modes{$mode->[0]}))) { + if (my $widget = $factory->get_item('<main>' . $get_path->($loc->N("/_View") . '/' . $modes{$mode->[0]}))) { $widget->set_active(1); } else { warn "Impossible to set $mode->[0] view as default\n"; @@ -941,10 +943,10 @@ sub run_treeview_dialog { %check_boxes = map { $_ => $factory->get_widget("<main>" . $get_path->($_)); - } ($auto_select_string, - $clean_cache_string, - $NVR_string, - $updates_string, + } ($auto_select_string, + $clean_cache_string, + $NVR_string, + $updates_string, $regexp_search_string); if (!$>) { @@ -955,7 +957,7 @@ sub run_treeview_dialog { $check_boxes{$clean_cache_string}->set_active($clean_cache->[0]); } - $checkbox_show_autoselect = $factory->get_widget("<main>" . strip_first_underscore(N("/_Options"), N("/_Show automatically selected packages"))) + $checkbox_show_autoselect = $factory->get_widget("<main>" . strip_first_underscore($loc->N("/_Options"), $loc->N("/_Show automatically selected packages"))) and $checkbox_show_autoselect->set_active(!$dont_show_selections->[0]); my $accel = Gtk2::AccelGroup->new; @@ -976,11 +978,11 @@ sub run_treeview_dialog { gtknew('HBox', spacing => 10), 0, $view_box, 0, $filter_box, - 0, gtknew('Label', text => N("Find:")), + 0, gtknew('Label', text => $loc->N("Find:")), 1, $find_entry = gtknew('Entry', width => 260, primary_icon => 'gtk-find', secondary_icon => 'gtk-clear', - tip => N("Please type in the string you want to search then press the <enter> key"), + tip => $loc->N("Please type in the string you want to search then press the <enter> key"), 'icon-release' => $find_callback, 'icon-press' => sub { my (undef, $pos, $event) = @_; @@ -1003,18 +1005,18 @@ sub run_treeview_dialog { 0, gtkpack_( gtknew('HBox', spacing => 20), 0, gtksignal_connect( - Gtk2::Button->new(but_(N("Select all"))), + Gtk2::Button->new(but_($loc->N("Select all"))), clicked => sub { toggle_all($options, 1); }, ), 1, gtknew('Label'), 0, my $action_button = gtksignal_connect( - Gtk2::Button->new(but_(N("Apply"))), + Gtk2::Button->new(but_($loc->N("Apply"))), clicked => sub { do_action($options, $callback_action, $info) }, ), 0, gtksignal_connect( - Gtk2::Button->new(but_(N("Quit"))), + Gtk2::Button->new(but_($loc->N("Quit"))), clicked => \&quit, ), ), @@ -1026,13 +1028,13 @@ sub run_treeview_dialog { $action_button->set_sensitive(0) if $>; $find_entry->grab_focus; - gtktext_insert($info, [ + gtktext_insert($info, [ [ $info->render_icon('gtk-dialog-info', 'GTK_ICON_SIZE_DIALOG', undef) ], @{ ugtk2::markup_to_TextView_format( - formatAlaTeX(join("\n\n\n", format_header(N("Quick Introduction")), - N("You can browse the packages through the categories tree on the left."), - N("You can view information about a package by clicking on it on the right list."), - N("To install, update or remove a package, just click on its \"checkbox\".")))) + formatAlaTeX(join("\n\n\n", format_header($loc->N("Quick Introduction")), + $loc->N("You can browse the packages through the categories tree on the left."), + $loc->N("You can view information about a package by clicking on it on the right list."), + $loc->N("To install, update or remove a package, just click on its \"checkbox\".")))) } ]); @@ -1103,7 +1105,7 @@ sub run_treeview_dialog { if ($MODE ne 'remove') { my $db = eval { open_rpm_db() }; if (!ref($db)) { - statusbar_msg(N("Reset aborted (RPM DB is locked by another process)"), 1); + statusbar_msg($loc->N("Reset aborted (RPM DB is locked by another process)"), 1); return; } $urpm->disable_selected( @@ -1120,16 +1122,16 @@ sub run_treeview_dialog { $reload_db_and_clear_all->(); } elsif ($menuLabel eq $helpMenu{ about }->label()) { - my $translators = N("_: Translator(s) name(s) & email(s)\n"); + my $translators = $loc->N("_: Translator(s) name(s) & email(s)\n"); $translators =~ s/\</\<\;/g; $translators =~ s/\>/\>\;/g; my $sh_gui = AdminPanel::Shared::GUI->new(); $sh_gui->AboutDialog({ name => "Rpmdragora", version => "TODO", - credits => N("Copyright (C) %s Mageia community", '2013-2014'), - license => N("GPLv2"), - description => N("Rpmdragora is the Mageia package management tool."), - authors => N("<h3>Developers</h3> + credits => $loc->N("Copyright (C) %s Mageia community", '2013-2014'), + license => $loc->N("GPLv2"), + description => $loc->N("Rpmdragora is the Mageia package management tool."), + authors => $loc->N("<h3>Developers</h3> <ul><li>%s</li> <li>%s</li> </ul> @@ -1189,11 +1191,11 @@ sub run_treeview_dialog { if (my $pid = is_running('rpmdragora')) { - interactive_msg(N("Warning"), N("rpmdragora is already running (pid: %s)", $pid), yesno => [ N("Quit") ]); + interactive_msg($loc->N("Warning"), $loc->N("rpmdragora is already running (pid: %s)", $pid), yesno => [ $loc->N("Quit") ]); exit(0); } -yui::YUI::app()->setApplicationTitle(N("Software Management")); +yui::YUI::app()->setApplicationTitle($loc->N("Software Management")); yui::YUI::app()->setApplicationIcon($wm_icon); my $MGAPlugin = "mga"; |