[Rt-commit] rt branch, 4.0/group-by-i18n-in-search-chart-page, created. rt-4.0.6-216-g7830be1

? sunnavy sunnavy at bestpractical.com
Wed Jun 20 23:57:28 EDT 2012


The branch, 4.0/group-by-i18n-in-search-chart-page has been created
        at  7830be137a017de9f457bee2c0cfb951049f06ca (commit)

- Log -----------------------------------------------------------------
commit 7830be137a017de9f457bee2c0cfb951049f06ca
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Jun 21 11:48:40 2012 +0800

    fix the loc of "group by" in search chart page by joining the sperated loc-ed words
    
    e.g. instead of loc('Owner Name'), we join existing loc('Owner') and
    loc('Name'). now left words are qw(Hourly Annually), which we should extract
    to .po files

diff --git a/lib/RT/Report/Tickets.pm b/lib/RT/Report/Tickets.pm
index de40dbd..71e6127 100644
--- a/lib/RT/Report/Tickets.pm
+++ b/lib/RT/Report/Tickets.pm
@@ -57,22 +57,29 @@ use warnings;
 sub Groupings {
     my $self = shift;
     my %args = (@_);
-    my @fields = map {$_, $_} qw(
+    my @fields = map {$self->CurrentUser->loc($_), $_} qw(
         Status
         Queue
     );
 
-    foreach my $type ( qw(Owner Creator LastUpdatedBy Requestor Cc AdminCc Watcher) ) {
-        push @fields, $type.' '.$_, $type.'.'.$_ foreach qw(
-            Name EmailAddress RealName NickName Organization Lang City Country Timezone
-        );
+    foreach my $type ( qw(Owner Creator LastUpdatedBy Requestor Cc AdminCc Watcher) ) { # loc
+        for my $field (
+            qw( Name EmailAddress RealName NickName Organization Lang City Country Timezone )
+          )
+        {
+            push @fields,
+              $self->CurrentUser->loc($type) . ' '
+              . $self->CurrentUser->loc($field), $type . '.' . $_;
+        }
     }
 
 
     for my $field (qw(Due Resolved Created LastUpdated Started Starts Told)) {
-        for my $frequency (qw(Hourly Daily Monthly Annually)) {
-            my $item = $field.$frequency;
-            push @fields,  $item,  $item;
+        for my $frequency (qw(Hourly Daily Monthly Annually)) { # loc
+            push @fields,
+              $self->CurrentUser->loc($field)
+              . $self->CurrentUser->loc($frequency),
+              $field . $frequency;
         }
     }
 
@@ -93,7 +100,11 @@ sub Groupings {
         }
         $CustomFields->LimitToGlobal;
         while ( my $CustomField = $CustomFields->Next ) {
-            push @fields, "Custom field '". $CustomField->Name ."'", "CF.{". $CustomField->id ."}";
+            push @fields, $self->CurrentUser->loc(
+                "Custom field '[_1]'",
+                $CustomField->Name
+              ),
+              "CF.{" . $CustomField->id . "}";
         }
     }
     return @fields;
diff --git a/share/html/Search/Elements/SelectGroupBy b/share/html/Search/Elements/SelectGroupBy
index 9a6951a..ed67a3b 100644
--- a/share/html/Search/Elements/SelectGroupBy
+++ b/share/html/Search/Elements/SelectGroupBy
@@ -53,7 +53,7 @@ $Query   => ''
 <select id="<% $Name %>" name="<% $Name %>">
 % while (@options) {
 % my ($text, $value) = (shift @options, shift @options);
-<option value="<% $value %>" <% $value eq $Default ? 'selected="selected"' : '' |n%>><% loc($text) %></option>
+<option value="<% $value %>" <% $value eq $Default ? 'selected="selected"' : '' |n%>><% $text %></option>
 % }
 </select>
 <%init>

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


More information about the Rt-commit mailing list