summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/texmf-dist/scripts/texlive/tlmgrgui.pl1
-rw-r--r--Master/tlpkg/TeXLive/trans.pl172
-rw-r--r--Master/tlpkg/installer/install-menu-perltk.pl1
-rw-r--r--Master/tlpkg/installer/install-menu-wizard.pl1
4 files changed, 90 insertions, 85 deletions
diff --git a/Master/texmf-dist/scripts/texlive/tlmgrgui.pl b/Master/texmf-dist/scripts/texlive/tlmgrgui.pl
index 228ad86e2d6..09b80a6df17 100755
--- a/Master/texmf-dist/scripts/texlive/tlmgrgui.pl
+++ b/Master/texmf-dist/scripts/texlive/tlmgrgui.pl
@@ -131,6 +131,7 @@ my $selection_value = 0;
$::opt_lang = $config{"gui-lang"} if (defined($config{"gui-lang"}));
$::opt_lang = $opts{"gui-lang"} if (defined($opts{"gui-lang"}));
require("TeXLive/trans.pl");
+load_translations();
my @archsavail;
diff --git a/Master/tlpkg/TeXLive/trans.pl b/Master/tlpkg/TeXLive/trans.pl
index 09991f53a52..951c4f83ca0 100644
--- a/Master/tlpkg/TeXLive/trans.pl
+++ b/Master/tlpkg/TeXLive/trans.pl
@@ -104,102 +104,104 @@ sub __ ($@) {
return sprintf($ret, @_);
}
-if (($::lang ne "en") && ($::lang ne "C")) {
- my $code = $::lang;
- my @files_to_check;
- if (defined($::area)) {
- $code .= "_$::area";
- push @files_to_check,
- $::lang . "_" . $::area, "$::lang-$::area",
- $::lang . "_" . lc($::area), "$::lang-" . lc($::area),
- # try also without area code, even if it is given!
- $::lang;
- } else {
- push @files_to_check, $::lang;
- }
- my $found = 0;
- for my $f (@files_to_check) {
- if (-r "$::installerdir/tlpkg/translations/$f.po") {
- $found = 1;
- $::lang = $f;
- last;
+sub load_translations() {
+ if (($::lang ne "en") && ($::lang ne "C")) {
+ my $code = $::lang;
+ my @files_to_check;
+ if (defined($::area)) {
+ $code .= "_$::area";
+ push @files_to_check,
+ $::lang . "_" . $::area, "$::lang-$::area",
+ $::lang . "_" . lc($::area), "$::lang-" . lc($::area),
+ # try also without area code, even if it is given!
+ $::lang;
+ } else {
+ push @files_to_check, $::lang;
}
- }
- if (!$found) {
- tlwarn ("\n Sorry, no translations available for $code (nor $::lang); falling back to English.
- Make sure that you have the package \"texlive-msg-translations\" installed.
- (If you'd like to help translate the installer's messages, please see
- http://tug.org/texlive/doc.html#install-tl-xlate for information.)\n\n");
- } else {
- # merge the translated strings into the text string
- open(LANG, "<$::installerdir/tlpkg/translations/$::lang.po");
- my $msgid;
- my $msgstr;
- my $inmsgid;
- my $inmsgstr;
- while (<LANG>) {
- chomp;
- next if m/^\s*#/;
- if (m/^\s*$/) {
- if ($inmsgid) {
- debug("msgid $msgid without msgstr in $::lang.po\n");
- $inmsgid = 0;
- $inmsgstr = 0;
- $msgid = "";
- $msgstr = "";
- next;
- }
- if ($inmsgstr) {
- if ($msgstr) {
- if (!utf8::decode($msgstr)) {
- warn("decoding string to utf8 didn't work: $msgstr\n");
- }
- # we decode msgid too to get \\ and not \
- if (!utf8::decode($msgid)) {
- warn("decoding string to utf8 didn't work: $msgid\n");
+ my $found = 0;
+ for my $f (@files_to_check) {
+ if (-r "$::installerdir/tlpkg/translations/$f.po") {
+ $found = 1;
+ $::lang = $f;
+ last;
+ }
+ }
+ if (!$found) {
+ tlwarn ("\n Sorry, no translations available for $code (nor $::lang); falling back to English.
+ Make sure that you have the package \"texlive-msg-translations\" installed.
+ (If you'd like to help translate the installer's messages, please see
+ http://tug.org/texlive/doc.html#install-tl-xlate for information.)\n\n");
+ } else {
+ # merge the translated strings into the text string
+ open(LANG, "<$::installerdir/tlpkg/translations/$::lang.po");
+ my $msgid;
+ my $msgstr;
+ my $inmsgid;
+ my $inmsgstr;
+ while (<LANG>) {
+ chomp;
+ next if m/^\s*#/;
+ if (m/^\s*$/) {
+ if ($inmsgid) {
+ debug("msgid $msgid without msgstr in $::lang.po\n");
+ $inmsgid = 0;
+ $inmsgstr = 0;
+ $msgid = "";
+ $msgstr = "";
+ next;
+ }
+ if ($inmsgstr) {
+ if ($msgstr) {
+ if (!utf8::decode($msgstr)) {
+ warn("decoding string to utf8 didn't work: $msgstr\n");
+ }
+ # we decode msgid too to get \\ and not \
+ if (!utf8::decode($msgid)) {
+ warn("decoding string to utf8 didn't work: $msgid\n");
+ }
+ $TRANS{$::lang}{$msgid} = $msgstr;
+ } else {
+ ddebug("untranslated $::lang: ...$msgid...\n");
}
- $TRANS{$::lang}{$msgid} = $msgstr;
- } else {
- ddebug("untranslated $::lang: ...$msgid...\n");
+ $inmsgid = 0;
+ $inmsgstr = 0;
+ $msgid = "";
+ $msgstr = "";
+ next;
}
- $inmsgid = 0;
- $inmsgstr = 0;
- $msgid = "";
- $msgstr = "";
next;
}
- next;
- }
- if (m/^msgid\s+"(.*)"\s*$/) {
- if ($msgid) {
- warn("stray msgid line: $_");
+ if (m/^msgid\s+"(.*)"\s*$/) {
+ if ($msgid) {
+ warn("stray msgid line: $_");
+ next;
+ }
+ $inmsgid = 1;
+ $msgid = $1;
next;
}
- $inmsgid = 1;
- $msgid = $1;
- next;
- }
- if (m/^"(.*)"\s*$/) {
- if ($inmsgid) {
- $msgid .= $1;
- } elsif ($inmsgstr) {
- $msgstr .= $1;
- } else {
- tlwarn("cannot parse $::lang.po line: $_\n");
- }
- next;
- }
- if (m/^msgstr\s+"(.*)"\s*$/) {
- if (!$inmsgid) {
- tlwarn("msgstr $1 without msgid\n");
+ if (m/^"(.*)"\s*$/) {
+ if ($inmsgid) {
+ $msgid .= $1;
+ } elsif ($inmsgstr) {
+ $msgstr .= $1;
+ } else {
+ tlwarn("cannot parse $::lang.po line: $_\n");
+ }
next;
}
- $msgstr = $1;
- $inmsgstr = 1;
- $inmsgid = 0;
+ if (m/^msgstr\s+"(.*)"\s*$/) {
+ if (!$inmsgid) {
+ tlwarn("msgstr $1 without msgid\n");
+ next;
+ }
+ $msgstr = $1;
+ $inmsgstr = 1;
+ $inmsgid = 0;
+ }
}
+ close(LANG);
}
- close(LANG);
}
}
diff --git a/Master/tlpkg/installer/install-menu-perltk.pl b/Master/tlpkg/installer/install-menu-perltk.pl
index 50efab9ba22..230a6db0451 100644
--- a/Master/tlpkg/installer/install-menu-perltk.pl
+++ b/Master/tlpkg/installer/install-menu-perltk.pl
@@ -50,6 +50,7 @@ my $return = $MENU_INSTALL;
our $LANG;
our %TRANS;
require("TeXLive/trans.pl");
+load_translations();
$::fileassocdesc[0] = __("None");
$::fileassocdesc[1] = __("Only new");
diff --git a/Master/tlpkg/installer/install-menu-wizard.pl b/Master/tlpkg/installer/install-menu-wizard.pl
index e695303012c..44738c815b1 100644
--- a/Master/tlpkg/installer/install-menu-wizard.pl
+++ b/Master/tlpkg/installer/install-menu-wizard.pl
@@ -12,6 +12,7 @@ $svnrev =~ m/: ([0-9]+) /;
$::menurevision = $1;
require("TeXLive/trans.pl");
+load_translations();
#