From efe5a08402216027d2aa597a1192a05c67ea5573 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 31 Jul 2014 11:56:05 -0500
Subject: [PATCH] i18n: Translate titles on email template management

Also fix redactor translation for SCP
---
 include/ajax.config.php         |  8 ++++++--
 include/staff/tpl.inc.php       | 10 +++++-----
 include/staff/user-view.inc.php |  2 +-
 3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/include/ajax.config.php b/include/ajax.config.php
index 6b67e1a1a..28ada2230 100644
--- a/include/ajax.config.php
+++ b/include/ajax.config.php
@@ -20,7 +20,10 @@ class ConfigAjaxAPI extends AjaxController {
 
     //config info UI might need.
     function scp() {
-        global $cfg, $thisstaff;
+        global $cfg;
+
+        $lang = Internationalization::getCurrentLanguage();
+        list($sl, $locale) = explode('_', $lang);
 
         $config=array(
               'lock_time'       => ($cfg->getLockTime()*3600),
@@ -28,7 +31,8 @@ class ConfigAjaxAPI extends AjaxController {
               'html_thread'     => (bool) $cfg->isHtmlThreadEnabled(),
               'date_format'     => ($cfg->getDateFormat()),
               'allow_attachments' => (bool) $cfg->allowAttachments(),
-              'lang'            => $thisstaff->getLanguage(),
+              'lang'            => $lang,
+              'short_lang'      => $sl,
         );
         return $this->json_encode($config);
     }
diff --git a/include/staff/tpl.inc.php b/include/staff/tpl.inc.php
index e5db2eb1d..d8c26e608 100644
--- a/include/staff/tpl.inc.php
+++ b/include/staff/tpl.inc.php
@@ -59,12 +59,12 @@ $tpl=$msgtemplates[$selected];
                     echo "</optgroup>";
                 $current_group = $nfo['group']; ?>
                 <optgroup label="<?php echo isset($_groups[$current_group])
-                    ? $_groups[$current_group] : $current_group; ?>">
+                    ? __($_groups[$current_group]) : $current_group; ?>">
             <?php }
             $sel=($selected==$cn)?'selected="selected"':'';
             echo sprintf('<option value="%s" %s>%s</option>',
                 isset($impl[$cn]) ? $impl[$cn]->getId() : $cn,
-                $sel,$nfo['name']);
+                $sel,__($nfo['name']));
         }
         if ($current_group)
             echo "</optgroup>";
@@ -86,10 +86,10 @@ $tpl=$msgtemplates[$selected];
 
 <div style="border:1px solid #ccc;background:#f0f0f0;padding:5px 10px;
     margin:10px 0;">
-<h3 style="font-size:12pt;margin:0"><?php echo $desc['name']; ?>
+<h3 style="font-size:12pt;margin:0"><?php echo __($desc['name']); ?>
     &nbsp;<i class="help-tip icon-question-sign"
-        data-content="<?php echo Format::htmlchars($desc['desc']); ?>"
-        data-title="<?php echo Format::htmlchars($desc['name']); ?>"></i>
+        data-content="<?php echo Format::htmlchars(__($desc['desc'])); ?>"
+        data-title="<?php echo Format::htmlchars(__($desc['name'])); ?>"></i>
     <a style="font-size:10pt" class="tip pull-right" href="#ticket_variables.txt">
     <i class="icon-tags"></i>
     <?php echo __('Supported Variables'); ?></a>
diff --git a/include/staff/user-view.inc.php b/include/staff/user-view.inc.php
index 283528166..34c7c212c 100644
--- a/include/staff/user-view.inc.php
+++ b/include/staff/user-view.inc.php
@@ -14,7 +14,7 @@ $org = $user->getOrganization();
         </td>
         <td width="50%" class="right_align has_bottom_border">
             <span class="action-button" data-dropdown="#action-dropdown-more">
-                <span ><i class="icon-cog"></i> More</span>
+                <span ><i class="icon-cog"></i> <?php echo __('More'); ?></span>
                 <i class="icon-caret-down"></i>
             </span>
             <a id="user-delete" class="action-button user-action"
-- 
GitLab