aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorgit-marijus <mario@mariovavti.com>2017-08-24 20:13:11 +0200
committerGitHub <noreply@github.com>2017-08-24 20:13:11 +0200
commitdf2725a360f173d7521d8a552608014968763288 (patch)
tree4b21b79c07fd26125b60396a8326af58ea5917b3 /include
parent9d5b6858ea627b5eb6115cacd870ef0277f87b2a (diff)
parent592cf893c006f24c652902fa4fae7d2d94496c3c (diff)
downloadvolse-hubzilla-df2725a360f173d7521d8a552608014968763288.tar.gz
volse-hubzilla-df2725a360f173d7521d8a552608014968763288.tar.bz2
volse-hubzilla-df2725a360f173d7521d8a552608014968763288.zip
Merge pull request #848 from anaqreon/doco
Repaired and extended support for help page translations including ta…
Diffstat (limited to 'include')
-rw-r--r--include/help.php39
1 files changed, 29 insertions, 10 deletions
diff --git a/include/help.php b/include/help.php
index 4f9251b1b..f38f77854 100644
--- a/include/help.php
+++ b/include/help.php
@@ -107,20 +107,39 @@ function preg_callback_help_include($matches) {
}
-
+function determine_help_language() {
+ require_once('Text/LanguageDetect.php');
+ $lang_detect = new Text_LanguageDetect();
+ $lang_detect->setNameMode(2);
+ if($lang_detect->languageExists(argv(1))) {
+ $lang = argv(1);
+ $from_url = true;
+ } else {
+ $lang = \App::$language;
+ if(! isset($lang))
+ $lang = 'en';
+ $from_url = false;
+ }
+ return array('language' => $lang, 'from_url' => $from_url);
+}
function load_doc_file($s) {
- $lang = \App::$language;
- if(! isset($lang))
- $lang = 'en';
+ $path = 'doc';
+ $x = determine_help_language();
+ $lang = $x['language'];
+ $url_idx = ($x['from_url'] ? 1 : 0);
+ if($lang !== 'en') {
+ $path .= '/' . $lang;
+ }
+
$b = basename($s);
- $d = dirname($s);
-
- if($dirname !== '-') {
- $c = find_doc_file("$d/$lang/$b");
- if($c)
- return $c;
+
+ for($i=1+$url_idx; $i<argc()-1; $i++) {
+ $path .= '/' . argv($i);
}
+ $c = find_doc_file($path . '/' . $b);
+ if($c)
+ return $c;
$c = find_doc_file($s);
if($c)
return $c;