[Rt-commit] rt branch, 4.0/advanced-keeps-saved-search, updated. rt-3.9.7-1221-g166f670

Alex Vandiver alexmv at bestpractical.com
Fri Jan 21 02:11:22 EST 2011


The branch, 4.0/advanced-keeps-saved-search has been updated
       via  166f6703efdaf39955c99ac7ef09e5c41f1a0060 (commit)
      from  12bacce9ba19feca4b1040991a4e0ac711b44f35 (commit)

Summary of changes:
 lib/RT/SQL.pm |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit 166f6703efdaf39955c99ac7ef09e5c41f1a0060
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Jan 21 02:10:16 2011 -0500

    Localize error messages from RT::SQL

diff --git a/lib/RT/SQL.pm b/lib/RT/SQL.pm
index c458204..4f2c00d 100644
--- a/lib/RT/SQL.pm
+++ b/lib/RT/SQL.pm
@@ -93,6 +93,7 @@ sub ParseToArray {
 
 sub Parse {
     my ($string, $cb) = @_;
+    my $loc = sub {HTML::Mason::Commands::loc(@_)};
     $string = '' unless defined $string;
 
     my $want = KEYWORD | OPEN_PAREN;
@@ -129,7 +130,7 @@ sub Parse {
         unless ($current && $want & $current) {
             my $tmp = substr($string, 0, pos($string)- length($match));
             $tmp .= '>'. $match .'<--here'. substr($string, pos($string));
-            my $msg = "Wrong query, expecting a ". _BitmaskToString($want) ." in '$tmp'";
+            my $msg = $loc->("Wrong query, expecting a [_1] in '[_2]'", _BitmaskToString($want), $tmp);
             return $cb->{'Error'}->( $msg ) if $cb->{'Error'};
             die $msg;
         }
@@ -179,7 +180,7 @@ sub Parse {
             $want = AGGREG;
             $want |= CLOSE_PAREN if $depth;
         } else {
-            my $msg = "Query parser is lost";
+            my $msg = $loc->("Query parser is lost");
             return $cb->{'Error'}->( $msg ) if $cb->{'Error'};
             die $msg;
         }
@@ -188,15 +189,15 @@ sub Parse {
     } # while
 
     unless( !$last || $last & (CLOSE_PAREN | VALUE) ) {
-        my $msg = "Incomplete query, last element ("
-            . _BitmaskToString($last)
-            . ") is not CLOSE_PAREN or VALUE in '$string'";
+        my $msg = $loc->("Incomplete query, last element ([_1]) is not close paren or value in '[_2]'",
+                         _BitmaskToString($last),
+                         $string);
         return $cb->{'Error'}->( $msg ) if $cb->{'Error'};
         die $msg;
     }
 
     if( $depth ) {
-        my $msg = "Incomplete query, $depth paren(s) isn't closed in '$string'";
+        my $msg = $loc->("Incomplete query, [quant,_1,unclosed paren] in '[_2]'", $depth, $string);
         return $cb->{'Error'}->( $msg ) if $cb->{'Error'};
         die $msg;
     }

-----------------------------------------------------------------------


More information about the Rt-commit mailing list