summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2012-07-22 21:59:54 +0000
committerNorbert Preining <preining@logic.at>2012-07-22 21:59:54 +0000
commit6fd75aabad83fbb48ec147ceff36a609f6e1e6ba (patch)
tree19c507e5737860af47ec4b72003e74de7a029d60 /Master/tlpkg/TeXLive
parentf13e525cc31fd282071ff7cab385ebd0c2444332 (diff)
standardization of .po file naming - step 1: make trans.pl read
all possible combinations of language and area: ll_AA, ll-AA, ll_aa, ll-aa git-svn-id: svn://tug.org/texlive/trunk@27095 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive')
-rw-r--r--Master/tlpkg/TeXLive/trans.pl45
1 files changed, 25 insertions, 20 deletions
diff --git a/Master/tlpkg/TeXLive/trans.pl b/Master/tlpkg/TeXLive/trans.pl
index 96545fad5b4..75fc68fd1ce 100644
--- a/Master/tlpkg/TeXLive/trans.pl
+++ b/Master/tlpkg/TeXLive/trans.pl
@@ -27,7 +27,7 @@ if (defined($::opt_lang)) {
$::lang = $::opt_lang;
if ($::lang eq "zh") {
# set language to simplified chinese
- $::lang = "zh-cn";
+ $::lang = "zh_CN";
}
} else {
if ($^O =~ /^MSWin(32|64)$/i) {
@@ -35,7 +35,7 @@ if (defined($::opt_lang)) {
my ($lang, $area) = TeXLive::TLWinGoo::reg_country();
if ($lang) {
$::lang = $lang;
- $::area = $area;
+ $::area = uc($area);
} else {
debug("Didn't get any usuful code from reg_country.\n");
}
@@ -49,16 +49,16 @@ if (defined($::opt_lang)) {
if ($loc =~ m/^([^_.]*)(_([^.]*))?(\.([^@]*))?(@.*)?$/) {
$lang = defined($1)?$1:"";
# lower case the area code
- $area = defined($3)?lc($3):"";
+ $area = defined($3)?uc($3):"";
if ($lang eq "zh") {
if ($area =~ m/^(TW|HK)$/i) {
$lang = "zh";
- $area = "tw";
+ $area = "TW";
} else {
# fallback to zh-cn for anything else, that is
# zh-cn, zh-sg, zh, and maybe something else
$lang = "zh";
- $area = "cn";
+ $area = "CN";
}
}
}
@@ -106,25 +106,30 @@ sub __ ($@) {
if (($::lang ne "en") && ($::lang ne "C")) {
my $code = $::lang;
- $code .= "_$::area" if defined($::area);
- my $found = 0;
- if (-r "$::installerdir/tlpkg/translations/$code.po") {
- $found = 1;
- # set $::lang to the actually used one
- $::lang = $code;
+ 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 {
- # retry without area code
- if (! -r "$::installerdir/tlpkg/translations/$::lang.po") {
- 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 {
- debug ("translation: falling back to $::lang, not available: $code\n");
+ 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;
}
}
- if ($found) {
+ 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;