internationalization/localization, RT12515
authorlevinse <levinse>
Sun, 22 May 2011 16:39:46 +0000 (16:39 +0000)
committerlevinse <levinse>
Sun, 22 May 2011 16:39:46 +0000 (16:39 +0000)
16 files changed:
httemplate/elements/searchbar-cust_bill.html
httemplate/elements/searchbar-cust_svc.html
httemplate/elements/select-cust-part_pkg.html
httemplate/elements/select-month_year.html
httemplate/elements/select-otaker.html
httemplate/elements/select-payby.html
httemplate/elements/tr-cust_svc.html
httemplate/elements/tr-input-date-field.html
httemplate/elements/tr-password.html
httemplate/elements/tr-select-agent.html
httemplate/elements/tr-select-cust-part_pkg.html
httemplate/elements/tr-select-otaker.html
httemplate/elements/tr-select-part_pkg.html
httemplate/elements/tr-select-part_referral.html
httemplate/elements/tr-select-payby.html
httemplate/elements/tr-select-reason.html

index 448f40f..6cba023 100644 (file)
@@ -3,7 +3,7 @@
   <FORM ACTION="<%$fsurl%>search/cust_bill.html" METHOD="GET" STYLE="margin:0;display:inline">
     <INPUT NAME="invnum" TYPE="text" VALUE="<% $inv_label |n %>" STYLE="width:56px" onFocus="clearhint_search_invoice(this);" onClick="clearhint_search_invoice(this);" CLASS="fstext">
 %   if ( $curuser->access_right('List invoices') ) { 
-    <A HREF="<%$fsurl%>search/report_cust_bill.html" CLASS="fslink" STYLE="font-size: 11px">Adv</A>\
+    <A HREF="<%$fsurl%>search/report_cust_bill.html" CLASS="fslink" STYLE="font-size: 11px"><% mt('Adv') |h %></A>\
 %   } 
     <BR>
     <INPUT TYPE="submit" VALUE="Search invoices" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px;padding-left:1px;padding-right:1px;margin-top:3px">
@@ -22,7 +22,7 @@
 </SCRIPT>
 <%once>
 
-my $inv_label = '(inv #)';
+my $inv_label = emt('(inv #)');
 
 </%once>
 <%init>
index cc0ec97..766209d 100644 (file)
@@ -2,8 +2,8 @@
 
   <FORM ACTION="<%$fsurl%>search/cust_svc.html" METHOD="GET" STYLE="margin:0">
     <INPUT NAME="search_svc" TYPE="text" VALUE="<% $svc_label |n %>" STYLE="width:<% $width %>" onFocus="clearhint_search_svc(this);" onClick="clearhint_search_svc(this);" CLASS="fstext"><BR>
-    <A NOTYET="<%$fsurl%>search/svc_Smarter.html" STYLE="color: #cccccc; font-size:11px">Advanced</A>
-    <INPUT TYPE="submit" VALUE="Search services" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px">
+    <A NOTYET="<%$fsurl%>search/svc_Smarter.html" STYLE="color: #cccccc; font-size:11px"><% mt('Advanced') |h %></A>
+    <INPUT TYPE="submit" VALUE="<% mt('Search services') |h %>" CLASS="fsblackbutton" onMouseOver="this.className='fsblackbuttonselected'; return true;" onMouseOut="this.className='fsblackbutton'; return true;" STYLE="font-size:11px">
   </FORM>
   <% $menu_position eq 'left' ? '<BR>' : '' %>
 
index 7f91e81..731beae 100644 (file)
@@ -18,12 +18,11 @@ Example:
 
 </%doc>
 
-<% 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 )'.
-#  '     )';
 
 </%init>
index cbf90b6..ad84b91 100644 (file)
@@ -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;
-%
-%
-
-
 <SELECT NAME="<% $prefix %>_month" SIZE="1" <% $disabled%>>
 
 <% $empty ? '<OPTION VALUE="">' : '' %>
    <OPTION<% $_ == $year ? ' SELECTED' : '' %> VALUE="<% $_ %>"><% $_ %>
 % } 
 
