From 73ccbbf60928661e385c826de893e6fd57c7e364 Mon Sep 17 00:00:00 2001 From: levinse Date: Sun, 22 May 2011 16:39:46 +0000 Subject: [PATCH] internationalization/localization, RT12515 --- httemplate/elements/searchbar-cust_bill.html | 4 +- httemplate/elements/searchbar-cust_svc.html | 4 +- httemplate/elements/select-cust-part_pkg.html | 12 +--- httemplate/elements/select-month_year.html | 82 +++++++++++------------- httemplate/elements/select-otaker.html | 2 +- httemplate/elements/select-payby.html | 4 +- httemplate/elements/tr-cust_svc.html | 4 +- httemplate/elements/tr-input-date-field.html | 2 +- httemplate/elements/tr-password.html | 5 +- httemplate/elements/tr-select-agent.html | 7 +- httemplate/elements/tr-select-cust-part_pkg.html | 22 +++---- httemplate/elements/tr-select-otaker.html | 4 +- httemplate/elements/tr-select-part_pkg.html | 10 +-- httemplate/elements/tr-select-part_referral.html | 18 ++++-- httemplate/elements/tr-select-payby.html | 13 +--- httemplate/elements/tr-select-reason.html | 14 ++-- 16 files changed, 92 insertions(+), 115 deletions(-) diff --git a/httemplate/elements/searchbar-cust_bill.html b/httemplate/elements/searchbar-cust_bill.html index 448f40f09..6cba02370 100644 --- a/httemplate/elements/searchbar-cust_bill.html +++ b/httemplate/elements/searchbar-cust_bill.html @@ -3,7 +3,7 @@
% if ( $curuser->access_right('List invoices') ) { - Adv\ + <% mt('Adv') |h %>\ % }
@@ -22,7 +22,7 @@ <%once> -my $inv_label = '(inv #)'; +my $inv_label = emt('(inv #)'); <%init> diff --git a/httemplate/elements/searchbar-cust_svc.html b/httemplate/elements/searchbar-cust_svc.html index cc0ec97a0..766209d16 100644 --- a/httemplate/elements/searchbar-cust_svc.html +++ b/httemplate/elements/searchbar-cust_svc.html @@ -2,8 +2,8 @@
- Advanced - + <% mt('Advanced') |h %> +
<% $menu_position eq 'left' ? '
' : '' %> diff --git a/httemplate/elements/select-cust-part_pkg.html b/httemplate/elements/select-cust-part_pkg.html index 7f91e8141..731beae2a 100644 --- a/httemplate/elements/select-cust-part_pkg.html +++ b/httemplate/elements/select-cust-part_pkg.html @@ -18,12 +18,11 @@ Example: -<% include( '/elements/select-part_pkg.html', - 'empty_label' => 'Select package', #? need here in case removed +<& /elements/select-part_pkg.html, + 'empty_label' => emt('Select package'), #? need here in case removed #from select-part_pkg ?? %opt, - ) -%> +&> <%init> my( %opt ) = @_; @@ -32,10 +31,5 @@ my $cust_main = $opt{'cust_main'} or die "cust_main not specified"; $opt{'extra_sql'} .= ' AND '. FS::part_pkg->agent_pkgs_sql( $cust_main->agent ); -# ' AND ( agentnum IS NOT NULL '. -# ' OR 0 < ( SELECT COUNT(*) FROM type_pkgs '. -# ' WHERE typenum = '. $cust_main->agent->typenum. -# ' AND type_pkgs.pkgpart = part_pkg.pkgpart )'. -# ' )'; diff --git a/httemplate/elements/select-month_year.html b/httemplate/elements/select-month_year.html index cbf90b6d7..ad84b915d 100644 --- a/httemplate/elements/select-month_year.html +++ b/httemplate/elements/select-month_year.html @@ -1,45 +1,3 @@ -% -% -% my %opt = @_; -% -% my $prefix = $opt{'prefix'} || ''; -% my $disabled = $opt{'disabled'} || ''; -% my $empty = $opt{'empty_option'} || ''; -% my $start_year = $opt{'start_year'}; -% my $end_year = $opt{'end_year'} || '2037'; -% -% my @mon; -% if ( $opt{'show_month_abbr'} ) { -% @mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); -% } else { -% @mon = ( ( map "0$_", 1 .. 9 ), 10 .. 12 ), -% } -% -% my $date = $opt{'selected_date'} || ''; -% $date = '' if $date eq '-'; -% #$date ||= '01-2000' unless $empty; -% -% my $mon = $opt{'selected_mon'} || 0; -% my $year = $opt{'selected_year'} || 0; -% if ( $date ) { -% if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format -% ( $mon, $year ) = ( $2, $1 ); -% } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { -% ( $mon, $year ) = ( $1, $3 ); -% } else { -% die "unrecognized expiration date format: $date"; -% } -% } -% -% unless ( $start_year ) { -% my @t = localtime; -% $start_year = $t[5] + 1900; -% } -% $start_year = $year if $start_year > $year && $year > 0; -% -% - - +<%init> + my %opt = @_; + + my $prefix = $opt{'prefix'} || ''; + my $disabled = $opt{'disabled'} || ''; + my $empty = $opt{'empty_option'} || ''; + my $start_year = $opt{'start_year'}; + my $end_year = $opt{'end_year'} || '2037'; + + my @mon; + if ( $opt{'show_month_abbr'} ) { + @mon = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec); + # XXX: localization + } else { + @mon = ( ( map "0$_", 1 .. 9 ), 10 .. 12 ), + } + + my $date = $opt{'selected_date'} || ''; + $date = '' if $date eq '-'; + + my $mon = $opt{'selected_mon'} || 0; + my $year = $opt{'selected_year'} || 0; + if ( $date ) { + if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format + ( $mon, $year ) = ( $2, $1 ); + } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) { + ( $mon, $year ) = ( $1, $3 ); + } else { + die "unrecognized expiration date format: $date"; + } + } + + unless ( $start_year ) { + my @t = localtime; + $start_year = $t[5] + 1900; + } + $start_year = $year if $start_year > $year && $year > 0; + + diff --git a/httemplate/elements/select-otaker.html b/httemplate/elements/select-otaker.html index 2a689f39d..660566565 100644 --- a/httemplate/elements/select-otaker.html +++ b/httemplate/elements/select-otaker.html @@ -1,7 +1,7 @@ - + diff --git a/httemplate/elements/tr-password.html b/httemplate/elements/tr-password.html index bbc624d8c..d19c4ed0e 100644 --- a/httemplate/elements/tr-password.html +++ b/httemplate/elements/tr-password.html @@ -1,4 +1,3 @@ -<% include('tr-input-text.html', @_, +<& tr-input-text.html, @_, 'type' => 'password', - ) -%> +&> diff --git a/httemplate/elements/tr-select-agent.html b/httemplate/elements/tr-select-agent.html index 515a11d48..0985d1aa7 100644 --- a/httemplate/elements/tr-select-agent.html +++ b/httemplate/elements/tr-select-agent.html @@ -32,14 +32,13 @@ Example: % } else { - <% $opt{'label'} || 'Agent' %> + <% $opt{'label'} || emt('Agent') %> > - <% include( '/elements/select-agent.html', + <& /elements/select-agent.html, 'curr_value' => $agentnum, 'agents' => \@agents, %opt, - ) - %> + &> diff --git a/httemplate/elements/tr-select-cust-part_pkg.html b/httemplate/elements/tr-select-cust-part_pkg.html index 878af4d90..e55cbee30 100644 --- a/httemplate/elements/tr-select-cust-part_pkg.html +++ b/httemplate/elements/tr-select-cust-part_pkg.html @@ -1,10 +1,9 @@ %if ( scalar(@pkg_class) > 1 && ! $conf->exists('disable-cust-pkg_class') ) { - <% include('/elements/xmlhttp.html', + <& /elements/xmlhttp.html, 'url' => $p.'misc/cust-part_pkg.cgi', 'subs' => [ 'get_part_pkg' ], - ) - %> + &> - Package Class + <% mt('Package Class') |h %> - <% include('/elements/select-cust-pkg_class.html', + <& /elements/select-cust-pkg_class.html, 'curr_value' => $opt{'classnum'}, 'pkg_class' => \@pkg_class, 'onchange' => 'classnum_changed', - ) - %> + &> %} - Package + <% mt('Package') |h %> - <% include('/elements/select-cust-part_pkg.html', + <& /elements/select-cust-part_pkg.html, 'curr_value' => $opt{'curr_value'}, #$pkgpart 'classnum' => $opt{'classnum'}, 'cust_main' => $opt{'cust_main'}, #$cust_main 'onchange' => 'enable_order_pkg', - ) - %> + &> @@ -95,9 +92,6 @@ $pre_label .= ' ' if length($pre_label) && $pre_label =~ /\S$/; my $cust_main = $opt{'cust_main'} or die "cust_main not specified"; -#my @pkg_class = sort { $a->classname cmp $b->classname } -# qsearch( 'pkg_class', { 'disabled' => '' } ); - #"normal" part_pkg agent virtualization (agentnum or type) my @part_pkg = qsearch({ 'select' => 'DISTINCT classnum', diff --git a/httemplate/elements/tr-select-otaker.html b/httemplate/elements/tr-select-otaker.html index edf62dceb..4c4d0a194 100644 --- a/httemplate/elements/tr-select-otaker.html +++ b/httemplate/elements/tr-select-otaker.html @@ -1,6 +1,6 @@ - <% $opt{'label'} || 'Employee: ' %> - <% include('select-otaker.html', %opt) %> + <% $opt{'label'} || emt('Employee: ') %> + <& select-otaker.html, %opt &> <%init> diff --git a/httemplate/elements/tr-select-part_pkg.html b/httemplate/elements/tr-select-part_pkg.html index 88653f465..400cc5ae8 100644 --- a/httemplate/elements/tr-select-part_pkg.html +++ b/httemplate/elements/tr-select-part_pkg.html @@ -9,12 +9,12 @@ % % unless ( $opt{'js_only'} ) { - <% include('tr-td-label.html', %opt) %> + <& tr-td-label.html, %opt &> > % } % - <% include( '/elements/select-part_pkg.html', %opt ) %> + <& /elements/select-part_pkg.html, %opt &> % % unless ( $opt{'js_only'} ) { @@ -30,10 +30,6 @@ my( %opt ) = @_; my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : ''; -$opt{'label'} ||= 'Package definition'; - -#taken care of (better) in select-part_pkg now (is there anything using this -# that needs to override the disabed=>'' ??) -#$opt{'part_pkg'} ||= [ qsearch( 'part_pkg', {} ) ]; # { disabled=>'' } ) +$opt{'label'} ||= emt('Package definition'); diff --git a/httemplate/elements/tr-select-part_referral.html b/httemplate/elements/tr-select-part_referral.html index a589528d7..765aa8400 100644 --- a/httemplate/elements/tr-select-part_referral.html +++ b/httemplate/elements/tr-select-part_referral.html @@ -1,5 +1,14 @@ % if ( scalar( @{$opt{'part_referrals'}} ) == 0 ) { -

