29
use Bugzilla::Constants;
29
use Bugzilla::Constants;
31
use File::Basename;
31
use File::Basename;
32
use POSIX ();
32
use POSIX qw(setlocale LC_CTYPE);
33
use Safe;
33
use Safe;
35
use base qw(Exporter);
35
use base qw(Exporter);
40
install_string
40
install_string
41
template_include_path
41
template_include_path
45
sub bin_loc {
46
sub bin_loc {
168
# If we didn't want *any* of the languages we support, just use all
169
# of the languages we said we support, in the order they were specified.
170
# This is only done when you ask for a certain set of languages, because
171
# otherwise @supported just came off the disk in alphabetical order,
172
# and it could give you de (German) when you speak English.
173
# (If @supported came off the disk, we fall back on English if no language
174
# is available--that happens below.)
175
if (!@usedlanguages && $params->{use_languages}) {
176
@usedlanguages = @supported;
179
# We always include English at the bottom if it's not there, even if
169
# We always include English at the bottom if it's not there, even if
180
# somebody removed it from use_languages.
170
# somebody removed it from use_languages.
181
if (!grep($_ eq 'en', @usedlanguages)) {
171
if (!grep($_ eq 'en', @usedlanguages)) {
304
return map($_->{'language'}, (sort sortQvalue @qlanguages));
294
return map($_->{'language'}, (sort sortQvalue @qlanguages));
297
sub get_console_locale {
298
my $locale = setlocale(LC_CTYPE);
299
# Some distros set e.g. LC_CTYPE = fr_CH.UTF-8. We clean it up.
300
if ($locale =~ /^([^\.]+)/) {
304
# It's pretty sure that there is no language pack of the form fr-CH
305
# installed, so we also include fr as a wanted language.
306
if ($locale =~ /^(\S+)\-/) {
308
# This is like request_cache, but it's used only by installation code
313
# This is like request_cache, but it's used only by installation code
309
# for setup.cgi and things like that.
314
# for setup.cgi and things like that.
366
Returns a hash containing information about what version of Bugzilla we're
371
Returns a hash containing information about what version of Bugzilla we're
367
running, what perl version we're using, and what OS we're running on.
372
running, what perl version we're using, and what OS we're running on.
374
=item C<get_console_locale>
376
Returns the language to use based on the LC_CTYPE value returned by the OS.
377
If LC_CTYPE is of the form fr-CH, then fr is appended to the list.
369
=item C<indicate_progress>
379
=item C<indicate_progress>
47
use File::Basename;
47
use File::Basename;
48
use Getopt::Long qw(:config bundling);
48
use Getopt::Long qw(:config bundling);
49
use Pod::Usage;
49
use Pod::Usage;
50
use POSIX qw(setlocale LC_CTYPE);
51
use Safe;
50
use Safe;
53
BEGIN { chdir dirname($0); }
52
BEGIN { chdir dirname($0); }
54
use lib qw(. lib);
53
use lib qw(. lib);
55
use Bugzilla::Constants;
54
use Bugzilla::Constants;
56
use Bugzilla::Install::Requirements;
55
use Bugzilla::Install::Requirements;
57
use Bugzilla::Install::Util qw(install_string get_version_and_os);
56
use Bugzilla::Install::Util qw(install_string get_version_and_os get_console_locale);
59
######################################################################
58
######################################################################
60
# Live Code
59
# Live Code
63
# When we're running at the command line, we need to pick the right
62
# When we're running at the command line, we need to pick the right
64
# language before ever displaying any string.
63
# language before ever displaying any string.
65
$ENV{'HTTP_ACCEPT_LANGUAGE'} ||= setlocale(LC_CTYPE);
64
$ENV{'HTTP_ACCEPT_LANGUAGE'} ||= get_console_locale();
67
my %switch;
66
my %switch;
68
GetOptions(\%switch, 'help|h|?', 'check-modules', 'no-templates|t',
67
GetOptions(\%switch, 'help|h|?', 'check-modules', 'no-templates|t',