diff options
author | Till Kamppeter <tkamppeter@mandriva.com> | 2005-03-02 21:25:53 +0000 |
---|---|---|
committer | Till Kamppeter <tkamppeter@mandriva.com> | 2005-03-02 21:25:53 +0000 |
commit | 854e603dc751754d1e86712056e5553376ca8f8e (patch) | |
tree | 9f5c86d538dd9b499758f158ee8712aa47eac54c /perl-install | |
parent | 82b4bf307fb03b6bab4b0f016232793e1aa780f7 (diff) | |
download | drakx-backup-do-not-use-854e603dc751754d1e86712056e5553376ca8f8e.tar drakx-backup-do-not-use-854e603dc751754d1e86712056e5553376ca8f8e.tar.gz drakx-backup-do-not-use-854e603dc751754d1e86712056e5553376ca8f8e.tar.bz2 drakx-backup-do-not-use-854e603dc751754d1e86712056e5553376ca8f8e.tar.xz drakx-backup-do-not-use-854e603dc751754d1e86712056e5553376ca8f8e.zip |
- Made the "(recommended)" in the printer/driver lists translateable (bug
10651)
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/printer/main.pm | 33 | ||||
-rw-r--r-- | perl-install/printer/printerdrake.pm | 17 |
2 files changed, 31 insertions, 19 deletions
diff --git a/perl-install/printer/main.pm b/perl-install/printer/main.pm index 9eb64ad99..fd96b9b39 100644 --- a/perl-install/printer/main.pm +++ b/perl-install/printer/main.pm @@ -41,6 +41,11 @@ our %thedb; our $hplipdevicesdb; +# Translation of the "(recommended)" in printer driver entries +our $recstr = N("recommended"); +our $precstr = "($recstr)"; +our $sprecstr = quotemeta($precstr); + #------------------------------------------------------------------------------ sub spooler() { @@ -568,7 +573,7 @@ sub read_printer_db { $driverstr = "GhostScript + $driver"; } if ($driver eq $entry->{defaultdriver}) { - $driverstr .= " (recommended)"; + $driverstr .= " $precstr"; } $entry->{ENTRY} = "$entry->{make}|$entry->{model}|$driverstr"; $entry->{ENTRY} =~ s/^CITOH/C.ITOH/i; @@ -1652,6 +1657,8 @@ sub ppd_entry_str { # model name, this with the cleaned manufacturer name $model =~ s/^$mf[\s\-]+//i if $mf && $mf !~ m![\\/\(\)\[\]\|\.\$\@\%\*\?]!; + # Translate "(recommended)" in the driver string + $driver =~ s/\(recommended\)/$precstr/gi; # Put out the resulting description string uc($mf) . '|' . $model . '|' . $driver . ($lang && " (" . lang::locale_to_main_locale($lang) . ")"); @@ -1739,7 +1746,7 @@ sub poll_ppd_base { $driver =~ s/\s*\([a-z]{2}(|_[A-Z]{2})\)\s*$//; # Recommended Foomatic PPD? Extract "(recommended)" my $isrecommended = - $driver =~ s/\s+\(recommended\)\s*$//i; + $driver =~ s/\s+$sprecstr\s*$//i; # Remove trailing white space $driver =~ s/\s+$//; # For Foomatic: Driver with "GhostScript + " @@ -1802,7 +1809,7 @@ sub poll_ppd_base { } elsif ((defined $thedb{"$mf|$model|$fullfoomaticdriver"} || defined - $thedb{"$mf|$model|$fullfoomaticdriver (recommended)"}) && + $thedb{"$mf|$model|$fullfoomaticdriver $precstr"}) && $isfoomatic) { # Expert mode: There is already an entry for the # same printer/driver combo produced by the @@ -1810,20 +1817,20 @@ sub poll_ppd_base { # entry next; } elsif (defined - $thedb{"$mf|$model|PostScript (recommended)"} && + $thedb{"$mf|$model|PostScript $precstr"} && $isnativeps) { # Expert mode: "Foomatic + Postscript" driver is # recommended and this is a PostScript PPD? Make # this PPD the recommended one foreach (keys - %{$thedb{"$mf|$model|PostScript (recommended)"}}) { + %{$thedb{"$mf|$model|PostScript $precstr"}}) { $thedb{"$mf|$model|PostScript"}{$_} = - $thedb{"$mf|$model|PostScript (recommended)"}{$_}; + $thedb{"$mf|$model|PostScript $precstr"}{$_}; } delete - $thedb{"$mf|$model|PostScript (recommended)"}; + $thedb{"$mf|$model|PostScript $precstr"}; if (!$isrecommended) { - $key .= " (recommended)"; + $key .= " $precstr"; } } elsif ($driver =~ /PostScript/i && $isrecommended && $isfoomatic && @@ -1835,20 +1842,20 @@ sub poll_ppd_base { # recommended and there was a PostScript PPD? Make # the PostScript PPD the recommended one my $firstfound = $foundkeys[0]; - if (!(any { /\(recommended\)/ } @foundkeys)) { + if (!(any { /$sprecstr/ } @foundkeys)) { # Do it only if none of the native PostScript # PPDs for this printer is already "recommended" foreach (keys %{$thedb{$firstfound}}) { - $thedb{"$firstfound (recommended)"}{$_} = + $thedb{"$firstfound $precstr"}{$_} = $thedb{$firstfound}{$_}; } delete $thedb{$firstfound}; } - $key =~ s/\s*\(recommended\)//; + $key =~ s/\s*$sprecstr//; } elsif ($driver !~ /PostScript/i && $isrecommended && $isfoomatic && (@foundkeys = grep { - /^$mf\|$model\|.*\(recommended\)/ && + /^$mf\|$model\|.*$sprecstr/ && !/CUPS/i && $thedb{$_}{driver} eq "PPD" } keys %thedb)) { # Expert mode: Foomatic driver other than "Foomatic + @@ -1858,7 +1865,7 @@ sub poll_ppd_base { foreach my $sourcekey (@foundkeys) { # Remove the "recommended" tag my $destkey = $sourcekey; - $destkey =~ s/\s+\(recommended\)\s*$//i; + $destkey =~ s/\s+$sprecstr\s*$//i; foreach (keys %{$thedb{$sourcekey}}) { $thedb{$destkey}{$_} = $thedb{$sourcekey}{$_}; } diff --git a/perl-install/printer/printerdrake.pm b/perl-install/printer/printerdrake.pm index eda1f11ba..8389262aa 100644 --- a/perl-install/printer/printerdrake.pm +++ b/perl-install/printer/printerdrake.pm @@ -14,6 +14,11 @@ use printer::detect; use printer::default; use printer::data; +# Overtake translation for "(recommended)" from printer/main.pm +my $recstr = $printer::main::recstr; +my $precstr = $printer::main::precstr; +my $sprecstr = $printer::main::sprecstr; + my $shortdistroname = "Mandrakelinux"; my $hp1000fwtext = N("The HP LaserJet 1000 needs its firmware to be uploaded after being turned on. Download the Windows driver package from the HP web site (the firmware on the printer's CD does not work) and extract the firmware file from it by decompressing the self-extracting '.exe' file with the 'unzip' utility and searching for the 'sihp1000.img' file. Copy this file into the '/etc/printer' directory. There it will be found by the automatic uploader script and uploaded whenever the printer is connected and turned on. @@ -2821,7 +2826,7 @@ sub get_db_entry { # database key contains the "(recommended)" for the # recommended driver, so add it if necessary unless (exists($printer::main::thedb{$printer->{DBENTRY}})) { - $printer->{DBENTRY} .= " (recommended)"; + $printer->{DBENTRY} .= " $precstr"; } } else { $printer->{DBENTRY} = "$make|$model"; @@ -2833,7 +2838,7 @@ sub get_db_entry { printer::main::get_descr_from_ppd($printer) || $printer->{DBENTRY}; unless (exists($printer::main::thedb{$printer->{DBENTRY}})) { - $printer->{DBENTRY} .= " (recommended)"; + $printer->{DBENTRY} .= " $precstr"; } $printer->{OLD_CHOICE} = $printer->{DBENTRY}; } @@ -2855,7 +2860,7 @@ sub get_db_entry { } foreach my $key (keys %printer::main::thedb) { if ($printer->{expert} && - $key =~ /^$make\|$model\|.*\(recommended\).*$/ || + $key =~ /^$make\|$model\|.*$sprecstr.*$/ || !$printer->{expert} && $key =~ /^$make\|$model$/) { $printer->{DBENTRY} = $key; } @@ -2868,7 +2873,7 @@ sub get_db_entry { $model =~ s/PostScript//i; $model =~ s/Series//i; foreach my $key (keys %printer::main::thedb) { - if ($printer->{expert} && $key =~ /^$make\|$model\|.*\(recommended\).*$/ || + if ($printer->{expert} && $key =~ /^$make\|$model\|.*$sprecstr.*$/ || !$printer->{expert} && $key =~ /^$make\|$model$/) { $printer->{DBENTRY} = $key; } @@ -2892,10 +2897,10 @@ sub get_db_entry { $printer->{OLD_CHOICE} = "XXX"; } } else { - if ($printer->{expert} && $printer->{DBENTRY} !~ /(recommended)/) { + if ($printer->{expert} && $printer->{DBENTRY} !~ /$sprecstr/) { my ($make, $model) = $printer->{DBENTRY} =~ /^([^\|]+)\|([^\|]+)\|/; foreach my $key (keys %printer::main::thedb) { - if ($key =~ /^$make\|$model\|.*\(recommended\).*$/) { + if ($key =~ /^$make\|$model\|.*$sprecstr.*$/) { $printer->{DBENTRY} = $key; } } |