diff options
author | Norbert Preining <preining@logic.at> | 2008-06-01 19:49:17 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-06-01 19:49:17 +0000 |
commit | 4fa0e9965a6446a16c065efc766c7e9250e5ce52 (patch) | |
tree | bd0daf8eb45f4d48c65dfdc9452aa9453fa62285 /Master/texmf | |
parent | 10f1d1684834fa753fae437ce473669147108ee3 (diff) |
tlmgrgui: translations start
git-svn-id: svn://tug.org/texlive/trunk@8454 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf')
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 4 | ||||
-rw-r--r-- | Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl | 22 | ||||
-rw-r--r-- | Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl | 14 | ||||
-rw-r--r-- | Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl | 58 | ||||
-rw-r--r-- | Master/texmf/scripts/texlive/tlmgrgui/gui-uninstall.pl | 10 | ||||
-rw-r--r-- | Master/texmf/scripts/texlive/tlmgrgui/lang/de | 57 | ||||
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl | 150 |
7 files changed, 210 insertions, 105 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index a10e0c3a8c5..2815a178d90 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -55,6 +55,7 @@ my $opt_version = 0; my $opt_netarchive; my $opt_diskarchive; my $opt_gui = 0; +my $opt_gui_lang; TeXLive::TLUtils::process_logging_options(); @@ -62,6 +63,7 @@ GetOptions("location=s" => \$opt_location, "netarchive=s" => \$opt_netarchive, "diskarchive=s" => \$opt_diskarchive, "gui" => \$opt_gui, + "gui-lang=s" => \$opt_gui_lang, "version" => \$opt_version, "h|help|?" => \$opt_help) or pod2usage(2); @@ -903,6 +905,8 @@ sub action_gui { } my @cmdline; push @cmdline, $perlbinquote, $perlscript; + push @cmdline, "--lang", "$opt_gui_lang" + if (defined($opt_gui_lang)); push @cmdline, "--location", "$opt_location" if (defined($opt_location)); push @cmdline, "--netarchive", "$opt_netarchive" diff --git a/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl b/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl index 96cd9d8c72e..f6f037bae9d 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/do_listframe.pl @@ -93,7 +93,7 @@ sub update_info_window { } } if ($text eq "") { - $text = "(no description available)"; + $text = _"(no description available)"; } $iw->delete("0.0", "end"); $iw->insert("0.0", "$text"); @@ -109,14 +109,14 @@ sub do_listframe { -foreground => "blue", -font => "helvetica 10 bold" )->pack(-side => "top"); - $f_title->Label( -text => "Use Ctrl or Shift or drag to select more" + $f_title->Label( -text => _"Use Ctrl or Shift or drag to select more" )->pack(-side => "top"); $f_title->grid( -row => 1, -column => 1, -columnspan => 2, -padx => "2m", -pady => "2m", -sticky => "we"); # column 1, row 2-3 - my $f_listf = $f->Labelframe(-text => "Select packages"); + my $f_listf = $f->Labelframe(-text => _"Select packages"); $f_listf->grid( -row => 2, -column => 1, -rowspan => 2, -sticky => "nswe", -padx => "2m", -pady => "1m"); @@ -125,7 +125,7 @@ sub do_listframe { my $f_listf_searchf = $f_listf->Frame; $f_listf_searchf->pack(-pady => "1m"); my $f_listf_searchf_label = - $f_listf_searchf->Label(-text => "Search")->pack( -anchor => "w", + $f_listf_searchf->Label(-text => _"Search")->pack( -anchor => "w", -side => "left", -padx => "1m", -pady => "1m"); @@ -135,7 +135,7 @@ sub do_listframe { $f_textf_text, $_[0], @$listref); }); - my $f_listf_searchf_button = $f_listf_searchf->Button(-text => "Next", + my $f_listf_searchf_button = $f_listf_searchf->Button(-text => _"Next", -command => sub { find_next_search_match($f_listf_lb, $f_listf_searchf_entry, $f_textf_text, @@ -155,7 +155,7 @@ sub do_listframe { $f_listf_lb->pack(-fill => "both", -expand => 1); # row 2 column 2 - my $f_textf = $f->Labelframe(-text => "Info on the selected item"); + my $f_textf = $f->Labelframe(-text => _"Info on the selected item"); $f_textf->grid(-row => 2, -column => 2, -sticky => "nswe", -padx => "2m", -pady => "1m"); @@ -167,7 +167,7 @@ sub do_listframe { $f_textf_text = $f_textf->Scrolled("ROText", -scrollbars => "e", -width => 45, -wrap => "word"); - $f_textf_text->insert("end", "\nAttention.\nPlease check using \"Change\" button if a DVD drive with the TeX Live DVD\nor the correct network address is properly selected,\nthen press \"Load\" button."); + $f_textf_text->insert("end", _"\nAttention.\nPlease check using \"Change\" button if a DVD drive with the TeX Live DVD\nor the correct network address is properly selected,\nthen press \"Load\" button."); $f_textf_text->pack(-expand => 1, -fill => "both"); @@ -178,16 +178,16 @@ sub do_listframe { my $f_buttonf_optionsf = $f_buttonf->Frame(); if ($with_force) { - my $foo = $f_buttonf_optionsf->Checkbutton(-text => "force", + my $foo = $f_buttonf_optionsf->Checkbutton(-text => _"force", -variable => \$opt_force )->pack(-side => 'left'); - $balloon->attach($foo,-balloonmsg => "Force the removal of a package even if it is referenced in a collection."); + $balloon->attach($foo,-balloonmsg => _"Force the removal of a package even if it is referenced in a collection."); } if ($with_deps) { - my $foo = $f_buttonf_optionsf->Checkbutton(-text => "without depends", + my $foo = $f_buttonf_optionsf->Checkbutton(-text => _"without depends", -variable => \$opt_nodepends )->pack(-side => 'left'); - $balloon->attach($foo,-balloonmsg => "For collections: install or remove will not install/remove the dependencies"); + $balloon->attach($foo,-balloonmsg => _"For collections: install or remove will not install/remove the dependencies"); } $f_buttonf_optionsf->pack; foreach my $k (keys %$buttonsref) { diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl index cb259247dcd..a9e833556f8 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-arch.pl @@ -7,7 +7,7 @@ # -our $back_arch = $back->add("arch",-label => "Architectures"); +our $back_arch = $back->add("arch",-label => _"Architectures"); $screens{"arch"} = $back_arch; # this will be loaded only on unix systems! @@ -22,7 +22,7 @@ our $arch_frame; push @update_function_list, \&init_archs; -$back_arch->Label(-text => "Select architectures to be added (removal not possible)")->pack(-padx => "5m", -pady => "5m"); +$back_arch->Label(-text => _"Select architectures to be added (removal not possible)")->pack(-padx => "5m", -pady => "5m"); sub init_archs { @@ -51,8 +51,8 @@ sub init_archs { } $arch_frame = $back_arch->Frame; $arch_frame->pack(-padx => "10m", -pady => "5m"); - $arch_frame->Button(-text => "Apply changes", -command => sub { apply_changes(); })->pack(-side => 'left', -padx => "3m"); - $arch_frame->Button(-text => "Reset changes", -command => sub { init_archs(); })->pack(-side => 'left', -padx => "3m"); + $arch_frame->Button(-text => _"Apply changes", -command => sub { apply_changes(); })->pack(-side => 'left', -padx => "3m"); + $arch_frame->Button(-text => _"Reset changes", -command => sub { init_archs(); })->pack(-side => 'left', -padx => "3m"); } sub check_on_removal { @@ -60,9 +60,9 @@ sub check_on_removal { if (!$archs{$a} && grep(/^$a$/,@archsinstalled)) { # removal not supported $archs{$a} = 1; - $arch_frame->Dialog(-title => "info", - -text => "Removals of archs currently not supported!", - -buttons => [ "Ok" ])->Show; + $arch_frame->Dialog(-title => _"info", + -text => _"Removals of archs currently not supported!", + -buttons => [ _"Ok" ])->Show; } } diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl index 49f75e2f8ef..0848f447526 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-config.pl @@ -6,38 +6,38 @@ # GUI for tlmgr # -our $back_config = $back->add("config",-label => "Configuration"); +our $back_config = $back->add("config",-label => _"Configuration"); $screens{"config"} = $back_config; my $default_location = $localtlpdb->option_location; -my $default_formats = ($localtlpdb->option_create_formats ? "Yes" : "No"); -my $default_docfiles = ($localtlpdb->option_install_docfiles ? "Yes" : "No"); -my $default_srcfiles = ($localtlpdb->option_install_srcfiles ? "Yes" : "No"); +my $default_formats = ($localtlpdb->option_create_formats ? _"Yes" : _"No"); +my $default_docfiles = ($localtlpdb->option_install_docfiles ? _"Yes" : _"No"); +my $default_srcfiles = ($localtlpdb->option_install_srcfiles ? _"Yes" : _"No"); # this will be loaded only on unix systems! # -my $back_config_set = $back_config->Labelframe(-text => "Default settings"); +my $back_config_set = $back_config->Labelframe(-text => _"Default settings"); $back_config_set->pack; -my $back_config_set_l1 = $back_config_set->Label(-text => "Default installation source", -anchor => "w"); +my $back_config_set_l1 = $back_config_set->Label(-text => _"Default installation source", -anchor => "w"); my $back_config_set_m1 = $back_config_set->Label(-textvariable => \$default_location); -my $back_config_set_r1 = $back_config_set->Button(-text => "Change", +my $back_config_set_r1 = $back_config_set->Button(-text => _"Change", -command => sub { menu_default_location(); }); -my $back_config_set_l2 = $back_config_set->Label(-text => "Create formats on installation", -anchor => "w"); +my $back_config_set_l2 = $back_config_set->Label(-text => _"Create formats on installation", -anchor => "w"); my $back_config_set_m2 = $back_config_set->Label(-textvariable => \$default_formats); -my $back_config_set_r2 = $back_config_set->Button(-text => "Toggle", +my $back_config_set_r2 = $back_config_set->Button(-text => _"Toggle", -command => sub { toggle_setting("formats"); }); -my $back_config_set_l3 = $back_config_set->Label(-text => "Install macro/font docs", -anchor => "w"); +my $back_config_set_l3 = $back_config_set->Label(-text => _"Install macro/font docs", -anchor => "w"); my $back_config_set_m3 = $back_config_set->Label(-textvariable => \$default_docfiles); -my $back_config_set_r3 = $back_config_set->Button(-text => "Toggle", +my $back_config_set_r3 = $back_config_set->Button(-text => _"Toggle", -command => sub { toggle_setting("docfiles"); }); -my $back_config_set_l4 = $back_config_set->Label(-text => "Install macro/font sources", -anchor => "w"); +my $back_config_set_l4 = $back_config_set->Label(-text => _"Install macro/font sources", -anchor => "w"); my $back_config_set_m4 = $back_config_set->Label(-textvariable => \$default_srcfiles); -my $back_config_set_r4 = $back_config_set->Button(-text => "Toggle", +my $back_config_set_r4 = $back_config_set->Button(-text => _"Toggle", -command => sub { toggle_setting("srcfiles"); }); @@ -68,10 +68,10 @@ $back_config_set_r4->grid(-row => 4, -column => 3, ############# -my $back_config_pap = $back_config->Labelframe(-text => "Paper settings"); +my $back_config_pap = $back_config->Labelframe(-text => _"Paper settings"); -my $back_config_pap_l1 = $back_config_pap->Label(-text => "Default paper for all", -anchor => "w"); +my $back_config_pap_l1 = $back_config_pap->Label(-text => _"Default paper for all", -anchor => "w"); my $back_config_pap_m1 = $back_config_pap->Button(-text => "A4", -command => sub { change_paper("all", "a4"); }); my $back_config_pap_r1 = $back_config_pap->Button(-text => "letter", @@ -102,9 +102,9 @@ my (%l,%m,%r); foreach my $p (sort keys %papers) { my @pap = @{$papers{$p}}; $defaultpaper{$p} = $pap[0]; - $l{$p} = $back_config_pap->Label(-text => "default paper for $p", -anchor => "w"); + $l{$p} = $back_config_pap->Label(-text => _("Default paper for") . " $p", -anchor => "w"); $m{$p} = $back_config_pap->Label(-textvariable => \$defaultpaper{$p}, -anchor => "w"); - $r{$p} = $back_config_pap->Button(-text => "Change", + $r{$p} = $back_config_pap->Button(-text => _"Change", -command => sub { select_paper($p); }, -anchor => "w"); $l{$p}->grid(-row => $row, -column => 1, -padx => "2m", -pady => "2m", -sticky => "nsw"); @@ -119,8 +119,8 @@ $back_config_pap->pack; sub menu_default_location { my $val = $default_location; - my $sw = $mw->Toplevel(-title => "Change default installation source"); - $sw->Label(-text => "New default installation source: ")->pack; + my $sw = $mw->Toplevel(-title => _"Change default installation source"); + $sw->Label(-text => _"New default installation source: ")->pack; my $entry = $sw->Entry(-text => $location, -width => 30); $entry->pack; my $f = $sw->Frame; @@ -140,15 +140,15 @@ sub toggle_setting() { if ($key eq "formats") { my $new = ($localtlpdb->option_create_formats ? 0 : 1); $localtlpdb->option_create_formats($new); - $default_formats = ($new ? "Yes" : "No"); + $default_formats = ($new ? _"Yes" : _"No"); } elsif ($key eq "srcfiles") { my $new = ($localtlpdb->option_install_srcfiles ? 0 : 1); $localtlpdb->option_install_srcfiles($new); - $default_srcfiles = ($new ? "Yes" : "No"); + $default_srcfiles = ($new ? _"Yes" : _"No"); } elsif ($key eq "docfiles") { my $new = ($localtlpdb->option_install_docfiles ? 0 : 1); $localtlpdb->option_install_docfiles($new); - $default_docfiles = ($new ? "Yes" : "No"); + $default_docfiles = ($new ? _"Yes" : _"No"); } $localtlpdb->save; } @@ -169,16 +169,16 @@ sub change_paper { sub select_paper { my $prog = shift; - my $foo = $back_config->Toplevel(-title => "paper select for $prog"); + my $foo = $back_config->Toplevel(-title => _("paper select for") . " $prog"); my $var = $defaultpaper{$prog}; - my $opt = $foo->BrowseEntry(-label => "Default paper for $prog", -variable => \$var); + my $opt = $foo->BrowseEntry(-label => _("Default paper for") . " $prog", -variable => \$var); foreach my $p (sort @{$papers{$prog}}) { $opt->insert("end",$p); } $opt->pack; my $f = $foo->Frame; - $f->Button(-text => "Ok", -command => sub { change_paper($prog,$var); $foo->destroy; })->pack(-side => "left"); - $f->Button(-text => "Cancel", -command => sub { $foo->destroy; })->pack(-side => "left"); + $f->Button(-text => _"Ok", -command => sub { change_paper($prog,$var); $foo->destroy; })->pack(-side => "left"); + $f->Button(-text => _"Cancel", -command => sub { $foo->destroy; })->pack(-side => "left"); $f->pack; } @@ -186,7 +186,7 @@ sub select_paper { sub old_select_paper { my $prog = shift; - my $foo = $back_config->Toplevel(-title => "paper select for $prog"); + my $foo = $back_config->Toplevel(-title => _("paper select for") . " $prog"); my $var = $defaultpaper{$prog}; my @lop = @{$papers{$prog}}; my $nrpercols = 15; @@ -200,8 +200,8 @@ sub old_select_paper { $row = 1; } } - $foo->Button(-text => "Ok", -command => sub { change_paper($prog,$var); $foo->destroy; })->grid(-row => $nrpercols+1, -column => 1); - $foo->Button(-text => "Cancel", -command => sub { $foo->destroy; })->grid(-row => $nrpercols+1, -column => 2); + $foo->Button(-text => _"Ok", -command => sub { change_paper($prog,$var); $foo->destroy; })->grid(-row => $nrpercols+1, -column => 1); + $foo->Button(-text => _"Cancel", -command => sub { $foo->destroy; })->grid(-row => $nrpercols+1, -column => 2); } 1; diff --git a/Master/texmf/scripts/texlive/tlmgrgui/gui-uninstall.pl b/Master/texmf/scripts/texlive/tlmgrgui/gui-uninstall.pl index 72342d94dd7..1210baf2694 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui/gui-uninstall.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/gui-uninstall.pl @@ -6,27 +6,27 @@ # GUI for tlmgr # -our $back_f3 = $back->add("uninstall", -label => "Uninstallation"); +our $back_f3 = $back->add("uninstall", -label => _"Uninstallation"); $screens{"uninstall"} = $back_f3; if ($^O=~/^MSWin(32|64)$/i) { my $lab = $back_f3->Label(-justify => 'left', - -text => "Please use the \"Add/Remove Programs\" from the Control Panel!"); + -text => _"Please use the \"Add/Remove Programs\" from the Control Panel!"); $lab->pack(-padx => "10m", -pady => "5m"); } else { my $lab = $back_f3->Label(-justify => 'left', - -text => "Really remove the complete TeX Live 2008 installation?"); + -text => _"Really remove the complete TeX Live 2008 installation?\nNo more confirmation will be asked!"); $lab->pack(-padx => "10m", -pady => "5m"); my $f = $back_f3->Frame; $f->pack(-padx => "10m", -pady => "5m"); - my $ok = $f->Button(-text => "Remove TeX Live 2008", + my $ok = $f->Button(-text => _"Remove TeX Live 2008", -command => sub { system("tlmgr", "uninstall", "--force"); - $mw->Dialog(-text => "Complete removal completed", -buttons => [ "Bye" ])->Show; + $mw->Dialog(-text => _"Complete removal completed", -buttons => [ "Bye" ])->Show; $mw->destroy; exit(0); }); diff --git a/Master/texmf/scripts/texlive/tlmgrgui/lang/de b/Master/texmf/scripts/texlive/tlmgrgui/lang/de new file mode 100644 index 00000000000..2ee31a4c071 --- /dev/null +++ b/Master/texmf/scripts/texlive/tlmgrgui/lang/de @@ -0,0 +1,57 @@ +About===Über +Adding packages===Pakete hinzufügen +Architectures===Architekturen +Cancel===Abbruch +Change===Ändern +Change Location===Ändern der Quelle +Change the installation source===Ändern der Installationsquelle +Choose Directory===Auswahl eines Ordners +Configuration===Konfiguration +Create formats on installation===Erstellen von Formaten bei der Installation +Current installation source: ===Aktuelle Installationsquelle +debug===debug +Default installation source===Voreingestellte Installationsquelle +Default Net Location===Voreingestellte Netzwerkquelle +Default paper for===Voreingestelles Papierformat für +Default paper for all===Voreingestelltes Papierformat für alle Programme +Default settings===Voreinstellungen +force===erzwinge +Force the removal of a package even if it is referenced in a collection.===Erzwinge das Entfernen von Paketen selbst wenn sie von Kollektionen referenziert werden. +For collections: install or remove will not install/remove the dependencies===Bei Kollektionen werden abhängige Pakete installiert oder entfernt +Info on the selected item===Information für den selektierten Eintrag +Installation===Installation +Install macro/font docs===Installation der font/macro Dokumentation +Install macro/font sources===Installation der font/macro Quellen +Install selected===Installation der selektierten Pakete +Load===Lade +\nAttention.\nPlease check using "Change" button if a DVD drive with the TeX Live DVD\nor the correct network address is properly selected,\nthen press "Load" button.=== +New location: ===Neue Quelle +Next===Nächster +Ok===Ok +paper select for=== +Paper settings===Papierformat-Einstellungen +Press this button to load the database from the specified location.=== +Quit===Beenden +Really remove the complete TeX Live 2008 installation?\nNo more confirmation will be asked!===Wollen Sie TeX Live 2008 wirklich komplett entfernen?\nEs werden keine weiteren Rückfragen gestellt werden! +Remove===Entfernen +Remove selected===Entfernen der selektierten Pakete +Remove TeX Live 2008===TeX Live 2008 entfernen +Removing packages===Entfernen von Paketen +Search===Suche +Select architectures to be added (removal not possible)=== +Select packages===Auswählen von Paketen +Toggle===Ändern +Turn on debug mode when calling tlmgr.=== +Uninstallation===Entfernen von TL2008 +Update===Update +Update all===Update aller Pakete +Update selected===Update der selektierten Pakete +Updating packages===Update von Paketen +Use Ctrl or Shift or drag to select more=== +without depends===ohne Abhängigkeiten +Yes===Ja +# Local Variables: +# coding: utf-8 +# End: +# vim:set termencoding=iso8859-15 encoding=utf-8 fileencoding=utf-8: # + diff --git a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl index 29717fba3fb..57889b6602c 100755 --- a/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui/tlmgrgui.pl @@ -31,6 +31,66 @@ use Getopt::Long qw(:config no_autoabbrev require_order); # +# translation facility, not fully functional by now +# +our %TRANS; +our $LANG; +$TRANS{'de'}{'foo'} = 1; +sub _ ($) { + my $s = shift; + my $ss = $s; + $ss =~ s/\n/\\n/g; + # if no $LANG is set just return without anything + return $s if !defined($LANG); + # if $LANG is set but no translation print $s, and warn + if (!defined($TRANS{$LANG})) { + printf STDERR "no translation available for $LANG, continuing in English\n"; + return $s; + } + # if the translation is defined return it + return $TRANS{$LANG}{"$ss"} if defined($TRANS{$LANG}{"$ss"}); + # otherwise warn about missing translation and return untranslated string + printf STDERR "===$ss===MISSING\n"; + return $s; +} + +my $opt_location; +my $opt_debug = 0; +my $opt_netarchive; +my $opt_diskarchive; +my $opt_screen; +our $opt_force = 0; +our $opt_nodepends = 0; + +GetOptions("location=s" => \$opt_location, + "netarchive=s" => \$NetArchive, + "diskarchive=s" => \$DiskArchive, + "screen=s" => \$opt_screen, + "force" => \$opt_force, + "lang=s" => \$LANG, + "no-depends" => \$opt_nodepends, + "debug!" => \$opt_debug) or die("Unsupported argument!"); + +# +# try loading the lang file +# +if (-r "$Master/texmf/scripts/texlive/tlmgrgui/lang/$LANG") { + open(LANG,"<$Master/texmf/scripts/texlive/tlmgrgui/lang/$LANG"); + while (<LANG>) { + chomp; + next if m/^\s*#/; + next if m/^\s*$/; + my ($a,$b) = split(/===/,$_); + next if ($b =~ m/^\s*$/); + if (!utf8::decode($b)) { + warn("decoding string to utf8 didn't work:$b\n"); + } + $b =~ s/\\n/\n/g; + $TRANS{$LANG}{"$a"} = "$b"; + } +} + +# # ok we try to load Tk and break and give a decent message if it does not # work: # @@ -39,10 +99,10 @@ eval { require Tk; }; if ($@) { # that didn't work out, give some usefull error message and stop if (win32()) { - printf STDERR "Cannot load Tk, that should not happen as we ship it! + printf STDERR _"Cannot load Tk, that should not happen as we ship it! How did you start tlmgrgui??\n"; } else { - printf STDERR " + printf STDERR _" Cannot load Tk, thus the GUI cannot be started! The Perl/Tk module is not shipped with the TeX Live installation. You have to install it to get tlmgr GUI running. @@ -63,22 +123,6 @@ require Tk::BrowseEntry; require Tk::ROText; require Tk::Balloon; -my $opt_location; -my $opt_debug = 0; -my $opt_netarchive; -my $opt_diskarchive; -my $opt_screen; -our $opt_force = 0; -our $opt_nodepends = 0; - -GetOptions("location=s" => \$opt_location, - "netarchive=s" => \$NetArchive, - "diskarchive=s" => \$DiskArchive, - "screen=s" => \$opt_screen, - "force" => \$opt_force, - "no-depends" => \$opt_nodepends, - "debug!" => \$opt_debug) or die("Unsupported argument!"); - our @update_function_list; our $debugmode = 0; @@ -114,37 +158,37 @@ push @update_function_list, \&create_update_list; # frame .top our $top = $mw->Frame; -our $quit = $top->Button(-text => "Quit", +our $quit = $top->Button(-text => _"Quit", -command => sub { $mw->destroy; exit(0); }); -our $about = $top->Button(-text => "About", +our $about = $top->Button(-text => _"About", -command => sub { - $mw->Dialog(-title => "About", - -text => "TeX Live Manager GUI + $mw->Dialog(-title => _"About", + -text => _"TeX Live Manager GUI Copyright 2008 Tomasz Luczak, Norbert Preining License under the GNU General Public License version 2 or higher In case of problems, please contact: texlive\@tug.org", - -buttons => [ "Ok" ])->Show; + -buttons => [ _"Ok" ])->Show; }); $about->pack(-side => 'right'); $quit->pack(-side => 'right'); -$top->Label(-text => "Current installation source: ")->pack(-side => 'left'); +$top->Label(-text => _"Current installation source: ")->pack(-side => 'left'); $top->Label(-textvariable => \$location, -relief => "sunken")->pack(-side => 'left'); $balloon->attach( - $top->Button(-text => "Load", -command => sub { run_update_functions(); })->pack(-side => 'left'), - -balloonmsg => "Press this button to load the database from the specified location."); + $top->Button(-text => _"Load", -command => sub { run_update_functions(); })->pack(-side => 'left'), + -balloonmsg => _"Press this button to load the database from the specified location."); $balloon->attach( - $top->Button(-text => "Change", -command => sub { menu_edit_location(); })->pack(-side => 'left'), - -balloonmsg => "Change the installation source"); + $top->Button(-text => _"Change", -command => sub { menu_edit_location(); })->pack(-side => 'left'), + -balloonmsg => _"Change the installation source"); $balloon->attach( - $top->Checkbutton(-text => "debug", + $top->Checkbutton(-text => _"debug", -variable => \$debugmode)->pack(-side => 'left'), - -balloonmsg => "Turn on debug mode when calling tlmgr."); + -balloonmsg => _"Turn on debug mode when calling tlmgr."); # frame .back -borderwidth 2 our $back = $mw->NoteBook(-borderwidth => 2, -dynamicgeometry => 1); @@ -156,37 +200,37 @@ $back->pack(-side => 'top', -fill => 'both', -expand => 1); require ("do_listframe.pl"); # install screen -our $back_f1 = $back->add("install",-label => "Installation"); +our $back_f1 = $back->add("install",-label => _"Installation"); $screens{"install"} = $back_f1; do_listframe($back_f1, - "Adding packages", + _"Adding packages", \@allpackages, - { install => { -text => "Install selected", + { install => { -text => _"Install selected", -command => \&install_selected_packages}}, 0,1 ); # update screen -our $back_up = $back->add("update", -label => "Update"); +our $back_up = $back->add("update", -label => _"Update"); $screens{"update"} = $back_up; do_listframe($back_up, - "Updating packages", + _"Updating packages", \@updatepackages, - { updateall => { -text => "Update all", + { updateall => { -text => _"Update all", -command => \&update_selected_packages, -args => [ "--all" ] }, - updatesel => { -text => "Update selected", + updatesel => { -text => _"Update selected", -command => \&update_selected_packages }}, 0,0 ); # remove screen -our $back_f2 = $back->add("remove", -label => "Remove"); +our $back_f2 = $back->add("remove", -label => _"Remove"); $screens{"remove"} = $back_f2; do_listframe($back_f2, - "Removing packages", + _"Removing packages", \@alllocalpackages, - { remove => { -text => "Remove selected", + { remove => { -text => _"Remove selected", -command => \&remove_selected_packages}}, 1,1 ); @@ -216,10 +260,10 @@ sub init_install_media { $tlmediasrc = TeXLive::TLMedia->new($newroot); if (!defined($tlmediasrc)) { # something went badly wrong, maybe the newroot is wrong? - $mw->Dialog(-title => "warning", - -text => "Could not load the TeX Live Database from $newroot\nIf you want to install or update packages, please try with a different installation source/location!\n\nFor configuration and removal you don't have to do anything.", - -buttons => [ "Ok" ])->Show; - $location = "...please change me..."; + $mw->Dialog(-title => _"warning", + -text => _"Could not load the TeX Live Database from $newroot\nIf you want to install or update packages, please try with a different installation source/location!\n\nFor configuration and removal you don't have to do anything.", + -buttons => [ _"Ok" ])->Show; + $location = _"...please change me..."; @allpackages = (); } else { $tlmediatlpdb = $tlmediasrc->tlpdb; @@ -229,13 +273,13 @@ sub init_install_media { } sub run_program_show_output { - my $td = $mw->Toplevel(-title => "tlmgr process"); + my $td = $mw->Toplevel(-title => _"tlmgr process"); my $tf = $td->Scrolled("ROText", -width => 80, -height => 10, -wrap => "none", -scrollbars => "ose" )->pack(-expand => 1, -fill => "both"); - my $ok = $td->Button(-text => "OK", -padx => "3m", -pady => "3m", + my $ok = $td->Button(-text => _"OK", -padx => "3m", -pady => "3m", -command => sub { $td->destroy; }); # start the installation, read the output for (my $i = 0; $i < 100; $i++) { @@ -245,13 +289,13 @@ sub run_program_show_output { # ok, that stupid perl for windows does not have fork, why? no idea # we have to deal with that if ($^O=~/^MSWin(32|64)$/i) { - $tf->insert("end", "Starting @_\n\nThis may take some time! + $tf->insert("end", _("Starting ") . "@_\n\n" . _"This may take some time! Please wait, the output will appear here when ready.\n"); for (my $i = 0; $i < 100; $i++) { Tk::DoOneEvent(Tk::Event::DONT_WAIT); } my $ret = `@_`; - $tf->insert("end", "$ret\n\nCOMPLETED\n"); + $tf->insert("end", "$ret\n\n" . _"COMPLETED\n"); $tf->see("end"); $ok->pack; for (my $i = 0; $i < 100; $i++) { @@ -275,7 +319,7 @@ Please wait, the output will appear here when ready.\n"); # do not buffer lines ... $| = 1; open STDERR, '>&STDOUT'; - print "Starting @_\n"; + print _("Starting ") . "@_\n"; exec(@_) || die "can't exec program: $!"; # NOTREACHED @@ -408,12 +452,12 @@ sub setup_list { sub menu_edit_location { my $key = shift; my $val; - my $sw = $mw->Toplevel(-title => "Change Location"); + my $sw = $mw->Toplevel(-title => _"Change Location"); my $f1 = $sw->Frame; - $f1->Label(-text => "New location: ")->pack(-side => "left"); + $f1->Label(-text => _"New location: ")->pack(-side => "left"); my $entry = $f1->Entry(-text => $location, -width => 30); $entry->pack(-side => "left"); - $f1->Button(-text => "Choose Directory", + $f1->Button(-text => _"Choose Directory", -command => sub { my $var = $sw->chooseDirectory; if (defined($var)) { @@ -421,7 +465,7 @@ sub menu_edit_location { $entry->insert(0,$var); } })->pack(-side => "left"); - $f1->Button(-text => "Default Net Location", + $f1->Button(-text => _"Default Net Location", -command => sub { $entry->delete(0,"end"); $entry->insert(0,$TeXLiveURL); |