diff options
author | Thierry Vignaud <tv@mandriva.org> | 2010-01-27 17:25:29 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2010-01-27 17:25:29 +0000 |
commit | 4a5d39de7070bcfa6410ded1c642ceafd30d14b4 (patch) | |
tree | c544628072683915bb997be56d791085636bb853 /mdkapplet-extended-maintenance-helper | |
parent | 9f60ea5f2d9705531c501e0481bfde6fc3e24115 (diff) | |
download | mgaonline-4a5d39de7070bcfa6410ded1c642ceafd30d14b4.tar mgaonline-4a5d39de7070bcfa6410ded1c642ceafd30d14b4.tar.gz mgaonline-4a5d39de7070bcfa6410ded1c642ceafd30d14b4.tar.bz2 mgaonline-4a5d39de7070bcfa6410ded1c642ceafd30d14b4.tar.xz mgaonline-4a5d39de7070bcfa6410ded1c642ceafd30d14b4.zip |
(iso8601_date_to_locale) display localized dates
Diffstat (limited to 'mdkapplet-extended-maintenance-helper')
-rwxr-xr-x | mdkapplet-extended-maintenance-helper | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/mdkapplet-extended-maintenance-helper b/mdkapplet-extended-maintenance-helper index a4fecf70..ce61879a 100755 --- a/mdkapplet-extended-maintenance-helper +++ b/mdkapplet-extended-maintenance-helper @@ -25,6 +25,7 @@ use lib qw(/usr/lib/libDrakX /usr/lib/libDrakX/drakfirsttime); use standalone; # for explanations use common; use run_program; +use DateTime; BEGIN { unshift @::textdomains, 'mdkonline' } @@ -71,6 +72,17 @@ sub get_extended_maintenance_data() { @$current_apimdv_distro{qw(extended-maintenance extended-maintenance-end desktop-update-end basic-update-end)}; } +sub iso8601_date_to_locale { + my ($date) = @_; + return $date if $date !~ /(\d\d\d\d)-?(\d\d)-?(\d\d)/; + my $dt = DateTime->new(year => $1, month => $2, day => $3); + my $date1 = $dt->strftime("%x"); + # will fail on some locales (eg: br_FR, ...): + eval { $dt->set_locale($ENV{LC_TIME}) }; + my $date2 = $dt->strftime("%x"); + $date2 || $date1; +} + sub get_extmaint_authentication() { my $w = ugtk2->new(N("Adding an additional package medium"), width => $width + 20); my ($password_w, $email_w, $password); @@ -102,8 +114,12 @@ sub get_extmaint_authentication() { gtknew('Label_Left', text_markup => join("\n\n", - N("Mandriva provides 12 months of desktop updates (%s) and 18 months of base updates (%s) for distributions.", $desktop_update_end, $basic_update_end), - N("Extended maintenance is now available to get 18 months of additional updates (%s).", $extended_maintenance_end), + #-PO: Here '%s' will be a localized date (eg: "2009/11/28" in english but "28/11/2009" for brazil or "28 Nov. "2009" for french: + N("Mandriva provides 12 months of desktop updates (up to the %s) and 18 months of base updates (up to the %s) for distributions.", + iso8601_date_to_locale($desktop_update_end), + iso8601_date_to_locale($basic_update_end)), + N("Extended maintenance is now available to get 18 months of additional updates (up to the %s).", + iso8601_date_to_locale($extended_maintenance_end)), N("You can subscribe <b>right now</b> to get extended maintenance:"), ), @common), |