From 4db0480ffc03a2695640c23cf7a6aedf8fe9fd4c Mon Sep 17 00:00:00 2001 From: Stefan Siegel Date: Sat, 18 Aug 2001 19:33:10 +0000 Subject: - made UTF8 compliant i18n - fixed timezone bug (Abort in Timezone requester) --- clock.pm | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'clock.pm') diff --git a/clock.pm b/clock.pm index 393479bf..cd8a08ee 100755 --- a/clock.pm +++ b/clock.pm @@ -8,17 +8,23 @@ use standalone; use timezone; init Gtk; #use strict; -use Locale::GetText; use MDK::Common; -setlocale (LC_ALL, ""); -Locale::GetText::textdomain ("DrakConf"); -import Locale::GetText I_; +#------------------------------------------------------------- +# i18n routines +# IMPORTANT: next two routines have to be redefined here to +# get correct namespace (drakconf instead of libDrakX) +# (This version is now UTF8 compliant - Sg 2001-08-18) +#------------------------------------------------------------- + sub _ { - my $s = shift @_; my $t = I_($s); - $t && ref $t or return sprintf $t, @_; - my ($T, @p) = @$t; - sprintf $T, @_[@p]; + my $s = shift @_; my $t = translate($s); + sprintf $t, @_; +} + +sub translate { + my ($s) = @_; + $s ? c::dgettext('drakconf', $s) : ''; } $::isEmbedded = ($::XID, $::CCPID) = "@ARGV" =~ /--embedded (\w+) (\w+)/; @@ -55,9 +61,14 @@ $button_time->signal_connect ( clicked => sub { local $::isEmbedded = 0; $in->{timezone}={}; add2hash($in->{timezone}, { timezone::read('') }); - $in->{timezone}{timezone} = $in->ask_from_treelist('', _("Which is your timezone?"), '/', [ timezone::getTimeZones('') ], $in->{timezone}{timezone}); - $in->{timezone}{UTC} = $in->ask_yesorno('', _("Is your hardware clock set to GMT?"), $in->{timezone}{UTC}); - timezone::write('', $in->{timezone}); + my $timezone = $in->{timezone}{timezone}; + $in->{timezone}{timezone} = $in->ask_from_treelist('', _("Which is your timezone?"), '/', [ timezone::getTimeZones('') ], $timezone); + if( defined($in->{timezone}{timezone}) ){ + $in->{timezone}{UTC} = $in->ask_yesorno('', _("Is your hardware clock set to GMT?"), $in->{timezone}{UTC}); + timezone::write('', $in->{timezone}); + } else { + $in->{timezone}{timezone} = $timezone; + } }); my $vbox2 = new Gtk::VBox(0,0); $hbox->pack_start($vbox2, 1, 1, 0); -- cgit v1.2.1