[Rt-commit] rt branch, 4.0/localize-core-component-and-search-names, created. rt-4.0.10-27-gd04c615
? sunnavy
sunnavy at bestpractical.com
Tue Feb 5 11:58:01 EST 2013
The branch, 4.0/localize-core-component-and-search-names has been created
at d04c6154892429aa47679c6ce40c259baadb5249 (commit)
- Log -----------------------------------------------------------------
commit d04c6154892429aa47679c6ce40c259baadb5249
Author: sunnavy <sunnavy at bestpractical.com>
Date: Wed Feb 6 00:15:14 2013 +0800
localize built-in component/search names
user's saved searches won't be affected.
see also #21377
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 2d69b3b..cbd203a 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1115,7 +1115,12 @@ user's customized homepage ("RT at a glance").
=cut
-Set($HomepageComponents, [qw(QuickCreate Quicksearch MyAdminQueues MySupportQueues MyReminders RefreshHomepage Dashboards SavedSearches)]);
+Set(
+ $HomepageComponents,
+ [
+ qw(QuickCreate Quicksearch MyAdminQueues MySupportQueues MyReminders RefreshHomepage Dashboards SavedSearches) # loc_qw
+ ]
+);
=back
diff --git a/etc/initialdata b/etc/initialdata
index b4d3eb6..e688c19 100755
--- a/etc/initialdata
+++ b/etc/initialdata
@@ -604,22 +604,48 @@ Hour: { $SubscriptionObj->SubValue('Hour') }
OrderBy => 'LastUpdated',
Order => 'DESC' },
},
- { Name => 'HomepageSettings',
- Description => 'HomepageSettings',
- Content =>
- { 'body' => # loc
- [ { type => 'system', name => 'My Tickets' },
- { type => 'system', name => 'Unowned Tickets' },
- { type => 'system', name => 'Bookmarked Tickets' },
- { type => 'component', name => 'QuickCreate' },
- ],
- 'summary' => # loc
- [
- { type => 'component', name => 'MyReminders' },
- { type => 'component', name => 'Quicksearch' },
- { type => 'component', name => 'Dashboards' },
- { type => 'component', name => 'RefreshHomepage' },
- ],
- },
+ {
+ Name => 'HomepageSettings',
+ Description => 'HomepageSettings',
+ Content => {
+ 'body' => # loc
+ [
+ {
+ type => 'system',
+ name => 'My Tickets', # loc
+ },
+ {
+ type => 'system',
+ name => 'Unowned Tickets' # loc
+ },
+ {
+ type => 'system',
+ name => 'Bookmarked Tickets' # loc
+ },
+ {
+ type => 'component',
+ name => 'QuickCreate' # loc
+ },
+ ],
+ 'summary' => # loc
+ [
+ {
+ type => 'component',
+ name => 'MyReminders' # loc
+ },
+ {
+ type => 'component',
+ name => 'Quicksearch' # loc
+ },
+ {
+ type => 'component',
+ name => 'Dashboards' # loc
+ },
+ {
+ type => 'component',
+ name => 'RefreshHomepage' # loc
+ },
+ ],
+ },
},
);
diff --git a/share/html/Admin/Global/MyRT.html b/share/html/Admin/Global/MyRT.html
index 1a820bf..9b3cb96 100644
--- a/share/html/Admin/Global/MyRT.html
+++ b/share/html/Admin/Global/MyRT.html
@@ -60,21 +60,21 @@
<%init>
my @actions;
-my @items = map { [ "component-$_", $_ ] } sort @{ RT->Config->Get('HomepageComponents') };
+my @items = map { [ "component-$_", loc($_) ] } sort @{ RT->Config->Get('HomepageComponents') };
my $sys = RT::System->new( $session{'CurrentUser'} );
# XXX: put this in savedsearches_to_portlet_items
for ( $m->comp( "/Search/Elements/SearchesForObject",
Object => $sys )) {
- my ( $desc, $search ) = @$_;
+ my ( $desc, $loc_desc, $search ) = @$_;
my $SearchType = $search->Content->{'SearchType'} || 'Ticket';
if ( $SearchType eq 'Ticket' ) {
- push @items, [ "system-$desc", $desc ];
+ push @items, [ "system-$desc", $loc_desc ];
} else {
my $oid = ref($sys) . '-' . $sys->Id . '-SavedSearch-' . $search->Id;
- my $type =
- ( $SearchType eq 'Ticket' )
- ? 'Saved Search' : $SearchType; # loc
- push @items, [ "saved-$oid", loc($type) . ": $desc" ];
+ my $type = ( $SearchType eq 'Ticket' )
+ ? 'Saved Search' # loc
+ : $SearchType;
+ push @items, [ "saved-$oid", loc($type) . ": $loc_desc" ];
}
}
diff --git a/share/html/Admin/Users/MyRT.html b/share/html/Admin/Users/MyRT.html
index e66fa7e..f9055d3 100644
--- a/share/html/Admin/Users/MyRT.html
+++ b/share/html/Admin/Users/MyRT.html
@@ -83,7 +83,7 @@ my $portlets = $UserObj->Preferences('HomepageSettings', $default_portlets ? $d
my %allowed_components = map {$_ => 1} @{ RT->Config->Get('HomepageComponents') };
my @items;
-push @items, map {["component-$_", $_]} sort keys %allowed_components;
+push @items, map {["component-$_", loc($_)]} sort keys %allowed_components;
my $sys = RT::System->new( RT::CurrentUser->new($UserObj) );
my @objs = ($sys);
@@ -92,16 +92,16 @@ push @objs, RT::SavedSearch->new( RT::CurrentUser->new( $UserObj ) )->ObjectsFor
for my $object (@objs) {
for ($m->comp("/Search/Elements/SearchesForObject", Object => $object)) {
- my ($desc, $search) = @$_;
+ my ($desc, $loc_desc, $search) = @$_;
my $SearchType = $search->Content->{'SearchType'} || 'Ticket';
if ($object eq $sys && $SearchType eq 'Ticket') {
- push @items, ["system-$desc", $desc];
+ push @items, ["system-$desc", $loc_desc];
}
else {
my $oid = ref($object).'-'.$object->Id.'-SavedSearch-'.$search->Id;
my $type = ($SearchType eq 'Ticket')
? 'Saved Search' : $SearchType; # loc
- push @items, ["saved-$oid", loc($type).": $desc"];
+ push @items, ["saved-$oid", loc($type).": $loc_desc"];
}
}
}
diff --git a/share/html/Dashboards/Queries.html b/share/html/Dashboards/Queries.html
index a67ecf8..2b0a73e 100644
--- a/share/html/Dashboards/Queries.html
+++ b/share/html/Dashboards/Queries.html
@@ -93,8 +93,8 @@ my @components = @{ RT->Config->Get('HomepageComponents') };
for my $desc (@components) {
my $name = "component-$desc";
- push @items, [$name, $desc];
- $desc_of{$name} = $desc;
+ push @items, [$name, loc($desc)];
+ $desc_of{$name} = loc($desc);
$still_exists{$name} = 1;
}
@@ -106,7 +106,8 @@ for my $dashboard (@dashboards) {
next if $dashboard->Id == $Dashboard->Id;
my $name = 'dashboard-' . $dashboard->Id . '-' . $dashboard->Privacy;
- my $desc = "Dashboard: " . $dashboard->Name;
+ my $type = loc('Dashboard'); # loc
+ my $desc = "$type: " . $dashboard->Name;
push @items, [$name, $desc];
$desc_of{$name} = $desc;
$still_exists{$name} = 1;
@@ -121,10 +122,12 @@ push @objs, RT::SavedSearch->new( $session{CurrentUser} )->ObjectsForLoading
for my $object (@objs) {
for ($m->comp("/Search/Elements/SearchesForObject", Object => $object)) {
- my ($desc, $search) = @$_;
+ my ($desc, $loc_desc, $search) = @$_;
my $SearchType = $search->Content->{'SearchType'} || 'Ticket';
- my $type = ($SearchType eq 'Ticket') ? 'Saved Search' : $SearchType; # loc
- $desc = "$type: $desc";
+ my $type = ( $SearchType eq 'Ticket' )
+ ? 'Saved Search' # loc
+ : $SearchType;
+ $desc = loc($type) . ": $loc_desc";
my $privacy = $Dashboard->_build_privacy($object);
my $name = 'search-' . $search->Id . '-' . $privacy;
push @items, [$name, $desc];
diff --git a/share/html/Elements/Tabs b/share/html/Elements/Tabs
index 1887cfc..da0ccf1 100644
--- a/share/html/Elements/Tabs
+++ b/share/html/Elements/Tabs
@@ -488,9 +488,9 @@ my $build_main_nav = sub {
for my $search (@$searches) {
$search_menu->child( "search-" . $i++ =>
- title => $search->[0],
+ title => $search->[1],
path => "/Prefs/Search.html?"
- . $query_string->( name => ref( $search->[1] ) . '-' . $search->[1]->Id ),
+ . $query_string->( name => ref( $search->[2] ) . '-' . $search->[2]->Id ),
);
}
diff --git a/share/html/Prefs/MyRT.html b/share/html/Prefs/MyRT.html
index 2bffd26..61a7e6c 100644
--- a/share/html/Prefs/MyRT.html
+++ b/share/html/Prefs/MyRT.html
@@ -105,12 +105,13 @@ if ($ARGS{Reset}) {
unless (exists $session{'my_rt_portlets'}) {
my ($default_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('HomepageSettings');
my $portlets = $default_portlets ? $default_portlets->Content : {};
+
$session{'my_rt_portlets'} = $user->Preferences('HomepageSettings', $portlets);
}
my $portlets = $session{'my_rt_portlets'};
my %seen;
-my @items = map ["component-$_", $_], grep !$seen{$_}++, @{RT->Config->Get('HomepageComponents')};
+my @items = map ["component-$_", loc($_)], grep !$seen{$_}++, @{RT->Config->Get('HomepageComponents')};
my $sys = RT::System->new($session{'CurrentUser'});
my @objs = ($sys);
@@ -122,7 +123,7 @@ push @objs, RT::SavedSearch->new( $session{CurrentUser} )->ObjectsForLoading
my @sys_searches;
for my $object (@objs) {
for ($m->comp("/Search/Elements/SearchesForObject", Object => $object)) {
- my ($desc, $search) = @$_;
+ my ($desc, $loc_desc, $search) = @$_;
my $SearchType = 'Ticket';
if ((ref($search->Content)||'') eq 'HASH') {
@@ -134,14 +135,14 @@ for my $object (@objs) {
}
if ($object eq $sys && $SearchType eq 'Ticket') {
- push @items, ["system-$desc", $desc];
+ push @items, ["system-$desc", $loc_desc];
push @sys_searches, [$desc, $search];
}
else {
my $oid = ref($object).'-'.$object->Id.'-SavedSearch-'.$search->Id;
my $type = ($SearchType eq 'Ticket')
? 'Saved Search' : $SearchType; # loc
- push @items, ["saved-$oid", loc($type).": $desc"];
+ push @items, ["saved-$oid", loc($type).": $loc_desc"];
}
}
}
diff --git a/share/html/Search/Elements/SearchesForObject b/share/html/Search/Elements/SearchesForObject
index dc668c6..db5fc8f 100644
--- a/share/html/Search/Elements/SearchesForObject
+++ b/share/html/Search/Elements/SearchesForObject
@@ -50,15 +50,15 @@ $Object => undef
</%args>
<%init>
# Returns an array of search objects associated on $Object,
-# in the form of [Description, searchObj]
+# in the form of [Description, LocalizedDescription, searchObj]
my @result;
while (my $search = $Object->Attributes->Next) {
my $desc;
if ($search->Name eq 'SavedSearch') {
- push @result, [$search->Description, $search];
+ push @result, [$search->Description, $search->Description, $search];
}
elsif ($search->Name =~ m/^Search - (.*)/) {
- push @result, [$1, $search];
+ push @result, [$1, loc($1), $search];
}
}
return @result;
diff --git a/share/html/Widgets/SavedSearch b/share/html/Widgets/SavedSearch
index fc7c116..08ad338 100644
--- a/share/html/Widgets/SavedSearch
+++ b/share/html/Widgets/SavedSearch
@@ -92,7 +92,7 @@ if ($self->{SearchId} eq 'new') {
Right => 'SuperUser' );
for my $obj (@Objects) {
for ( $m->comp( "/Search/Elements/SearchesForObject", Object => $obj ) ) {
- my ( $desc, $search ) = @$_;
+ my ( $desc, $loc_desc, $search ) = @$_;
use Data::Dumper;
# FFS
local $Data::Dumper::Sortkeys = 1;
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list