From 170aa1e8078280e7c03a6ebfc67280de66fa1b9d Mon Sep 17 00:00:00 2001 From: levinse Date: Mon, 16 May 2011 18:48:25 +0000 Subject: [PATCH] internationalization/localization, RT12515 --- httemplate/view/cust_main/payment_history.html | 28 +++++++++++ .../payment_history/attempted_payment.html | 14 ++---- .../view/cust_main/payment_history/credit.html | 34 ++++++------- .../view/cust_main/payment_history/invoice.html | 17 +++---- .../view/cust_main/payment_history/payment.html | 58 ++++++++++------------ .../cust_main/payment_history/pending_payment.html | 18 ++----- .../view/cust_main/payment_history/refund.html | 25 ++++------ .../cust_main/payment_history/voided_payment.html | 22 +++----- 8 files changed, 104 insertions(+), 112 deletions(-) diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html index 732e417db..e561c703e 100644 --- a/httemplate/view/cust_main/payment_history.html +++ b/httemplate/view/cust_main/payment_history.html @@ -450,4 +450,32 @@ foreach my $cust_refund ($cust_main->cust_refund) { } +sub translate_payby { + my ($payby,$payinfo) = (shift,shift); + my %payby = ( + BILL => $payinfo ? mt('Check #') : '', + CHEK => mt('Electronic check '), + PREP => mt('Prepaid card '), + CARD => mt('Credit card #'), + COMP => mt('Complimentary by '), + CASH => mt('Cash'), + WEST => mt('Western Union'), + MCRD => mt('Manual credit card'), + ); + $payby = (exists $payby{$payby}) ? $payby{$payby} : $payby; + $payby; +}; + +sub translate_payby_refund { + my ($payby,$payinfo) = (shift,shift); + my %payby = ( + BILL => $payinfo ? mt('Check #') : mt('Check'), + CHEK => mt('Electronic check '), + CARD => 'CARD ', + COMP => 'COMP ', + ); + $payby = (exists $payby{$payby}) ? $payby{$payby} : $payby; + $payby; +}; + diff --git a/httemplate/view/cust_main/payment_history/attempted_payment.html b/httemplate/view/cust_main/payment_history/attempted_payment.html index 554aa737d..1a705b7f8 100644 --- a/httemplate/view/cust_main/payment_history/attempted_payment.html +++ b/httemplate/view/cust_main/payment_history/attempted_payment.html @@ -1,4 +1,4 @@ -Payment attempt <% $info |h %> +<% mt('Payment attempt') |h %> <% $info |h %> <%init> my( $cust_pay_pending, %opt ) = @_; @@ -14,20 +14,12 @@ if ( $payby eq 'CARD' ) { $payinfo = $cust_pay_pending->paymask; } elsif ( $payby eq 'CHEK' ) { my( $account, $aba ) = split('@', $cust_pay_pending->paymask ); - $payinfo = "ABA $aba, Acct #$account"; + $payinfo = mt("ABA [_1], Acct #[_2]",$aba,$account); } else { $payinfo = $cust_pay_pending->payinfo; } -$payby =~ s/^BILL$/Check #/ if $payinfo; -$payby =~ s/^CHEK$/Electronic check /; -$payby =~ s/^PREP$/Prepaid card /; -$payby =~ s/^CARD$/Credit card #/; -$payby =~ s/^COMP$/Complimentary by /; -$payby =~ s/^CASH$/Cash/; -$payby =~ s/^WEST$/Western Union/; -$payby =~ s/^MCRD$/Manual credit card/; -$payby =~ s/^BILL$//; +$payby = translate_payby($payby,$payinfo); my $info = $payby ? "($payby$payinfo)" : ''; if ( $opt{'pkg-balances'} && $cust_pay_pending->pkgnum ) { diff --git a/httemplate/view/cust_main/payment_history/credit.html b/httemplate/view/cust_main/payment_history/credit.html index 75038cc56..ae388eb54 100644 --- a/httemplate/view/cust_main/payment_history/credit.html +++ b/httemplate/view/cust_main/payment_history/credit.html @@ -1,5 +1,5 @@ -<% $pre %>Credit<% $post %> -by <% $cust_credit->otaker %><% "$reason$desc$apply$delete$unapply" %> +<% $credit %> +<% "$reason$desc$apply$delete$unapply" %> <%init> my( $cust_credit, %opt ) = @_; @@ -25,20 +25,22 @@ if ($conf->exists('cust_credit_bill_pkg-manual')) { %cust_credit_bill_height = ('height' => 436); } -my( $pre, $post, $apply, $ext ) = ( '', '', '', '' ); +my( $apply, $ext ) = ( '', '', '', '' ); +my $credit = mt("Credit by [_1]", $cust_credit->otaker ); if ( scalar(@cust_credit_bill) == 0 && scalar(@cust_credit_refund) == 0 ) { #completely unapplied - $pre = 'Unapplied '; - $post = ''; + $credit = '' + . mt("Unapplied Credit by [_1]", $cust_credit->otaker ) + . ''; if ( $curuser->access_right('Apply credit') ) { if ( $cust_credit->cust_main->total_owed > 0 ) { $apply = ' ('. include( '/elements/popup_link.html', - 'label' => 'apply', + 'label' => mt('apply'), 'action' => "${p}edit/cust_credit_bill.cgi?". $cust_credit->crednum, - 'actionlabel' => 'Apply credit', + 'actionlabel' => mt('Apply credit'), %cust_credit_bill_width, %cust_credit_bill_height, ). @@ -47,12 +49,11 @@ if ( scalar(@cust_credit_bill) == 0 if ( $cust_credit->cust_main->total_unapplied_refunds > 0 ) { $apply.= ' ('. include( '/elements/popup_link.html', - 'label' => 'apply to refund', + 'label' => mt('apply to refund'), 'action' => "${p}edit/cust_credit_refund.cgi?". $cust_credit->crednum, - 'actionlabel' => 'Apply credit to refund', + 'actionlabel' => mt('Apply credit to refund'), 'width' => 392, - #default# 'height' => 336, ). ')'; } @@ -66,7 +67,7 @@ if ( scalar(@cust_credit_bill) == 0 && scalar(@cust_credit_refund) == 1 && $cust_credit->credited == 0 ) { #applied to one refund - $desc .= ' refunded on '. time2str($date_format, $cust_credit_refund[0]->_date); + $desc .= mt(" refunded on [_1]", time2str($date_format, $cust_credit_refund[0]->_date) ); } else { #complicated $desc .= '
'; @@ -81,7 +82,7 @@ if ( scalar(@cust_credit_bill) == 0 } elsif ( $app->isa('FS::cust_credit_refund') ) { $desc .= '  '. '$'. $app->amount. - ' refunded on '. time2str($date_format, $app->_date). + mt(" refunded on [_1]", time2str($date_format, $app->_date) ). '
'; } else { die "$app is not a FS::cust_credit_bill or a FS::cust_credit_refund"; @@ -94,10 +95,10 @@ if ( scalar(@cust_credit_bill) == 0 if ( $cust_credit->cust_main->total_owed > 0 ) { $apply = ' ('. include( '/elements/popup_link.html', - 'label' => 'apply', + 'label' => mt('apply'), 'action' => "${p}edit/cust_credit_bill.cgi?". $cust_credit->crednum, - 'actionlabel' => 'Apply credit', + 'actionlabel' => mt('Apply credit'), %cust_credit_bill_width, %cust_credit_bill_height, ). @@ -106,12 +107,11 @@ if ( scalar(@cust_credit_bill) == 0 if ( $cust_credit->cust_main->total_unapplied_refunds > 0 ) { $apply.= ' ('. include( '/elements/popup_link.html', - 'label' => 'apply to refund', + 'label' => mt('apply to refund'), 'action' => "${p}edit/cust_credit_refund.cgi?". $cust_credit->crednum, - 'actionlabel' => 'Apply credit to refund', + 'actionlabel' => mt('Apply credit to refund'), 'width' => 392, - #default# 'height' => 336, ). ')'; } diff --git a/httemplate/view/cust_main/payment_history/invoice.html b/httemplate/view/cust_main/payment_history/invoice.html index c0d32df4d..fe14d3e54 100644 --- a/httemplate/view/cust_main/payment_history/invoice.html +++ b/httemplate/view/cust_main/payment_history/invoice.html @@ -1,5 +1,4 @@ -<% $link %><% $pre %>Invoice #<% $cust_bill->display_invnum %> -(Balance $ <% $cust_bill->owed %>)<% $post %><% $link ? '' : '' %><% $delete %><% $events %> +<% $link %><% $invoice %><% $link ? '' : '' %><% $delete %><% $events %> <%init> my( $cust_bill, %opt ) = @_; @@ -8,11 +7,11 @@ my $conf = new FS::Conf; my $curuser = $FS::CurrentUser::CurrentUser; -my($pre, $post) = ('', ''); -if ( $cust_bill->owed > 0 ) { - $pre = 'Open '; - $post = ''; -} +my $invoice = mt("Invoice #[_1] (Balance [_2])",$cust_bill->display_invnum,$cust_bill->owed); +$invoice = '' . + mt("Open Invoice #[_1] (Balance [_2])",$cust_bill->display_invnum,$cust_bill->owed) . + '' +if ( $cust_bill->owed > 0 ); my $invnum = $cust_bill->invnum; @@ -26,7 +25,7 @@ if ( $opt{'deleteinvoices'} && $curuser->access_right('Delete invoices') ) { qq!${p}misc/delete-cust_bill.html?$invnum',!. qq!'Are you sure you want to delete this invoice?')"!. qq! TITLE="Delete this invoice from the database completely"!. - qq!>delete)!; + mt('delete') . ')'; } my $events = ''; @@ -38,7 +37,7 @@ if ( $cust_bill->num_cust_event ) { $events = qq!
( View invoice events )'; + '">( '.mt('View invoice events').' )'; } # diff --git a/httemplate/view/cust_main/payment_history/payment.html b/httemplate/view/cust_main/payment_history/payment.html index e745864b7..61486518e 100644 --- a/httemplate/view/cust_main/payment_history/payment.html +++ b/httemplate/view/cust_main/payment_history/payment.html @@ -1,4 +1,4 @@ -<% $pre %>Payment<% $post %> by <% $otaker %> +<% $payment %> <% "$info$desc$view$apply$refund$void$delete$unapply" %> <%init> @@ -16,7 +16,7 @@ if ( $payby eq 'CARD' ) { $payinfo = $cust_pay->paymask; } elsif ( $payby eq 'CHEK' ) { my( $account, $aba ) = split('@', $cust_pay->paymask ); - $payinfo = "ABA $aba, Acct #$account"; + $payinfo = mt("ABA [_1], Acct #[_2]",$aba,$account); } else { $payinfo = $cust_pay->payinfo; } @@ -24,15 +24,7 @@ my @cust_bill_pay = $cust_pay->cust_bill_pay; my @cust_pay_refund = $cust_pay->cust_pay_refund; my $target = "$payby$payinfo"; -$payby =~ s/^BILL$/Check #/ if $payinfo; -$payby =~ s/^CHEK$/Electronic check /; -$payby =~ s/^PREP$/Prepaid card /; -$payby =~ s/^CARD$/Credit card #/; -$payby =~ s/^COMP$/Complimentary by /; -$payby =~ s/^CASH$/Cash/; -$payby =~ s/^WEST$/Western Union/; -$payby =~ s/^MCRD$/Manual credit card/; -$payby =~ s/^BILL$//; +$payby = translate_payby($payby,$payinfo); my $info = $payby ? "($payby$payinfo)" : ''; my $desc = ''; @@ -48,20 +40,28 @@ if ($conf->exists('cust_bill_pay_pkg-manual')) { %cust_bill_pay_height = ('height' => 436); } -my( $pre, $post, $apply, $ext ) = ( '', '', '', '' ); +my( $apply, $ext ) = ( '', '', '', '' ); + +my $otaker = $cust_pay->otaker; +$otaker = 'auto billing' if $otaker eq 'fs_daily'; +$otaker = 'customer self-service' if $otaker eq 'fs_selfservice'; + +my $payment = mt("Payment by [_1]",$otaker); + if ( scalar(@cust_bill_pay) == 0 && scalar(@cust_pay_refund) == 0 ) { #completely unapplied - $pre = 'Unapplied '; - $post = ''; + $payment = '' + . mt("Unapplied Payment by [_1]",$otaker) + . ''; if ( $curuser->access_right('Apply payment') ) { if ( $cust_pay->cust_main->total_owed > 0 ) { $apply = ' ('. include( '/elements/popup_link.html', - 'label' => 'apply', + 'label' => mt('apply'), 'action' => "${p}edit/cust_bill_pay.cgi?". $cust_pay->paynum, - 'actionlabel' => 'Apply payment', + 'actionlabel' => mt('Apply payment'), %cust_bill_pay_width, %cust_bill_pay_height, ). @@ -70,12 +70,11 @@ if ( scalar(@cust_bill_pay) == 0 if ( $cust_pay->cust_main->total_unapplied_refunds > 0 ) { $apply.= ' ('. include( '/elements/popup_link.html', - 'label' => 'apply to refund', + 'label' => mt('apply to refund'), 'action' => "${p}edit/cust_pay_refund.cgi?". $cust_pay->paynum, - 'actionlabel' => 'Apply payment to refund', + 'actionlabel' => mt('Apply payment to refund'), 'width' => 392, - #default# 'height' => 336, ). ')'; } @@ -89,7 +88,7 @@ if ( scalar(@cust_bill_pay) == 0 && scalar(@cust_pay_refund) == 1 && $cust_pay->unapplied == 0 ) { #applied to one refund - $desc .= ' refunded on '. time2str($date_format, $cust_pay_refund[0]->_date); + $desc .= mt(" refunded on [_1]", time2str($date_format, $cust_pay_refund[0]->_date) ); } else { #complicated $desc .= '
'; @@ -104,7 +103,7 @@ if ( scalar(@cust_bill_pay) == 0 } elsif ( $app->isa('FS::cust_pay_refund') ) { $desc .= '  '. '$'. $app->amount. - ' refunded on '. time2str($date_format, $app->_date). + mt(" refunded on [_1]", time2str($date_format, $app->_date) ) . '
'; } else { die "$app is not a FS::cust_bill_pay or FS::cust_pay_refund"; @@ -118,10 +117,10 @@ if ( scalar(@cust_bill_pay) == 0 if ( $cust_pay->cust_main->total_owed > 0 ) { $apply = ' ('. include( '/elements/popup_link.html', - 'label' => 'apply', + 'label' => mt('apply'), 'action' => "${p}edit/cust_bill_pay.cgi?". $cust_pay->paynum, - 'actionlabel' => 'Apply payment', + 'actionlabel' => mt('Apply payment'), %cust_bill_pay_width, %cust_bill_pay_height, ). @@ -130,12 +129,11 @@ if ( scalar(@cust_bill_pay) == 0 if ( $cust_pay->cust_main->total_unapplied_refunds > 0 ) { $apply.= ' ('. include( '/elements/popup_link.html', - 'label' => 'apply to refund', + 'label' => mt('apply to refund'), 'action' => "${p}edit/cust_pay_refund.cgi?". $cust_pay->paynum, - 'actionlabel' => 'Apply payment to refund', + 'actionlabel' => mt('Apply payment to refund'), 'width' => 392, - #default# 'height' => 336, ). ')'; } @@ -146,10 +144,10 @@ if ( scalar(@cust_bill_pay) == 0 my $view = ' ('. include('/elements/popup_link.html', - 'label' => 'view receipt', + 'label' => mt('view receipt'), 'action' => "${p}view/cust_pay.html?link=popup;paynum=". $cust_pay->paynum, - 'actionlabel' => 'Payment Receipt', + 'actionlabel' => mt('Payment Receipt'), ). ')'; @@ -221,8 +219,4 @@ if ( $cust_pay->closed !~ /^Y/i qq!>unapply)!; } -my $otaker = $cust_pay->otaker; -$otaker = 'auto billing' if $otaker eq 'fs_daily'; -$otaker = 'customer self-service' if $otaker eq 'fs_selfservice'; - diff --git a/httemplate/view/cust_main/payment_history/pending_payment.html b/httemplate/view/cust_main/payment_history/pending_payment.html index 7d21f899f..3da5a6229 100644 --- a/httemplate/view/cust_main/payment_history/pending_payment.html +++ b/httemplate/view/cust_main/payment_history/pending_payment.html @@ -1,4 +1,4 @@ -Pending payment <% "$info $status ($link)" %> +<% mt('Pending payment') |h %> <% "$info $status ($link)" %> <%init> my( $cust_pay_pending, %opt ) = @_; @@ -14,21 +14,13 @@ if ( $payby eq 'CARD' ) { $payinfo = $cust_pay_pending->paymask; } elsif ( $payby eq 'CHEK' ) { my( $account, $aba ) = split('@', $cust_pay_pending->paymask ); - $payinfo = "ABA $aba, Acct #$account"; + $payinfo = mt("ABA [_1], Acct #[_2]",$aba,$account); } else { $payinfo = $cust_pay_pending->payinfo; } my $target = "$payby$payinfo"; -$payby =~ s/^BILL$/Check #/ if $payinfo; -$payby =~ s/^CHEK$/Electronic check /; -$payby =~ s/^PREP$/Prepaid card /; -$payby =~ s/^CARD$/Credit card #/; -$payby =~ s/^COMP$/Complimentary by /; -$payby =~ s/^CASH$/Cash/; -$payby =~ s/^WEST$/Western Union/; -$payby =~ s/^MCRD$/Manual credit card/; -$payby =~ s/^BILL$//; +$payby = translate_payby($payby,$payinfo); my $info = $payby ? "($payby$payinfo)" : ''; my %statusaction = ( @@ -51,11 +43,11 @@ if ( $action && $edit_pending ) { 'action' => $p. 'edit/cust_pay_pending.html'. '?paypendingnum='. $cust_pay_pending->paypendingnum. ";action=$action", - 'label' => $action, + 'label' => mt($action), 'color' => '#ff0000', 'width' => 655, 'height' => ( $action eq 'delete' ? 480 : 575 ), - 'actionlabel' => ucfirst($action). ' pending payment', + 'actionlabel' => mt(ucfirst($action). ' pending payment'), ); } diff --git a/httemplate/view/cust_main/payment_history/refund.html b/httemplate/view/cust_main/payment_history/refund.html index 4a48fea1e..154525d54 100644 --- a/httemplate/view/cust_main/payment_history/refund.html +++ b/httemplate/view/cust_main/payment_history/refund.html @@ -1,6 +1,6 @@ -<% $pre %>Refund<% $post %> +<% $refund %> (<% $payby. $payinfo %>) -by <% $cust_refund->otaker %><% $view %><% $delete %> +<% mt('by') |h %> <% $cust_refund->otaker %><% $view %><% $delete %> <%init> my( $cust_refund, %opt ) = @_; @@ -12,23 +12,18 @@ my $payinfo = $payby eq 'CARD' ? $cust_refund->paymask : $cust_refund->payinfo; -$payby =~ s/^BILL$/Check #/ if $payinfo; -$payby =~ s/^BILL$/Check/; -$payby =~ s/^CHEK$/Electronic check /; -$payby =~ s/^(CARD|COMP)$/$1 /; +$payby = translate_payby_refund($payby,$payinfo); -my($pre, $post) = ('', ''); -if ( $cust_refund->unapplied > 0 ) { - $pre = 'Unapplied '; - $post = ''; -} +my $refund = mt('Refund'); +$refund = '' . mt('Unapplied Refund') . '' + if $cust_refund->unapplied > 0; my $view = ' ('. include('/elements/popup_link.html', - 'label' => 'view receipt', + 'label' => mt('view receipt'), 'action' => "${p}view/cust_refund.html?link=popup;". 'refundnum='. $cust_refund->refundnum, - 'actionlabel' => 'Payment Receipt', + 'actionlabel' => mt('Payment Receipt'), ). ')'; @@ -42,8 +37,8 @@ if ( $cust_refund->closed !~ /^Y/i $delete = qq! (delete)!; + qq! TITLE="!.mt('Delete this refund from the database completely - not recommended'). + ">".mt('delete').")"; } diff --git a/httemplate/view/cust_main/payment_history/voided_payment.html b/httemplate/view/cust_main/payment_history/voided_payment.html index 5d7f60cf5..0a8cd1077 100644 --- a/httemplate/view/cust_main/payment_history/voided_payment.html +++ b/httemplate/view/cust_main/payment_history/voided_payment.html @@ -1,5 +1,5 @@ -Payment <% $info %> by <% $cust_pay_void->otaker %> -voided <% time2str($date_format, $cust_pay_void->void_date) %> +<% mt("Payment [_1] by [_2]", $info, $cust_pay_void->otaker ) |h %> +<% mt("voided [_1]", time2str($date_format, $cust_pay_void->void_date) ) |h %> % my $void_user = $cust_pay_void->void_access_user; % if ($void_user) { by <% $void_user->username %> @@ -20,20 +20,12 @@ if ( $payby eq 'CARD' ) { $payinfo = $cust_pay_void->paymask; } elsif ( $payby eq 'CHEK' ) { my( $account, $aba ) = split('@', $cust_pay_void->paymask ); - $payinfo = "ABA $aba, Acct #$account"; + $payinfo = mt("ABA [_1], Acct #[_2]",$aba,$account); } else { $payinfo = $cust_pay_void->payinfo; } -$payby =~ s/^BILL$/Check #/ if $payinfo; -$payby =~ s/^CHEK$/Electronic check /; -$payby =~ s/^PREP$/Prepaid card /; -$payby =~ s/^CARD$/Credit card #/; -$payby =~ s/^COMP$/Complimentary by /; -$payby =~ s/^CASH$/Cash/; -$payby =~ s/^WEST$/Western Union/; -$payby =~ s/^MCRD$/Manual credit card/; -$payby =~ s/^BILL$//; +$payby = translate_payby($payby,$payinfo); my $info = $payby ? "($payby$payinfo)" : ''; if ( $opt{'pkg-balances'} && $cust_pay_void->pkgnum ) { @@ -49,12 +41,12 @@ if ( $cust_pay_void->closed !~ /^Y/i $unvoid = qq! (payby =~ /^(CARD|CHEK)$/ - ? ' (do not send anything to the payment gateway)' + ? ' ('.mt('do not send anything to the payment gateway') .')' : '' ). '"'. - qq!>unvoid)!; + '>'.mt('unvoid').')'; } -- 2.11.0