-
 </SELECT>
 
+<%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;
+
+</%init>
index 2a689f3..6605665 100644 (file)
@@ -1,7 +1,7 @@
 <SELECT NAME="otaker">
 
 % unless ( $opt{'multiple'} || $opt{'disable_empty'} ) {
-  <OPTION VALUE="">all</OPTION>
+  <OPTION VALUE=""><% mt('all') |h %></OPTION>
 % }
 
 % foreach my $otaker ( @{ $opt{'otakers'} } ) { 
index e0fb4f0..b2d5421 100644 (file)
@@ -4,7 +4,7 @@
 >
 
 % unless ( $opt{'multiple'} ) {
-    <OPTION VALUE="" <% '' eq $value ? 'SELECTED' : '' %> >all
+    <OPTION VALUE="" <% '' eq $value ? 'SELECTED' : '' %> ><% mt('all') |h %> 
 % }
 
 % foreach my $option ( keys %{ $opt{'paybys'} } ) { 
@@ -26,8 +26,6 @@ my %opt = @_;
 
 my $method = 'payby';
 $method = 'cust_payby'  if $opt{'payby_type'} eq 'cust';
-#$method = 'event_payby' if $opt{'payby_type'} eq 'event';
-#$method = 'pay_payby'   if $opt{'payby_type'} eq 'pay';
 
 unless ( $opt{'paybys'} ) {
   tie %{ $opt{'paybys'} }, 'Tie::IxHash', FS::payby->$method();
index 79a3b29..6bc9f2c 100644 (file)
@@ -63,7 +63,7 @@ $cust_svc->overlimit )
 %     my $ip_addr = $svc_x->ip_addr; #substitution for $manage_link
       <FONT SIZE="-1" STYLE="float:left">(&nbsp;<A HREF="<% 
         eval(qq("$manage_link")) 
-      %>">Manage Device</A>&nbsp;)</FONT>
+      %>"><% mt('Manage Device') |h %></A>&nbsp;)</FONT>
 %   }
 % } #svc_broadband
 % if ( $curuser->access_right('Unprovision customer service') ) {
@@ -88,6 +88,6 @@ my $svc_x = $cust_svc->svc_x;
 my $svc_unprovision_link = 
   qq!<A HREF="javascript:areyousure('${p}misc/unprovision.cgi?! .
   $cust_svc->svcnum .
-  qq!', 'Permanently unprovision and delete this service?')">Unprovision</A>!;
+  qq!', '!.emt('Permanently unprovision and delete this service?').')">'.emt('Unprovision').'</A>';
 
 </%init>
index 5400fcb..37a22e5 100644 (file)
@@ -9,7 +9,7 @@
   <TD ALIGN="right"><% $label %></TD>
   <TD>
     <INPUT TYPE="text" NAME="<% $name %>" ID="<% $name %>_text" VALUE="<% $value %>">
-    <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $name  %>_button" STYLE="cursor: pointer" TITLE="Select date">
+    <IMG SRC="<%$fsurl%>images/calendar.png" ID="<% $name  %>_button" STYLE="cursor: pointer" TITLE="<% mt('Select date') |h %>">
   </TD>
 </TR>
 
index bbc624d..d19c4ed 100644 (file)
@@ -1,4 +1,3 @@
-<% include('tr-input-text.html', @_,
+<& tr-input-text.html, @_,
              'type'   => 'password',
-          )
-%>
+&>
index 515a11d..0985d1a 100644 (file)
@@ -32,14 +32,13 @@ Example:
 % } else { 
 
   <TR>
-    <TD ALIGN="right"><% $opt{'label'} || 'Agent' %></TD>
+    <TD ALIGN="right"><% $opt{'label'} || emt('Agent') %></TD>
     <TD <% $colspan %>>
-      <% include( '/elements/select-agent.html',
+      <& /elements/select-agent.html,
                      'curr_value' => $agentnum,
                      'agents'     => \@agents,
                      %opt,
-                 )
-      %>
+      &>
     </TD>
   </TR>
 
index 878af4d..e55cbee 100644 (file)
@@ -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' ],
-            )
-  %>
+  &>
 
   <SCRIPT TYPE="text/javascript">
 
   </SCRIPT>
 
   <TR>
-    <TH ALIGN="right">Package Class</TH>
+    <TH ALIGN="right"><% mt('Package Class') |h %></TH>
     <TD COLSPAN=7>
-      <% include('/elements/select-cust-pkg_class.html',
+      <& /elements/select-cust-pkg_class.html,
                    'curr_value' => $opt{'classnum'},
                    'pkg_class'  => \@pkg_class,
                    'onchange'   => 'classnum_changed',
-                )
-      %>
+      &>
     </TD>
   </TR>
 
 %}
 
 <TR>
