summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-09-12 20:48:54 -0400
committerFrederic Guillot <fred@kanboard.net>2015-09-12 20:48:54 -0400
commitc405f99fc8b7420b3e69c633b3259756a1ceb2f2 (patch)
treeaf358f6bced53911d8da60a80d60c4287363ae54 /app/Controller
parentde5049039cbe1373829fa41483bbfc9b162d5f41 (diff)
Show localized documentation if available
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Doc.php20
1 files changed, 14 insertions, 6 deletions
diff --git a/app/Controller/Doc.php b/app/Controller/Doc.php
index d9f7b5e7..f9f0a675 100644
--- a/app/Controller/Doc.php
+++ b/app/Controller/Doc.php
@@ -32,16 +32,24 @@ class Doc extends Base
public function show()
{
- $filename = $this->request->getStringParam('file', 'index');
+ $page = $this->request->getStringParam('file', 'index');
- if (! preg_match('/^[a-z0-9\-]+/', $filename)) {
- $filename = 'index';
+ if (! preg_match('/^[a-z0-9\-]+/', $page)) {
+ $page = 'index';
}
- $filename = __DIR__.'/../../doc/'.$filename.'.markdown';
+ $filenames = array(__DIR__.'/../../doc/'.$page.'.markdown');
+ $filename = __DIR__.'/../../doc/index.markdown';
- if (! file_exists($filename)) {
- $filename = __DIR__.'/../../doc/index.markdown';
+ if ($this->config->getCurrentLanguage() === 'fr_FR') {
+ 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(