Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multilanguage Support via gettext #509

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 36 additions & 36 deletions attachment.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
<?php
/*********************************************************************
attachment.php
Attachments interface for clients.
Clients should never see the dir paths.
Peter Rotich <[email protected]>
Copyright (c) 2006-2013 osTicket
http://www.osticket.com
Released under the GNU General Public License WITHOUT ANY WARRANTY.
See LICENSE.TXT for details.
vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
require('secure.inc.php');
require_once(INCLUDE_DIR.'class.attachment.php');
//Basic checks
if(!$thisclient
|| !$_GET['id']
|| !$_GET['h']
|| !($attachment=Attachment::lookup($_GET['id']))
|| !($file=$attachment->getFile()))
die('Unknown attachment!');
//Validate session access hash - we want to make sure the link is FRESH! and the user has access to the parent ticket!!
$vhash=md5($attachment->getFileId().session_id().$file->getHash());
if(strcasecmp(trim($_GET['h']),$vhash)
|| !($ticket=$attachment->getTicket())
|| !$ticket->checkClientAccess($thisclient))
die('Unknown or invalid attachment');
//Download the file..
$file->download();
?>
<?php
/*********************************************************************
attachment.php

Attachments interface for clients.
Clients should never see the dir paths.

Peter Rotich <[email protected]>
Copyright (c) 2006-2013 osTicket
http://www.osticket.com

Released under the GNU General Public License WITHOUT ANY WARRANTY.
See LICENSE.TXT for details.

vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
require('secure.inc.php');
require_once(INCLUDE_DIR.'class.attachment.php');
//Basic checks
if(!$thisclient
|| !$_GET['id']
|| !$_GET['h']
|| !($attachment=Attachment::lookup($_GET['id']))
|| !($file=$attachment->getFile()))
die(__('Unknown attachment!'));

//Validate session access hash - we want to make sure the link is FRESH! and the user has access to the parent ticket!!
$vhash=md5($attachment->getFileId().session_id().$file->getHash());
if(strcasecmp(trim($_GET['h']),$vhash)
|| !($ticket=$attachment->getTicket())
|| !$ticket->checkClientAccess($thisclient))
die(__('Unknown or invalid attachment'));
//Download the file..
$file->download();

?>
64 changes: 32 additions & 32 deletions include/ajax.content.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ function log($id) {

if($id && ($log=Log::lookup($id))) {
$content=sprintf('<div style="width:500px;">&nbsp;<strong>%s</strong><br><p>%s</p>
<hr><strong>Log Date:</strong> <em>%s</em> <strong>IP Address:</strong> <em>%s</em></div>',
<hr><strong>Log Date:</strong> <em>%s</em> <strong>'.__('IP Address').':</strong> <em>%s</em></div>',
$log->getTitle(),
Format::display(str_replace(',',', ',$log->getText())),
Format::db_daydatetime($log->getCreateDate()),
$log->getIP());
}else {
$content='<div style="width:295px;">&nbsp;<strong>Error:</strong>Unknown or invalid log ID</div>';
$content='<div style="width:295px;">&nbsp;<strong>'.__('Error').':</strong>'.__('Unknown or invalid log ID').'</div>';
}

return $content;
Expand All @@ -38,45 +38,45 @@ function ticket_variables() {

$content='
<div style="width:680px;">
<h2>Ticket Variables</h2>
Please note that non-base variables depends on the context of use. Visit osTicket Wiki for up to date documentation.
<h2>'.__('Ticket Variables').'</h2>
'.__('Please note that non-base variables depends on the context of use. Visit osTicket Wiki for up to date documentation.').'
<br/>
<table width="100%" border="0" cellspacing=1 cellpadding=2>
<tr><td width="55%" valign="top"><b>Base Variables</b></td><td><b>Other Variables</b></td></tr>
<tr><td width="55%" valign="top"><b>'.__('Base Variables').'</b></td><td><b>'.__('Other Variables').'</b></td></tr>
<tr>
<td width="55%" valign="top">
<table width="100%" border="0" cellspacing=1 cellpadding=1>
<tr><td width="130">%{ticket.id}</td><td>Ticket ID (internal ID)</td></tr>
<tr><td>%{ticket.number}</td><td>Ticket number (external ID)</td></tr>
<tr><td>%{ticket.email}</td><td>Email address</td></tr>
<tr><td>%{ticket.name}</td><td>Full name</td></tr>
<tr><td>%{ticket.subject}</td><td>Subject</td></tr>
<tr><td>%{ticket.phone}</td><td>Phone number | ext</td></tr>
<tr><td>%{ticket.status}</td><td>Status</td></tr>
<tr><td>%{ticket.priority}</td><td>Priority</td></tr>
<tr><td>%{ticket.assigned}</td><td>Assigned staff and/or team</td></tr>
<tr><td>%{ticket.create_date}</td><td>Date created</td></tr>
<tr><td>%{ticket.due_date}</td><td>Due date</td></tr>
<tr><td>%{ticket.close_date}</td><td>Date closed</td></tr>
<tr><td>%{ticket.auth_token}</td><td>Auth. token used for auto-login</td></tr>
<tr><td>%{ticket.client_link}</td><td>Client\'s ticket view link</td></tr>
<tr><td>%{ticket.staff_link}</td><td>Staff\'s ticket view link</td></tr>
<tr><td colspan="2" style="padding:5px 0 5px 0;"><em>Expandable Variables (See Wiki)</em></td></tr>
<tr><td>%{ticket.<b>topic</b>}</td><td>Help topic</td></tr>
<tr><td>%{ticket.<b>dept</b>}</td><td>Department</td></tr>
<tr><td>%{ticket.<b>staff</b>}</td><td>Assigned/closing staff</td></tr>
<tr><td>%{ticket.<b>team</b>}</td><td>Assigned/closing team</td></tr>
<tr><td width="130">%{ticket.id}</td><td>'.__('Ticket ID').' ('.__('internal ID').')</td></tr>
<tr><td>%{ticket.number}</td><td>'.__('Ticket number').' ('.__('external ID').')</td></tr>
<tr><td>%{ticket.email}</td><td>'.__('Email address').'</td></tr>
<tr><td>%{ticket.name}</td><td>'.__('Full name').'</td></tr>
<tr><td>%{ticket.subject}</td><td>'.__('Subject').'</td></tr>
<tr><td>%{ticket.phone}</td><td>'.__('Phone number | ext').'</td></tr>
<tr><td>%{ticket.status}</td><td>'.__('Status').'</td></tr>
<tr><td>%{ticket.priority}</td><td>'.__('Priority').'</td></tr>
<tr><td>%{ticket.assigned}</td><td>'.__('Assigned staff and/or team').'</td></tr>
<tr><td>%{ticket.create_date}</td><td>'.__('Date created').'</td></tr>
<tr><td>%{ticket.due_date}</td><td>'.__('Due date').'</td></tr>
<tr><td>%{ticket.close_date}</td><td>'.__('Date closed').'</td></tr>
<tr><td>%{ticket.auth_token}</td><td>'.__('Auth. token used for auto-login').'</td></tr>
<tr><td>%{ticket.client_link}</td><td>'.__('Client\'s ticket view link').'</td></tr>
<tr><td>%{ticket.staff_link}</td><td>'.__('Staff\'s ticket view link').'</td></tr>
<tr><td colspan="2" style="padding:5px 0 5px 0;"><em>'.__('Expandable Variables (See Wiki)').'</em></td></tr>
<tr><td>%{ticket.<b>topic</b>}</td><td>'.__('Help topic').'</td></tr>
<tr><td>%{ticket.<b>dept</b>}</td><td>'.__('Department').'</td></tr>
<tr><td>%{ticket.<b>staff</b>}</td><td>'.__('Assigned/closing staff').'</td></tr>
<tr><td>%{ticket.<b>team</b>}</td><td>'.__('Assigned/closing team').'</td></tr>
</table>
</td>
<td valign="top">
<table width="100%" border="0" cellspacing=1 cellpadding=1>
<tr><td width="100">%{message}</td><td>Incoming message</td></tr>
<tr><td>%{response}</td><td>Outgoing response</td></tr>
<tr><td>%{comments}</td><td>Assign/transfer comments</td></tr>
<tr><td>%{note}</td><td>Internal note <em>(expandable)</em></td></tr>
<tr><td>%{assignee}</td><td>Assigned staff/team</td></tr>
<tr><td>%{assigner}</td><td>Staff assigning the ticket</td></tr>
<tr><td>%{url}</td><td>osTicket\'s base url (FQDN)</td></tr>
<tr><td width="100">%{message}</td><td>'.__('Incoming message').'</td></tr>
<tr><td>%{response}</td><td>'.__('Outgoing response').'</td></tr>
<tr><td>%{comments}</td><td>'.__('Assign/transfer comments').'</td></tr>
<tr><td>%{note}</td><td>'.__('Internal note <em>(expandable)</em>').'</td></tr>
<tr><td>%{assignee}</td><td>'.__('Assigned staff/team').'</td></tr>
<tr><td>%{assigner}</td><td>'.__('Staff assigning the ticket').'</td></tr>
<tr><td>%{url}</td><td>'.__('osTicket\'s base url (FQDN)').'</td></tr>
</table>
</td>
</tr>
Expand Down
6 changes: 3 additions & 3 deletions include/ajax.kbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ function faq($id, $format='html') {
$resp = sprintf(
'<div style="width:650px;">
<strong>%s</strong><p>%s</p>
<div class="faded">Last updated %s</div>
<div class="faded">'.__('Last updated %s').'</div>
<hr>
<a href="faq.php?id=%d">View</a> | <a href="faq.php?id=%d">Attachments (%s)</a>',
<a href="faq.php?id=%d">'.__('View').'</a> | <a href="faq.php?id=%d">'.__('Attachments').' (%s)</a>',
$faq->getQuestion(),
Format::safe_html($faq->getAnswer()),
Format::db_daydatetime($faq->getUpdateDate()),
$faq->getId(),
$faq->getId(),
$faq->getNumAttachments());
if($thisstaff && $thisstaff->canManageFAQ()) {
$resp.=sprintf(' | <a href="faq.php?id=%d&a=edit">Edit</a>',$faq->getId());
$resp.=sprintf(' | <a href="faq.php?id=%d&a=edit">'.__('Edit').'</a>',$faq->getId());

}
$resp.='</div>';
Expand Down
16 changes: 8 additions & 8 deletions include/ajax.reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
*/
class OverviewReportAjaxAPI extends AjaxController {
function enumTabularGroups() {
return $this->encode(array("dept"=>"Department", "topic"=>"Topics",
return $this->encode(array("dept"=>__("Department"), "topic"=>__("Topics"),
# XXX: This will be relative to permissions based on the
# logged-in-staff. For basic staff, this will be 'My Stats'
"staff"=>"Staff"));
"staff"=>__("Staff")));
}

function getData() {
Expand All @@ -55,7 +55,7 @@ function getData() {
"pk" => "dept_id",
"sort" => 'T1.dept_name',
"fields" => 'T1.dept_name',
"headers" => array('Department'),
"headers" => array(__('Department')),
"filter" => ('T1.dept_id IN ('.implode(',', db_input($thisstaff->getDepts())).')')
),
"topic" => array(
Expand All @@ -65,15 +65,15 @@ function getData() {
"fields" => "CONCAT_WS(' / ',"
."(SELECT P.topic FROM ".TOPIC_TABLE." P WHERE P.topic_id = T1.topic_pid),"
."T1.topic) as name ",
"headers" => array('Help Topic'),
"headers" => array(__('Help Topic')),
"filter" => '1'
),
"staff" => array(
"table" => STAFF_TABLE,
"pk" => 'staff_id',
"sort" => 'name',
"fields" => "CONCAT_WS(' ', T1.firstname, T1.lastname) as name",
"headers" => array('Staff Member'),
"headers" => array(__('Staff Member')),
"filter" =>
('T1.staff_id=S1.staff_id
AND
Expand Down Expand Up @@ -153,8 +153,8 @@ function getData() {
$r[] = null;
}
return array("columns" => array_merge($info['headers'],
array('Opened','Assigned','Overdue','Closed','Reopened',
'Service Time','Response Time')),
array(__('Opened'),__('Assigned'),__('Overdue'),__('Closed'),__('Reopened'),
__('Service Time'),__('Response Time'))),
"data" => $rows);
}

Expand All @@ -168,7 +168,7 @@ function downloadTabularData() {
foreach ($data['data'] as $row)
$csv .= "\n" . '"' . implode('","', $row) . '"';
Http::download(
sprintf('%s-report.csv', $this->get('group', 'Department')),
sprintf('%s-report.csv', $this->get('group', __('Department'))),
'text/csv', $csv);
}

Expand Down
Loading