From f069886919594fa7bd3ef4be9da9beb94e62e89f Mon Sep 17 00:00:00 2001 From: "wurblzap%gmail.com" <> Date: Mon, 31 Mar 2008 20:00:24 +0000 Subject: =?UTF-8?q?Bug=20425620=20=C3=A2=C2=80=C2=93=20checksetup.pl=20doe?= =?UTF-8?q?sn't=20pick=20up=20the=20user's=20language=20correctly.=20Patch?= =?UTF-8?q?=20by=20Marc=20Schumann=20;=20r=3DLpSolit;?= =?UTF-8?q?=20a=3DLpSolit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/Install/Util.pm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Install/Util.pm b/Bugzilla/Install/Util.pm index 5d873aee8..9aeeca486 100644 --- a/Bugzilla/Install/Util.pm +++ b/Bugzilla/Install/Util.pm @@ -295,7 +295,9 @@ sub _sort_accept_language { } sub get_console_locale { + require Locale::Language; my $locale = setlocale(LC_CTYPE); + my $language; # Some distros set e.g. LC_CTYPE = fr_CH.UTF-8. We clean it up. if ($locale =~ /^([^\.]+)/) { $locale = $1; @@ -304,8 +306,21 @@ sub get_console_locale { # It's pretty sure that there is no language pack of the form fr-CH # installed, so we also include fr as a wanted language. if ($locale =~ /^(\S+)\-/) { - $locale .= ",$1"; + $language = $1; + $locale .= ",$language"; } + else { + $language = $locale; + } + + # Some OSs or distributions may have setlocale return a string of the form + # German_Germany.1252 (this example taken from a Windows XP system), which + # is unsuitable for our needs because Bugzilla works on language codes. + # We try and convert them here. + if ($language = Locale::Language::language2code($language)) { + $locale .= ",$language"; + } + return $locale; } -- cgit v1.2.1