From 1db729772f0612c1810956632318cd79e190651b Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 10 Sep 2008 16:02:13 +0000 Subject: guess country from timezone when possible (#23303) --- perl-install/NEWS | 1 + perl-install/standalone/finish-install | 10 ++++++++++ 2 files changed, 11 insertions(+) (limited to 'perl-install') diff --git a/perl-install/NEWS b/perl-install/NEWS index b21a3f567..a4f34602b 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -6,6 +6,7 @@ - finish-install: o always ask timezone (#23303, #42368) o extract a "country" step out of the "language" one + o guess country from timezone when possible (#23303) o behave nicely when a window manager is running (for debugging) Version 11.38 - 8 September 2008 diff --git a/perl-install/standalone/finish-install b/perl-install/standalone/finish-install index f7d100201..b7d98ae3d 100755 --- a/perl-install/standalone/finish-install +++ b/perl-install/standalone/finish-install @@ -78,6 +78,16 @@ sub ask_timezone() { sub ask_country() { require lang; $locale ||= lang::read(); + require Time::ZoneInfo; + my $zones = Time::ZoneInfo->new; + if ($timezone && $zones) { + #- guess only if timezone has been asked already + if (my $zone = $zones->current_zone) { + if (my $country_code = $zones->country($zone)) { + $locale->{country} = $country_code; + } + } + } any::selectCountry($in, $locale); lang::write_and_install($locale, $in->do_pkgs); } -- cgit v1.2.1