You have not created any advertising sources. You must create at least one advertising source before adding a customer. Go to advertising source listing and create one or more advertising sources. +

+ <% mt('At least one advertising source must be created prior to adding a customer, but none have been created.') |h %> + +% #hack +% my $createlink = qq!!; +% my $createlabel = emt("To create one, see [_1]advertising source listing","XXXLINKXXX").''; +% $createlabel =~ s/XXXLINKXXX/$createlink/; + <% $createlabel %> + + % } elsif ( scalar( @{$opt{'part_referrals'}} ) == 1 ) { @@ -10,14 +19,13 @@ % if ( $opt{'label'} ) { <% $opt{'label'} %> % } else { - <%$r%>Advertising source + <%$r%><% mt('Advertising source') |h %> % } - <% include( '/elements/select-part_referral.html', + <& /elements/select-part_referral.html, 'curr_value' => $refnum, %opt - ) - %> + &> diff --git a/httemplate/elements/tr-select-payby.html b/httemplate/elements/tr-select-payby.html index 354eb5580..94c303fc4 100644 --- a/httemplate/elements/tr-select-payby.html +++ b/httemplate/elements/tr-select-payby.html @@ -1,12 +1,11 @@ -<% include ('tr-td-label.html', 'label' => 'Payment type', @_ ) %> +<& tr-td-label.html, 'label' => emt('Payment type'), @_ &> > - <% include( '/elements/select-payby.html', + <& /elements/select-payby.html, 'curr_value' => $curr_value, %opt - ) - %> + &> @@ -16,16 +15,10 @@ my %opt = @_; -#my $onchange = $opt{'onchange'} -# ? 'onChange="'. $opt{'onchange'}. '(this)"' -# : ''; - my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : ''; my $method = 'payby2longname'; $method = 'cust_payby2longname' if $opt{'payby_type'} eq 'cust'; -#$method = 'event_payby2longname' if $opt{'payby_type'} eq 'event'; -#$method = 'pay_payby2longname' if $opt{'payby_type'} eq 'pay'; unless ( $opt{'paybys'} ) { tie %{ $opt{'paybys'} }, 'Tie::IxHash', FS::payby->$method(); diff --git a/httemplate/elements/tr-select-reason.html b/httemplate/elements/tr-select-reason.html index d85538f0c..5a79d68ef 100755 --- a/httemplate/elements/tr-select-reason.html +++ b/httemplate/elements/tr-select-reason.html @@ -64,15 +64,15 @@ Example: - Reason + <% mt('Reason') |h %> @@ -83,13 +83,13 @@ Example: % if (scalar(@types) < 1) { # we should never reach this -

No reason types. Go add some.

+

<% mt('No reason types. Please add some.') |h %>

% }elsif (scalar(@types) == 1) { -

Reason Type

+

<% mt('Reason Type') |h %>

<% $types[0]->type %> @@ -101,7 +101,7 @@ Example: -

Reason Type

+

<% mt('Reason Type') |h %>

" style="display:<% $display %>"> -- 2.11.0