From eb58d459f2710626de9323cd5abd2a90a331da8d Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Wed, 16 Jul 2014 10:06:10 -0500
Subject: [PATCH] i18n: Make topics, SLAs, lists, list items translatable

---
 include/class.topic.php         | 9 +++++++++
 include/staff/helptopic.inc.php | 1 -
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/class.topic.php b/include/class.topic.php
index 2db12f151..e4afba9c0 100644
--- a/include/class.topic.php
+++ b/include/class.topic.php
@@ -291,6 +291,15 @@ class Topic extends VerySimpleModel {
                 return $T != $tag ? $T : $default;
             };
 
+            $localize_this = function($id, $default) use ($localize) {
+                if (!$localize)
+                    return $default;
+
+                $tag = _H("topic.name.{$id}");
+                $T = CustomDataTranslation::translate($tag);
+                return $T != $tag ? $T : $default;
+            };
+
             // Resolve parent names
             foreach ($topics as $id=>$info) {
                 $name = $localize_this($id, $info['topic']);
diff --git a/include/staff/helptopic.inc.php b/include/staff/helptopic.inc.php
index 027c5b489..73db1e022 100644
--- a/include/staff/helptopic.inc.php
+++ b/include/staff/helptopic.inc.php
@@ -45,7 +45,6 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
             </td>
             <td>
                 <input type="text" size="30" name="topic" value="<?php echo $info['topic']; ?>"
-                data-primary-lang="<?php echo $cfg->getPrimaryLanguage(); ?>"
                 data-translate-tag="<?php echo $trans['name']; ?>"/>
                 &nbsp;<span class="error">*&nbsp;<?php echo $errors['topic']; ?></span> <i class="help-tip icon-question-sign" href="#topic"></i>
             </td>
-- 
GitLab