summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2011-01-28 08:47:30 +0000
committerNorbert Preining <preining@logic.at>2011-01-28 08:47:30 +0000
commit9262372b5dcd6abcd12b55cfd93f24ea0447182a (patch)
tree978450260dc5e0fd1ade2bba0deb81d91711ff8d /Master
parenta1b988cf5c5ac32208d859823f048d11fe699760 (diff)
support gui-lang in tlmgr config file, and add interface to tlmgr gui
to change the language git-svn-id: svn://tug.org/texlive/trunk@21207 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/texmf/scripts/texlive/tlmgr.pl16
-rw-r--r--Master/texmf/scripts/texlive/tlmgrgui.pl63
2 files changed, 73 insertions, 6 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl
index 982a11f4cf2..f3852703e6b 100755
--- a/Master/texmf/scripts/texlive/tlmgr.pl
+++ b/Master/texmf/scripts/texlive/tlmgr.pl
@@ -4709,6 +4709,8 @@ sub load_config_file
} else {
tlwarn("Unknown value $val for persistent-downloads in $fn\n");
}
+ } elsif ($key eq "gui-lang") {
+ $config{'gui-lang'} = $val;
} else {
tlwarn("Unknown key $key in $fn\n");
}
@@ -5959,8 +5961,8 @@ and C<updmap-sys> yourself after making any local changes.
=head1 CONFIGURATION FILE
A small subset of the command line options can be set in a config file
-for C<tlmgr> which resides in C<TEXMFVAR/tlmgr/config>. By default, the
-config file is in C<~/.texlive2010/tlmgr/config>. This is I<not>
+for C<tlmgr> which resides in C<TEXMFCONFIG/tlmgr/config>. By default, the
+config file is in C<~/.texlive2010/texmf-config/tlmgr/config>. This is I<not>
C<TEXMFSYSVAR>, so that the file is specific to a single user.
In this file, empty lines and lines starting with # are ignored. All
@@ -5968,10 +5970,12 @@ other lines must look like
key = value
-where the allowed keys are C<gui-expertmode> and
-C<persistent-downloads>. The values can only be 0 or 1 for those
-settings. C<persistent-downloads> corresponds to the command line
-option of the same name. C<gui-expertmode> switches between the full
+where the allowed keys are
+C<gui-expertmode> (values 0 or 1),
+C<persistent-downloads> (values 0 or 1),
+and C<gui-lang> (values like the command line arguments).
+C<persistent-downloads> and C<gui-lang> correspond to the command line
+options of the same name. C<gui-expertmode> switches between the full
GUI and a simplified GUI with only the important and mostly used
settings.
diff --git a/Master/texmf/scripts/texlive/tlmgrgui.pl b/Master/texmf/scripts/texlive/tlmgrgui.pl
index c1061c98b4f..653ce846bcb 100644
--- a/Master/texmf/scripts/texlive/tlmgrgui.pl
+++ b/Master/texmf/scripts/texlive/tlmgrgui.pl
@@ -117,6 +117,7 @@ my $selection_value = 0;
# prepare for loading of lang.pl which expects $::lang and $::opt_lang
+$::opt_lang = $config{"gui-lang"} if (defined($config{"gui-lang"}));
$::opt_lang = $opts{"gui-lang"} if (defined($opts{"gui-lang"}));
require("TeXLive/trans.pl");
@@ -512,6 +513,8 @@ sub setup_menu_system {
if (!win32() && $mode_expert) {
$menu_options->add('command', -label => __("Platforms ..."),
-command => sub { do_arch_settings(); });
+ $menu_options->add('command', -label => __("GUI Language ..."),
+ -command => sub { do_gui_language_setting(); });
}
$menu_options->add('separator');
$menu_options->add('checkbutton', -label => __("Expert options"),
@@ -1304,6 +1307,66 @@ sub do_paper_settings {
-command => sub { $sw->destroy; })->pack(-side => 'left', -padx => "3m");
}
+sub do_gui_language_setting {
+ my $sw = $mw->Toplevel(-title => __("GUI Language"));
+ my %code_lang = (
+ cs => "Czech",
+ de => "German",
+ es => "Spanish",
+ fr => "French",
+ it => "Italian",
+ ja => "Japanese",
+ nl => "Dutch",
+ pl => "Polish",
+ ru => "Russian",
+ sk => "Slovak",
+ sl => "Slovenian",
+ sr => "Serbian",
+ vi => "Vietnamese",
+ "zh-cn" => "Simplified Chinese",
+ "zh-tw" => "Traditional Chinese"
+ );
+
+ $sw->transient($mw);
+ $sw->grab();
+ my $var = "System";
+ $var = $config{"gui-lang"} if (defined($config{"gui-lang"}));
+ $var = $opts{"gui-lang"} if (defined($opts{"gui-lang"}));
+ $var = (defined($code_lang{$var}) ? $code_lang{$var} : $var);
+ my $opt = $sw->BrowseEntry(-label => __("Default language for GUI:"), -variable => \$var);
+ $opt->insert(0,__("System default"));
+ my @ll;
+ foreach my $p (<$Master/tlpkg/translations/*.po>) {
+ $p =~ s!^.*translations/!!;
+ $p =~ s!\.po$!!;
+ push @ll, $p;
+ }
+ foreach my $l (sort @ll) {
+ my $el = (defined($code_lang{$l}) ? $code_lang{$l} : $l);
+ $opt->insert("end",$el);
+ }
+ $opt->pack(-padx => "2m", -pady => "2m");
+ $sw->Label(-text => __("Changes will take effect after restart"))->pack(-padx => "2m", -pady => "2m");
+ my $f = $sw->Frame;
+ my $okbutton = $f->Button(-text => __("Ok"),
+ -command => sub {
+ for my $l (keys %code_lang) {
+ if ($code_lang{$l} eq $var) {
+ if ($config{'gui-lang'} ne $l) {
+ $config{'gui-lang'} = $l;
+ write_config_file();
+ }
+ last;
+ }
+ }
+ $sw->destroy;
+ })->pack(-side => "left", -padx => "2m", -pady => "2m");
+ my $cancelbutton = $f->Button(-text => __("Cancel"), -command => sub { $sw->destroy; })->pack(-side => "left", -padx => "2m", -pady => "2m");
+ $f->pack;
+ $sw->bind('<Return>', [ $okbutton, 'Invoke' ]);
+ $sw->bind('<Escape>', [ $cancelbutton, 'Invoke' ]);
+}
+
sub do_and_warn_gui_mode_settings {
my $ans = $mw->Dialog(-text => __("Changes will take effect after restart"),
-title => __("Expert options"),