From 38586be09f95da0c9ca046da6a2edcd28a52b2cc Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Fri, 11 Dec 2015 10:59:18 +0100 Subject: [PATCH] Bug 15206 - Make string translatable and fix months calculation --- .../intranet-tmpl/prog/en/modules/members/memberentrygen.tt | 8 ++++---- members/moremember.pl | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 6ca7570..4b5e2a3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -154,7 +154,7 @@ var dob = new Date($("#dateofbirth").datepicker( 'getDate' )); var year = dob.getFullYear(); - var month = dob.getMonth(); + var month = dob.getMonth() + 1; var day = dob.getDate(); $.ajax({ @@ -163,9 +163,9 @@ data: 'dateofbirth=' + year + '-' + month + '-' + day, dataType: 'json', success : function(json, statut){ - var age_string = "Age: "; - if (json.years) { age_string += json.years + " year(s) "; } - if (json.months) { age_string += json.months + " month(s) "; } + var age_string = _('Age: '); + if (json.years) { age_string += json.years + _(' year(s) '); } + if (json.months) { age_string += json.months + _(' month(s)'); } var elem = $("#dateofbirth").siblings(".hint").first().html(age_string); }, }); diff --git a/members/moremember.pl b/members/moremember.pl index 9066993..7b43097 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -61,6 +61,7 @@ if ( C4::Context->preference('NorwegianPatronDBEnable') && C4::Context->preferen use DateTime; use Koha::DateUtils; use Koha::Database; +use Koha::I18N; use vars qw($debug); @@ -141,8 +142,8 @@ $data->{'IS_ADULT'} = ( $data->{'categorycode'} ne 'I' ); my @age; my ($years, $months) = GetAge($data->{dateofbirth}); -push @age, "$years year(s)" if $years; -push @age, "$months month(s)" if $months; +push @age, $years . gettext(' year(s)') if $years; +push @age, $months . gettext(' month(s)') if $months; $template->param( age => join(', ', @age) ); for (qw(gonenoaddress lost borrowernotes)) { -- 1.7.10.4