[freeside-commits] freeside/FS/FS Mason.pm, 1.78, 1.78.2.1 Maketext.pm, 1.2, 1.2.2.1

Ivan,,, ivan at wavetail.420.am
Wed Jul 27 16:56:57 PDT 2011


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv2195/FS/FS

Modified Files:
      Tag: FREESIDE_2_3_BRANCH
	Mason.pm Maketext.pm 
Log Message:
fix i18n of javascript re-print/email confirmations, RT#12515

Index: Maketext.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Maketext.pm,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -w -d -r1.2 -r1.2.2.1
--- Maketext.pm	18 May 2011 00:33:34 -0000	1.2
+++ Maketext.pm	27 Jul 2011 23:56:55 -0000	1.2.2.1
@@ -6,7 +6,7 @@
 use FS::L10N;
 use HTML::Entities qw( encode_entities );
 
-our @EXPORT_OK = qw( mt emt );
+our @EXPORT_OK = qw( mt emt js_mt );
 
 our $lh;
 
@@ -20,6 +20,16 @@
     encode_entities(mt(@_));
 }
 
+# Javascript-escaped version of mt()
+sub js_mt {
+  my $s = mt(@_);
+  #false laziness w/Mason.pm
+  $s =~ s/(['\\])/\\$1/g;
+  $s =~ s/\r/\\r/g;
+  $s =~ s/\n/\\n/g;
+  $s = "'$s'";
+}
+
 sub lh {
   my $locale =  $FS::CurrentUser::CurrentUser->option('locale')
              || FS::Conf->new->config('locale')

Index: Mason.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Mason.pm,v
retrieving revision 1.78
retrieving revision 1.78.2.1
diff -u -w -d -r1.78 -r1.78.2.1
--- Mason.pm	21 Jun 2011 01:08:07 -0000	1.78
+++ Mason.pm	27 Jul 2011 23:56:55 -0000	1.78.2.1
@@ -140,7 +140,7 @@
   use FS::NetworkMonitoringSystem;
   use FS::Tron qw( tron_lint );
   use FS::Locales;
-  use FS::Maketext qw( mt emt );
+  use FS::Maketext qw( mt emt js_mt );
 
   use FS::agent;
   use FS::agent_type;
@@ -526,6 +526,7 @@
 
   my $html_defang = new HTML::Defang (%defang_opts);
 
+  #false laziness w/ FS::Maketext js_mt
   my $js_string_sub = sub {
     #${$_[0]} =~ s/(['\\\n])/'\\'.($1 eq "\n" ? 'n' : $1)/ge;
     ${$_[0]} =~ s/(['\\])/\\$1/g;



More information about the freeside-commits mailing list