From 98f836815b9a34fe72b4bf3b21077d260eeca9e1 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Sun, 2 Feb 2014 17:02:04 -0600 Subject: [PATCH] i18n: Make Redactor translated for client panel This requires a hidden setting for the system language or the language selection of the client (also currently hidden). --- ajax.php | 3 +++ include/ajax.config.php | 1 + include/client/footer.inc.php | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/ajax.php b/ajax.php index 3374776c7..60fca4337 100644 --- a/ajax.php +++ b/ajax.php @@ -37,6 +37,9 @@ $dispatcher = patterns('', )), url('^/form/', patterns('ajax.forms.php:DynamicFormsAjaxAPI', url_get('^help-topic/(?P<id>\d+)$', 'getClientFormsForHelpTopic') + )), + url('^/i18n/(?P<lang>[\w_]+)/', patterns('ajax.i18n.php:i18nAjaxAPI', + url_get('(?P<tag>\w+)$', 'getLanguageFile') )) ); Signal::send('ajax.client', $dispatcher); diff --git a/include/ajax.config.php b/include/ajax.config.php index e0df37d97..98053cf33 100644 --- a/include/ajax.config.php +++ b/include/ajax.config.php @@ -47,6 +47,7 @@ class ConfigAjaxAPI extends AjaxController { $config = $this->json_encode($config); Http::cacheable(md5($config), $cfg->lastModified()); + header('Content-Type: application/json; charset=UTF-8'); return $config; } diff --git a/include/client/footer.inc.php b/include/client/footer.inc.php index 45588e7c2..44acf45cf 100644 --- a/include/client/footer.inc.php +++ b/include/client/footer.inc.php @@ -9,5 +9,14 @@ <h4><?php echo __('Please Wait!');?></h4> <p><?php echo __('Please wait... it will take a second!');?></p> </div> +<?php +if ($thisclient && $thisclient instanceof EndUser) + $lang = $thisclient->getLanguage(); +elseif ($cfg && $cfg->getSystemLanguage()) + $lang = $cfg->getSystemLanguage(); +if ($lang && $lang != 'en_US') { ?> + <script type="text/javascript" src="ajax.php/i18n/<?php + echo $thisclient->getLanguage(); ?>/redactor"></script> +<?php } ?> </body> </html> -- GitLab