From 71a6b2a0d4419ee8c85724fb382ea51aa409d8af Mon Sep 17 00:00:00 2001
From: Michael <Chefkeks@users.noreply.github.com>
Date: Fri, 22 Apr 2016 14:10:26 +0200
Subject: [PATCH] Update several files for "this ..." translations

Within this commit, several files got updated to split up strings like "Disable for this team" / "Disable for this department" into "Disable for" and "this team"/"this department".
So a) a little bit less translations and b) all strings of "this (ticket|task|API|canned|FAQ|depart|email|group|site|SLA|agent|team|template|help|ban|category|custom|end user|role)" can match already existing "this ..." translations now.
PS: Didn't remove all that whitespaces in include/staff/tpl.inc.php - seems like my php editor app has done that automatically :/
---
 include/class.staff.php                       | 2 +-
 include/class.ticket.php                      | 2 +-
 include/client/view.inc.php                   | 2 +-
 include/staff/department.inc.php              | 6 +++---
 include/staff/email.inc.php                   | 4 ++--
 include/staff/faq.inc.php                     | 2 +-
 include/staff/team.inc.php                    | 4 ++--
 include/staff/templates/task-preview.tmpl.php | 2 +-
 include/staff/ticket-view.inc.php             | 5 +++--
 include/staff/tpl.inc.php                     | 4 ++--
 10 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/include/class.staff.php b/include/class.staff.php
