Show localized documentation if available
This commit is contained in:
@@ -13,6 +13,7 @@ Improvements:
|
|||||||
* Creating another task stay in the popover (no full page refresh anymore)
|
* Creating another task stay in the popover (no full page refresh anymore)
|
||||||
* Avoid scrollbar in Gantt chart for row title on Windows platform
|
* Avoid scrollbar in Gantt chart for row title on Windows platform
|
||||||
* Remove unnecessary margin for calendar header
|
* Remove unnecessary margin for calendar header
|
||||||
|
* Show localized documentation if available
|
||||||
|
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
|
|
||||||
|
|||||||
@@ -32,16 +32,24 @@ class Doc extends Base
|
|||||||
|
|
||||||
public function show()
|
public function show()
|
||||||
{
|
{
|
||||||
$filename = $this->request->getStringParam('file', 'index');
|
$page = $this->request->getStringParam('file', 'index');
|
||||||
|
|
||||||
if (! preg_match('/^[a-z0-9\-]+/', $filename)) {
|
if (! preg_match('/^[a-z0-9\-]+/', $page)) {
|
||||||
$filename = 'index';
|
$page = 'index';
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename = __DIR__.'/../../doc/'.$filename.'.markdown';
|
$filenames = array(__DIR__.'/../../doc/'.$page.'.markdown');
|
||||||
|
$filename = __DIR__.'/../../doc/index.markdown';
|
||||||
|
|
||||||
if (! file_exists($filename)) {
|
if ($this->config->getCurrentLanguage() === 'fr_FR') {
|
||||||
$filename = __DIR__.'/../../doc/index.markdown';
|
array_unshift($filenames, __DIR__.'/../../doc/fr/'.$page.'.markdown');
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($filenames as $file) {
|
||||||
|
if (file_exists($file)) {
|
||||||
|
$filename = $file;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->response->html($this->template->layout('doc/show', $this->readFile($filename) + array(
|
$this->response->html($this->template->layout('doc/show', $this->readFile($filename) + array(
|
||||||
|
|||||||
Reference in New Issue
Block a user