From 61e0b6357194fe98649fd47a1ab1ff9e89e84a11 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Thu, 24 Jul 2014 10:20:35 -0500
Subject: [PATCH] i18n: Translate the password-reset feature

---
 include/client/pwreset.request.php           | 2 +-
 include/staff/pwreset.login.php              | 2 +-
 include/staff/pwreset.php                    | 4 ++--
 include/staff/templates/user-lookup.tmpl.php | 2 +-
 include/staff/ticket-view.inc.php            | 2 +-
 scp/pwreset.php                              | 4 ++++
 scp/settings.php                             | 1 -
 7 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/include/client/pwreset.request.php b/include/client/pwreset.request.php
index 94d59360c..cfadbb2ff 100644
--- a/include/client/pwreset.request.php
+++ b/include/client/pwreset.request.php
@@ -19,7 +19,7 @@ $userid=Format::input($_POST['userid']);
         <input id="username" type="text" name="userid" size="30" value="<?php echo $userid; ?>">
     </div>
     <p>
-        <input class="btn" type="submit" value="Send Email">
+        <input class="btn" type="submit" value="<?php echo __('Send Email'); ?>">
     </p>
     </div>
 </form>
diff --git a/include/staff/pwreset.login.php b/include/staff/pwreset.login.php
index 718170403..29670e28f 100644
--- a/include/staff/pwreset.login.php
+++ b/include/staff/pwreset.login.php
@@ -14,7 +14,7 @@ $info = ($_POST)?Format::htmlchars($_POST):array();
         <input type="hidden" name="token" value="<?php echo Format::htmlchars($_REQUEST['token']); ?>"/>
         <fieldset>
             <input type="text" name="userid" id="name" value="<?php echo
-                $info['userid']; ?>" placeholder="username or email"
+                $info['userid']; ?>" placeholder="<?php echo __('Email or Username'); ?>"
                 autocorrect="off" autocapitalize="off"/>
         </fieldset>
         <input class="submit" type="submit" name="submit" value="Login"/>
diff --git a/include/staff/pwreset.php b/include/staff/pwreset.php
index b2ccfcfb9..22157a36c 100644
--- a/include/staff/pwreset.php
+++ b/include/staff/pwreset.php
@@ -12,10 +12,10 @@ $info = ($_POST && $errors)?Format::htmlchars($_POST):array();
         <input type="hidden" name="do" value="sendmail">
         <fieldset>
             <input type="text" name="userid" id="name" value="<?php echo
-                $info['userid']; ?>" placeholder="username" autocorrect="off"
+            $info['userid']; ?>" placeholder="<?php echo __('Email or Username'); ?>" autocorrect="off"
                 autocapitalize="off">
         </fieldset>
-        <input class="submit" type="submit" name="submit" value="Send Email"/>
+        <input class="submit" type="submit" name="submit" value="<?php echo __('Send Email'); ?>"/>
     </form>
 
 </div>
diff --git a/include/staff/templates/user-lookup.tmpl.php b/include/staff/templates/user-lookup.tmpl.php
index d6f1aa225..980a032fc 100644
--- a/include/staff/templates/user-lookup.tmpl.php
+++ b/include/staff/templates/user-lookup.tmpl.php
@@ -9,7 +9,7 @@ if (!isset($info['lookup']) || $info['lookup'] !== false) { ?>
 ); ?></p></div>
 <div style="margin-bottom:10px;">
     <input type="text" class="search-input" style="width:100%;"
-    placeholder="Search by email, phone or name" id="user-search"
+    placeholder="<?php echo __('Search by email, phone or name'); ?>" id="user-search"
     autocorrect="off" autocomplete="off"/>
 </div>
 <?php
diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php
index b3c621b8f..af406fa7a 100644
--- a/include/staff/ticket-view.inc.php
+++ b/include/staff/ticket-view.inc.php
@@ -658,7 +658,7 @@ $tcount+= $ticket->getNumNotes();
                     </div>
                     <br/>
                     <textarea name="note" id="internal_note" cols="80"
-                        placeholder="Note details"
+                        placeholder="<?php echo __('Note details'); ?>"
                         rows="9" wrap="soft" data-draft-namespace="ticket.note"
                         data-draft-object-id="<?php echo $ticket->getId(); ?>"
                         class="richtext ifhtml draft draft-delete"><?php echo $info['note'];
diff --git a/scp/pwreset.php b/scp/pwreset.php
index 5fef286df..afca9196e 100644
--- a/scp/pwreset.php
+++ b/scp/pwreset.php
@@ -24,6 +24,10 @@
 require_once('../main.inc.php');
 if(!defined('INCLUDE_DIR')) die('Fatal Error. Kwaheri!');
 
+// Bootstrap gettext translations. Since no one is yet logged in, use the
+// system or browser default
+TextDomain::configureForUser();
+
 require_once(INCLUDE_DIR.'class.staff.php');
 require_once(INCLUDE_DIR.'class.csrf.php');
 
diff --git a/scp/settings.php b/scp/settings.php
index c4e3c9669..b824ef7ca 100644
--- a/scp/settings.php
+++ b/scp/settings.php
@@ -43,7 +43,6 @@ if (isset($settingOptions[$target]))
 if($page && $_POST && !$errors) {
     if($cfg && $cfg->updateSettings($_POST,$errors)) {
         $msg=sprintf(__('Successfully updated %s'), Format::htmlchars($page[0]));
-        $cfg->reload();
     } elseif(!$errors['err']) {
         $errors['err']=__('Unable to update settings - correct errors below and try again');
     }
-- 
GitLab