summaryrefslogtreecommitdiff
path: root/Master/tlpkg/installer/install-translations.pl
blob: 6dcaf87c9be0c2260fa41a3e23d9d78a21a238e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/usr/bin/env perl
# $Id$
#
# Copyright 2009 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
#

use strict;
$^W = 1;

use utf8;
no utf8;

if (defined($::opt_lang)) {
  $::lang = $::opt_lang;
  if ($::lang eq "zh") {
    # set language to simplified chinese
    $::lang = "zh-cn";
  }
} else {
  if ($^O =~ /^MSWin(32|64)$/i) {
    # trying to deduce automatically the country code
    my $foo =  TeXLive::TLWinGoo::reg_country();
    if ($foo) {
      $::lang = $foo;
    } else {
      debug("Didn't get any usuful code from reg_country: $foo...\n");
    }
  } else {
    # we load POSIX and locale stuff
    require POSIX;
    import POSIX qw/locale_h/;
    # now we try to deduce $::lang
    my $loc = setlocale(&POSIX::LC_MESSAGES);
    my ($lang,$area,$codeset);
    if ($loc =~ m/^([^_.]*)(_([^.]*))?(\.([^@]*))?(@.*)?$/) {
      $lang = defined($1)?$1:"";
      $area = defined($3)?$3:"";
      if ($lang eq "zh") {
        if ($area =~ m/^(TW|HK)$/i) {
          $lang = "zh-tw";
        } else {
          # fallback to zh-cn for anything else, that is
          # zh-cn, zh-sg, zh, and maybe something else
          $lang = "zh-cn";
        }
      }
    }
    $::lang = $lang if ($lang);
  }
}


our %text = (title      => 'TeX Live 2008 Installation',
             basicinfo  => 'Basic Information',
             custom     => 'Further Customization',
             dirsetup   => "Directory setup",
             options    => 'Options',
             sysint     => 'System Integration',
             change     => 'Change',
             toggle     => 'Toggle',
             install    => 'Install TeX Live',
             finbut     => 'Finish',
             quit       => 'Quit',
             ok         => 'Ok',
             cancel     => 'Cancel',
             status     => 'Status output',
             changevar  => 'Change variable value',
             enterpath  => 'Enter path for',
             hinthome   => '(use ~ for %%%)',
             selectscheme => 'Select a scheme',
             selectstdcol => 'Select the collections to be installed',
             selectall  => 'Select All',
             selectnone => 'Deselect All',
             selectlang => 'Select language support',
             selectdoc  => 'Select language-specific documentation',
             createsym  => 'create symlinks in standard directories',
             binto      => 'binaries to',
             manto      => 'manpages to',
             infoto     => 'info to',
             selectsys  => 'Select arch-os',
             outof      => 'out of',
             collof     => 'collections out of',
             diskreq    => 'disk space required',
             yes        => 'Yes',
             no         => 'No',
             notwritable => '(default not writable - please change!)',
             changetexdir => '(please change TEXDIR first!)',
             nolangcol  => '(no language collection selected!)',
             finished   => 'See TEXDIR/index.html for links to documentation.\nThe TeX Live web site (http://tug.org/texlive/) contains any updates and corrections. TeX Live is a joint project of the TeX user groups around the world; please consider supporting it by joining the group best for you. The list of groups is available on the web at http://tug.org/usergroups.html.',
             finishedpath => 'Add TEXDIR/texmf/doc/man to MANPATH.\nAdd TEXDIR/texmf/doc/info to INFOPATH.\nMost importantly, add TEXDIR/bin/PLATFORM\nto your PATH for current and future sessions.',
             welcome => 'Welcome to TeX Live!',
             next       => 'Next >',
             prev       => '< Back',
             wizhello   => "Welcome to the installation of TeX Live 2008\nhttp://tug.org/texlive\n\nThis wizard will guide you through the installation.",
             destfolder => 'Destination folder:',
             advcustom  => 'Advanced customization',
             pathinfo   => "The destination folder will contain the installation.\nIt is strongly recommended to keep the year as the last component.",
             readyinst  => "We are ready to install TeX Live 2008.\nThe following settings will be used.\nIf you want to change something please go back,\notherwise press the \"Install\" button.",
             instshort  => 'Install',
             wizard     => 'Go to Wizard',
    );


our %labels = (binsys   => 'Binary System(s)',
               scheme   => 'Selected Scheme',
               stdcoll  => 'Standard Collections',
               langcoll => 'Language Collections',
               texdir   => 'TEXDIR (the main TeX directory)',
               localdir => 'TEXMFLOCAL (directory for site-wide local files)',
               sysvardir   => 'TEXMFSYSVAR (directory for autogenerated data)',
               sysconfigdir   => 'TEXMFSYSCONFIG (directory for local config)',
               texmfhome => 'TEXMFHOME (directory for user-specific files)',
               optletter => 'Use letter size instead of A4 by default',
               optfmt   => 'Create all format files',
               optdoc   =>  'Install font/macro doc tree',
               optsrc   =>  'Install font/macro source tree',
               symlink  =>  'Create symlinks in system directories',
    );

if (($::lang ne "en") && ($::lang ne "C")) {
  if (! -r "$::installerdir/tlpkg/installer/lang/perltk-$::lang") {
    tlwarn ("\n  Sorry, no translations available for $::lang; falling back to English.
  (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/installer/lang/perltk-$::lang");
    my %trans;
    while (<LANG>) {
      chomp;
      next if m/^\s*#/;
      next if m/^\s*$/;
      my ($a,$b) = split(/:/,$_,2);
      $b =~ s/^\s*([^\s])/$1/;
      $b =~ s/\s*$//;
      if (!utf8::decode($b)) {
        warn("decoding string to utf8 didn't work:$b\n");
      }
      $b =~ s/\\n/\n/g;
      $trans{"$a"} = "$b";
    }
    close(LANG);
    foreach my $k (keys %text) {
      $text{$k} = $trans{"text.$k"} if defined($trans{"text.$k"});
    }
    foreach my $k (keys %labels) {
      $labels{$k} = $trans{"label.$k"} if defined($trans{"label.$k"});
    }
  }
}


1;

__END__

### Local Variables:
### perl-indent-level: 2
### tab-width: 2
### indent-tabs-mode: nil
### End:
# vim:set tabstop=2 expandtab: #