index 6a2f2646b..1241e58fc 100644
--- a/include/class.staff.php
+++ b/include/class.staff.php
@@ -1090,7 +1090,7 @@ implements AuthenticatedUser, EmailContact, TemplateVariable {
             if (!$dept_id || !Dept::lookup($dept_id))
                 $errors['dept_access'][$dept_id] = __('Select a valid department');
             if ($dept_id == $this->getDeptId())
-                $errors['dept_access'][$dept_id] = __('Agent already has access to this department');
+                $errors['dept_access'][$dept_id] = sprintf(__('Agent already has access to %s'), __('this department'));
             $da = $this->dept_access->findFirst(array('dept_id' => $dept_id));
             if (!isset($da)) {
                 $da = new StaffDeptAccess(array(
diff --git a/include/class.ticket.php b/include/class.ticket.php
index 8f5dd5551..a97aae045 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -3518,7 +3518,7 @@ implements RestrictedAccess, Threadable {
             && ($role = $thisstaff->getRole($vars['deptId']))
             && !$role->hasPerm(TicketModel::PERM_CREATE)
         ) {
-            $errors['err'] = __('You do not have permission to create a ticket in this department');
+            $errors['err'] = sprintf(__('You do not have permission to create a ticket in %s'), __('this department'));
             return false;
         }
 
diff --git a/include/client/view.inc.php b/include/client/view.inc.php
index 05ea6f440..2aa01d019 100644
--- a/include/client/view.inc.php
+++ b/include/client/view.inc.php
@@ -6,7 +6,7 @@ $info=($_POST && $errors)?Format::htmlchars($_POST):array();
 $dept = $ticket->getDept();
 
 if ($ticket->isClosed() && !$ticket->isReopenable())
-    $warn = __('This ticket is marked as closed and cannot be reopened.');
+    $warn = sprintf(__('%s is marked as closed and cannot be reopened.'), __('This ticket'));
 
 //Making sure we don't leak out internal dept names
 if(!$dept || !$dept->isPublic())
diff --git a/include/staff/department.inc.php b/include/staff/department.inc.php
index 66e172a8f..a3822f68b 100644
--- a/include/staff/department.inc.php
+++ b/include/staff/department.inc.php
@@ -227,7 +227,7 @@ $info = Format::htmlchars(($errors && $_POST) ? $_POST : $info);
                 <label>
                 <input type="checkbox" name="ticket_auto_response" value="0" <?php echo !$info['ticket_auto_response']?'checked="checked"':''; ?> >
 
-                <?php echo __('<strong>Disable</strong> for this Department'); ?>
+                <?php echo sprintf(__('<strong>Disable</strong> for %s'), __('this department')); ?>
                 </label>
                 <i class="help-tip icon-question-sign" href="#new_ticket"></i>
             </td>
@@ -239,7 +239,7 @@ $info = Format::htmlchars(($errors && $_POST) ? $_POST : $info);
             <td>
                 <label>
                 <input type="checkbox" name="message_auto_response" value="0" <?php echo !$info['message_auto_response']?'checked="checked"':''; ?> >
-                <?php echo __('<strong>Disable</strong> for this Department'); ?>
+                <?php echo sprintf(__('<strong>Disable</strong> for %s'), __('this department')); ?>
                 </label>
                 <i class="help-tip icon-question-sign" href="#new_message"></i>
             </td>
@@ -322,7 +322,7 @@ $info = Format::htmlchars(($errors && $_POST) ? $_POST : $info);
             <td colspan="2">
                 <?php echo __('Department Members'); ?>
                 <div><small>
-                <?php echo __('Agents who are primary members of this department'); ?>
+                <?php echo sprintf(__('Agents who are primary members of %s'), __('this department')); ?>
                 </small></div>
             </td>
         </tr>
diff --git a/include/staff/email.inc.php b/include/staff/email.inc.php
index e46bcd643..953da7f55 100644
--- a/include/staff/email.inc.php
+++ b/include/staff/email.inc.php
@@ -152,7 +152,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
             </td>
             <td>
                 <label><input type="checkbox" name="noautoresp" value="1" <?php echo $info['noautoresp']?'checked="checked"':''; ?> >
-                <?php echo __('<strong>Disable</strong> for this Email Address'); ?>
+                <?php echo sprintf(__('<strong>Disable</strong> for %s'), __('this email')); ?>
                 </label>
                 <i class="help-tip icon-question-sign" href="#auto_response"></i>
             </td>
@@ -313,7 +313,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
             <td><?php echo __('Header Spoofing'); ?></td>
             <td>
                 <label><input type="checkbox" name="smtp_spoofing" value="1" <?php echo $info['smtp_spoofing'] ?'checked="checked"':''; ?>>
-                <?php echo __('Allow for this Email Address'); ?></label>
+                <?php echo sprintf(__('Allow for %s'), __('this email')); ?></label>
                 <i class="help-tip icon-question-sign" href="#header_spoofing"></i>
             </td>
         </tr>
diff --git a/include/staff/faq.inc.php b/include/staff/faq.inc.php
index 500e1132e..d75958fda 100644
--- a/include/staff/faq.inc.php
+++ b/include/staff/faq.inc.php
@@ -77,7 +77,7 @@ if ($topics = Topic::getAllHelpTopics()) {
 ?>
     <div style="padding-top:9px">
         <strong><?php echo __('Help Topics');?></strong>:
-        <div class="faded"><?php echo __('Check all help topics related to this FAQ.');?></div>
+        <div class="faded"><?php echo sprintf(__('Check all help topics related to %s.'), __('this FAQ article'));?></div>
     </div>
     <select multiple="multiple" name="topics[]" class="multiselect"
         data-placeholder="<?php echo __('Help Topics'); ?>"
diff --git a/include/staff/team.inc.php b/include/staff/team.inc.php
index 3552d2cc7..600ea6a58 100644
--- a/include/staff/team.inc.php
+++ b/include/staff/team.inc.php
@@ -103,7 +103,7 @@ $info = $team->getInfo();
             </td>
             <td>
                 <input type="checkbox" name="noalerts" value="1" <?php echo !$team->alertsEnabled()?'checked="checked"':''; ?> >
-                <?php echo __('<strong>Disable</strong> for this Team'); ?>
+                <?php echo sprintf(__('<strong>Disable</strong> for %s'), __('this team')); ?>
                 <i class="help-tip icon-question-sign" href="#assignment_alert"></i>
             </td>
         </tr>
@@ -135,7 +135,7 @@ foreach ($members as $m)
             <td colspan="2">
                 <?php echo __('Team Members'); ?>
                 <div><small>
-                <?php echo __('Agents who are members of this team'); ?>
+                <?php echo sprintf(__('Agents who are members of %s'), __('this team')); ?>
                 <i class="help-tip icon-question-sign" href="#members"></i>
                 </small></div>
             </td>
diff --git a/include/staff/templates/task-preview.tmpl.php b/include/staff/templates/task-preview.tmpl.php
index e1f32892c..88405bc12 100644
--- a/include/staff/templates/task-preview.tmpl.php
+++ b/include/staff/templates/task-preview.tmpl.php
@@ -2,7 +2,7 @@
 $error=$msg=$warn=null;
 
 if (!$task->checkStaffPerm($thisstaff))
-     $warn.= __('You do not have access to this task');
+     $warn.= __('You do not have access to %s'), __('this task');
 elseif ($task->isOverdue())
     $warn.='&nbsp;<span class="Icon overdueTicket">'.__('Marked overdue!').'</span>';
 
diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php
index c634971b3..ea85e04f3 100644
--- a/include/staff/ticket-view.inc.php
+++ b/include/staff/ticket-view.inc.php
@@ -38,7 +38,8 @@ elseif ($ticket->isAssigned()
 if (!$errors['err']) {
 
     if ($lock && $lock->getStaffId()!=$thisstaff->getId())
-        $errors['err'] = sprintf(__('This ticket is currently locked by %s'),
+        $errors['err'] = sprintf(__('%s is currently locked by %s'),
+                __('This ticket'),
                 $lock->getStaffName());
     elseif (($emailBanned=Banlist::isBanned($ticket->getEmail())))
         $errors['err'] = __('Email is in banlist! Must be removed before any reply/response');
@@ -866,7 +867,7 @@ if ($errors['err'] && isset($_POST['a'])) {
     <a class="close" href=""><i class="icon-remove-circle"></i></a>
     <hr/>
     <p class="confirm-action" style="display:none;" id="claim-confirm">
-        <?php echo __('Are you sure you want to <b>claim</b> (self assign) this ticket?');?>
+        <?php echo sprintf(__('Are you sure you want to <b>claim</b> (self assign) %s?'), __('this ticket');?>
     </p>
     <p class="confirm-action" style="display:none;" id="answered-confirm">
         <?php echo __('Are you sure you want to flag the ticket as <b>answered</b>?');?>
diff --git a/include/staff/tpl.inc.php b/include/staff/tpl.inc.php
index 7f0839f8b..10fc3e70b 100644
--- a/include/staff/tpl.inc.php
+++ b/include/staff/tpl.inc.php
@@ -105,8 +105,8 @@ $invalid = array();
 if ($template instanceof EmailTemplate) {
     if ($invalid = $template->getInvalidVariableUsage()) {
     $invalid = array_unique($invalid); ?>
-    <div class="warning-banner"><?php echo
-        __('Some variables may not be a valid for this context. Please check for spelling errors and correct usage for this template.') ?>
+    <div class="warning-banner"><?php echo sprintf(
+        __('Some variables may not be a valid for this context. Please check for spelling errors and correct usage for %s.'), __('this template')); ?>
     <br/>
     <code><?php echo implode(', ', $invalid); ?></code>
 </div>
-- 
GitLab