Subject: | Missing loc calls |
Attached patch adds some missing loc calls.
There is still two ugly plaes where I do not know how to set localization:
diff --git a/html/Callbacks/RT-Extension-TicketLocking/Ticket/Display.html/BeforeActionList b/html/Callbacks/RT-Extension-TicketLocking/Ticket/Display.html/BeforeActionList
index 535c545..b93e518 100644
--- a/html/Callbacks/RT-Extension-TicketLocking/Ticket/Display.html/BeforeActionList
+++ b/html/Callbacks/RT-Extension-TicketLocking/Ticket/Display.html/BeforeActionList
@@ -8,6 +8,7 @@ $Actions => undef
#variables except for id
unless($Duration) {
my $msg = (grep defined && m{You have unlocked this ticket\. It was locked for (\d+) seconds\.}i, @$Actions)[-1];
+ # FIXME: How to loc this?
if ( $msg && $msg =~ /(You have unlocked this ticket\.) It was locked for (\d+) seconds\./i ) {
$ARGS{'Duration'} = $2 if $2 && $2 !~ /\./;
}
diff --git a/html/Elements/ShowLock b/html/Elements/ShowLock
index a83d05f..71ddfab 100644
--- a/html/Elements/ShowLock
+++ b/html/Elements/ShowLock
@@ -49,6 +49,7 @@
%}
<%INIT>
foreach ( grep defined, @{ $ARGS{'Actions'} || [] } ) {
+ # FIXME: how to loc this?
s/(You have unlocked this ticket\.) It was locked for \d+ seconds\./$1/i;
}
if ( $Id ) {
Subject: | 0001-Add-missing-loc-calls.patch |
From 2cb741c6d0b15e74db8157bcdbf58ecfd7f01510 Mon Sep 17 00:00:00 2001
From: Emmanuel Lacour <elacour@easter-eggs.com>
Date: Mon, 26 Jan 2015 13:36:00 +0100
Subject: [PATCH 1/3] Add missing loc calls
---
html/Elements/ShowLock | 4 ++--
lib/RT/Extension/TicketLocking.pm | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/html/Elements/ShowLock b/html/Elements/ShowLock
index 81a9c4a..a83d05f 100644
--- a/html/Elements/ShowLock
+++ b/html/Elements/ShowLock
@@ -23,7 +23,7 @@
%#
%# END LICENSE BLOCK
-% my $TicketLabel = $Id ? "Ticket #$Id" : 'this ticket';
+% my $TicketLabel = $Id ? loc("Ticket #[_1]", $Id) : loc('this ticket');
% if ($Duration ||($u->id && $u->id == $session{'CurrentUser'}->id)) {
<div class="locked-by-you">
@@ -40,7 +40,7 @@
</div>
% } elsif ($u->id) {
% my $u_str = $m->scomp('/Elements/ShowUser', User => $u);
-% $TicketLabel = 'This ticket' if $TicketLabel eq 'this ticket';
+% $TicketLabel = loc('This ticket') if $TicketLabel eq loc('this ticket');
% $TicketLabel = $m->interp->apply_escapes($TicketLabel, 'h');
% $ago = $m->interp->apply_escapes($ago, 'h');
<div class="locked">
diff --git a/lib/RT/Extension/TicketLocking.pm b/lib/RT/Extension/TicketLocking.pm
index 55b334f..86b4cc4 100644
--- a/lib/RT/Extension/TicketLocking.pm
+++ b/lib/RT/Extension/TicketLocking.pm
@@ -343,17 +343,17 @@ sub Unlock {
my $type = shift || 'Auto';
my $lock = $ticket->RT::Ticket::Locked();
- return (undef, "This ticket was not locked.") unless $lock;
- return (undef, "You cannot unlock a ticket locked by another user.")
+ return (undef, $ticket->CurrentUser->loc("This ticket was not locked.")) unless $lock;
+ return (undef, $ticket->CurrentUser->loc("You cannot unlock a ticket locked by another user."))
unless $lock->Content->{User} == $ticket->CurrentUser->id;
my $current_type = $lock->Content->{'Type'};
- return (undef, "There is a lock with a higher priority on this ticket.")
+ return (undef, $ticket->CurrentUser->loc("There is a lock with a higher priority on this ticket."))
if $ticket->LockPriority( $type ) < $ticket->LockPriority( $current_type );
my $duration = time() - $lock->Content->{'Timestamp'};
$ticket->DeleteAttribute('RT_Lock');
- return ($duration, "You have unlocked this ticket. It was locked for $duration seconds.");
+ return ($duration, $ticket->CurrentUser->loc("You have unlocked this ticket. It was locked for [_1] seconds.", $duration));
}
--
2.1.4