-  <TH ALIGN="right">Package</TH>
+  <TH ALIGN="right"><% mt('Package') |h %></TH>
   <TD COLSPAN=7>
-    <% 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',
-              )
-    %>
+    &>
   </TD>
 </TR>
 
@@ -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',
index edf62dc..4c4d0a1 100644 (file)
@@ -1,6 +1,6 @@
 <TR>
-  <TD ALIGN="right"><% $opt{'label'} || 'Employee: ' %></TD>
-  <TD><% include('select-otaker.html', %opt) %></TD>
+  <TD ALIGN="right"><% $opt{'label'} || emt('Employee: ') %></TD>
+  <TD><& select-otaker.html, %opt &></TD>
 </TR>
 
 <%init>
index 88653f4..400cc5a 100644 (file)
@@ -9,12 +9,12 @@
 %
 %   unless ( $opt{'js_only'} ) {
 
-      <% include('tr-td-label.html', %opt) %>
+      <& tr-td-label.html, %opt &>
         <TD <% $cell_style %>>
 
 %   }
 %
-          <% 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');
 
 </%init>
index a589528..765aa84 100644 (file)
@@ -1,5 +1,14 @@
 % if ( scalar( @{$opt{'part_referrals'}} ) == 0 ) {
-    <P><FONT SIZE="+1" COLOR="#ff0000">You have not created any advertising sources.  You must create at least one advertising source before adding a customer.  Go to <A HREF="<% popurl(2) %>browse/part_referral.html">advertising source listing</A> and create one or more advertising sources.</FONT>
+    <P><FONT SIZE="+1" COLOR="#ff0000">
+    <% mt('At least one advertising source must be created prior to adding a customer, but none have been created.') |h %> 
+
+% #hack
+%   my $createlink = qq!<A HREF="<% popurl(2) %>browse/part_referral.html">!; 
+%   my $createlabel = emt("To create one, see [_1]advertising source listing","XXXLINKXXX").'</A>';
+%   $createlabel =~ s/XXXLINKXXX/$createlink/;
+    <% $createlabel %>
+
+    </FONT>
 %   } elsif ( scalar( @{$opt{'part_referrals'}} ) == 1 ) {
 
      <INPUT TYPE="hidden" NAME="<% $opt{'element_name'} || $opt{'field'} || 'refnum' %>" VALUE="<% $opt{'part_referrals'}->[0]->refnum %>">
 %      if ( $opt{'label'} ) {
          <TD ALIGN="right"><% $opt{'label'} %></TD>
 %      } else {
-         <TH ALIGN="right"><%$r%>Advertising source</TH>
+         <TH ALIGN="right"><%$r%><% mt('Advertising source') |h %></TH>
 %      }
        <TD COLSPAN="<% $colspan %>">
-         <% include( '/elements/select-part_referral.html',
+         <& /elements/select-part_referral.html,
                        'curr_value' => $refnum,
                        %opt
-                   )
-         %>
+         &>
        </TD>
      </TR>
 
index 354eb55..94c303f 100644 (file)
@@ -1,12 +1,11 @@
-<% include ('tr-td-label.html', 'label' => 'Payment type', @_ ) %>
+<& tr-td-label.html, 'label' => emt('Payment type'), @_  &>
 
   <TD <% $style %>>
 
-    <% include( '/elements/select-payby.html'
+    <& /elements/select-payby.html
                   'curr_value'  => $curr_value,
                   %opt
-              )
-    %>
+    &>
 
   </TD>
 
 
 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();
index d85538f..5a79d68 100755 (executable)
@@ -64,15 +64,15 @@ Example:
 </SCRIPT>
 
 <TR>
-  <TD ALIGN="right">Reason</TD>
+  <TD ALIGN="right"><% mt('Reason') |h %></TD>
   <TD>
     <SELECT id="<% $id %>" name="<% $name %>" onFocus="sh_add<% $func_suffix %>()" onChange="sh_add<% $func_suffix %>()">
-      <OPTION VALUE="" <% ($init_reason eq '') ? 'SELECTED' : '' %>>Select Reason...</OPTION>
+      <OPTION VALUE="" <% ($init_reason eq '') ? 'SELECTED' : '' %>><% mt('Select Reason...') |h %></OPTION>
 %    foreach my $reason (@reasons) {
       <OPTION VALUE="<% $reason->reasonnum %>" <% ($init_reason == $reason->reasonnum) ? 'SELECTED' : '' %>><% $reason->reasontype->type %> : <% $reason->reason %></OPTION>
 %    }
 %    if ($curuser->access_right($add_access_right)) {
-      <OPTION VALUE="-1" <% ($init_reason == -1) ? 'SELECTED' : '' %>>Add new reason</OPTION>
+      <OPTION VALUE="-1" <% ($init_reason == -1) ? 'SELECTED' : '' %>><% mt('Add new reason') |h %></OPTION>
 %    }
 %
     </SELECT>
@@ -83,13 +83,13 @@ Example:
 %   if (scalar(@types) < 1) {  # we should never reach this
 <TR>
   <TD ALIGN="right">
-    <P>No reason types.  Go add some. </P>
+    <P><% mt('No reason types. Please add some.') |h %></P>
   </TD>
 </TR>
 %   }elsif (scalar(@types) == 1) {
 <TR>
   <TD ALIGN="right">
-    <P id="new<% $name %>TLabel" style="display:<% $display %>">Reason Type</P>
+    <P id="new<% $name %>TLabel" style="display:<% $display %>"><% mt('Reason Type') |h %></P>
   </TD>
   <TD>
     <P id="new<% $name %>T" disabled="<% $disabled %>" style="display:<% $display %>"><% $types[0]->type %>
@@ -101,7 +101,7 @@ Example:
 
 <TR>
   <TD ALIGN="right">
-    <P id="new<% $id %>TLabel" style="display:<% $display %>">Reason Type</P>
+    <P id="new<% $id %>TLabel" style="display:<% $display %>"><% mt('Reason Type') |h %></P>
   </TD>
   <TD>
     <SELECT id="new<% $id %>T" name="new<% $name %>T" "<% $disabled %>" style="display:<% $display %>">
@@ -115,7 +115,7 @@ Example:
 
 <TR>
   <TD ALIGN="right">
-    <P id="new<% $id %>Label" style="display:<% $display %>">New Reason</P>
+    <P id="new<% $id %>Label" style="display:<% $display %>"><% mt('New Reason') |h %></P>
   </TD>
   <TD><INPUT id="new<% $id %>" name="new<% $name %>" type="text" value="<% $init_newreason |h %>" "<% $disabled %>" style="display:<% $display %>"></TD>
 </TR>