Skip to content
Snippets Groups Projects
Commit 74dcfcb0 authored by Jared Hancock's avatar Jared Hancock
Browse files

i18n: Add localization to the jQuery datepicker

parent 98f83681
Branches
Tags
No related merge requests found
...@@ -23,8 +23,9 @@ class i18nAjaxAPI extends AjaxController { ...@@ -23,8 +23,9 @@ class i18nAjaxAPI extends AjaxController {
$i18n = new Internationalization($lang); $i18n = new Internationalization($lang);
switch ($key) { switch ($key) {
case 'redactor': case 'js':
$data = $i18n->getTemplate('redactor.js')->getRawData(); $data = $i18n->getTemplate('js/redactor.js')->getRawData();
$data .= $i18n->getTemplate('js/jquery.ui.datepicker.js')->getRawData();
header('Content-Type: text/javascript; charset=UTF-8'); header('Content-Type: text/javascript; charset=UTF-8');
break; break;
default: default:
......
...@@ -1155,7 +1155,7 @@ class DatetimePickerWidget extends Widget { ...@@ -1155,7 +1155,7 @@ class DatetimePickerWidget extends Widget {
$_SESSION['TZ_OFFSET']+($_SESSION['TZ_DST']?date('I',$this->value):0); $_SESSION['TZ_OFFSET']+($_SESSION['TZ_DST']?date('I',$this->value):0);
list($hr, $min) = explode(':', date('H:i', $this->value)); list($hr, $min) = explode(':', date('H:i', $this->value));
$this->value = date($cfg->getDateFormat(), $this->value); $this->value = Format::date($cfg->getDateFormat(), $this->value);
} }
?> ?>
<input type="text" name="<?php echo $this->name; ?>" <input type="text" name="<?php echo $this->name; ?>"
...@@ -1176,7 +1176,7 @@ class DatetimePickerWidget extends Widget { ...@@ -1176,7 +1176,7 @@ class DatetimePickerWidget extends Widget {
showButtonPanel: true, showButtonPanel: true,
buttonImage: './images/cal.png', buttonImage: './images/cal.png',
showOn:'both', showOn:'both',
dateFormat: $.translate_format('<?php echo $cfg->getDateFormat(); ?>'), dateFormat: $.translate_format('<?php echo $cfg->getDateFormat(); ?>')
}); });
}); });
</script> </script>
......
...@@ -16,7 +16,7 @@ elseif ($cfg && $cfg->getSystemLanguage()) ...@@ -16,7 +16,7 @@ elseif ($cfg && $cfg->getSystemLanguage())
$lang = $cfg->getSystemLanguage(); $lang = $cfg->getSystemLanguage();
if ($lang && $lang != 'en_US') { ?> if ($lang && $lang != 'en_US') { ?>
<script type="text/javascript" src="ajax.php/i18n/<?php <script type="text/javascript" src="ajax.php/i18n/<?php
echo $thisclient->getLanguage(); ?>/redactor"></script> echo $lang; ?>/js"></script>
<?php } ?> <?php } ?>
</body> </body>
</html> </html>
...@@ -35,7 +35,7 @@ if ($.support.pjax) { ...@@ -35,7 +35,7 @@ if ($.support.pjax) {
<?php <?php
if ($thisstaff && $thisstaff->getLanguage() != 'en_US') { ?> if ($thisstaff && $thisstaff->getLanguage() != 'en_US') { ?>
<script type="text/javascript" src="ajax.php/i18n/<?php <script type="text/javascript" src="ajax.php/i18n/<?php
echo $thisstaff->getLanguage(); ?>/redactor"></script> echo $thisstaff->getLanguage(); ?>/js"></script>
<?php } ?> <?php } ?>
</body> </body>
</html> </html>
......
...@@ -15,6 +15,9 @@ if ($info['topicId'] && ($topic=Topic::lookup($info['topicId']))) { ...@@ -15,6 +15,9 @@ if ($info['topicId'] && ($topic=Topic::lookup($info['topicId']))) {
} }
} }
if ($_POST)
$info['duedate'] = Format::date($cfg->getDateFormat(),
strtotime($info['duedate']));
?> ?>
<form action="tickets.php?a=open" method="post" id="save" enctype="multipart/form-data"> <form action="tickets.php?a=open" method="post" id="save" enctype="multipart/form-data">
<?php csrf_token(); ?> <?php csrf_token(); ?>
......
...@@ -130,10 +130,30 @@ class i18n_Compiler extends Module { ...@@ -130,10 +130,30 @@ class i18n_Compiler extends Module {
'http://imperavi.com/webdownload/redactor/lang/?lang=' 'http://imperavi.com/webdownload/redactor/lang/?lang='
.strtolower($lang)); .strtolower($lang));
if ($code == 200) if ($code == 200)
$phar->addFromString('redactor.js', $js); $phar->addFromString('js/redactor.js', $js);
else else
$this->stderr->write("Unable to fetch Redactor language file\n"); $this->stderr->write("Unable to fetch Redactor language file\n");
// JQuery UI Datepicker
// http://jquery-ui.googlecode.com/svn/tags/latest/ui/i18n/jquery.ui.datepicker-de.js
$langs = array($lang);
if (strpos($lang, '_') !== false) {
@list($short) = explode('_', $lang);
$langs[] = $short;
}
foreach ($langs as $l) {
list($code, $js) = $this->_http_get(
'http://jquery-ui.googlecode.com/svn/tags/latest/ui/i18n/jquery.ui.datepicker-'
.str_replace('_','-',$l).'.js');
if ($code == 200)
break;
}
if ($code == 200)
$phar->addFromString('js/jquery.ui.datepicker.js', $js);
else
$this->stderr->write(str_replace('_','-',$lang)
.": Unable to fetch jQuery UI Datepicker locale file\n");
// TODO: Sign files // TODO: Sign files
// Use a very small stub // Use a very small stub
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment