aboutsummaryrefslogtreecommitdiffstats
path: root/include/help.php
diff options
context:
space:
mode:
authorgit-marijus <mario@mariovavti.com>2017-11-04 10:18:34 +0100
committerGitHub <noreply@github.com>2017-11-04 10:18:34 +0100
commit39c194c5c32e49f461b8b42a3f4e411a3a5cde3c (patch)
tree8ca92c3e6e31166920b02913e89d580025bf6edf /include/help.php
parent9dfb471c0bbf2978e528689f6c0885ff9abddc7d (diff)
parent1be98d7b7fea30a929d27e7aa0b1412da3276b2c (diff)
downloadvolse-hubzilla-39c194c5c32e49f461b8b42a3f4e411a3a5cde3c.tar.gz
volse-hubzilla-39c194c5c32e49f461b8b42a3f4e411a3a5cde3c.tar.bz2
volse-hubzilla-39c194c5c32e49f461b8b42a3f4e411a3a5cde3c.zip
Merge pull request #891 from dawnbreak/langlibs
Langlibs updates
Diffstat (limited to 'include/help.php')
-rw-r--r--include/help.php28
1 files changed, 17 insertions, 11 deletions
diff --git a/include/help.php b/include/help.php
index 02c3cb8e4..0dc37e517 100644
--- a/include/help.php
+++ b/include/help.php
@@ -28,7 +28,7 @@ function get_help_content($tocpath = false) {
}
if($path) {
-
+
$title = basename($path);
if(! $tocpath)
\App::$page['title'] = t('Help:') . ' ' . ucwords(str_replace('-',' ',notags($title)));
@@ -38,10 +38,10 @@ function get_help_content($tocpath = false) {
// available and so default back to the English TOC at /doc/toc.{html,bb,md}
// TODO: This is incompatible with the hierarchical TOC construction
// defined in /Zotlabs/Widget/Helpindex.php.
- if($tocpath !== false &&
- load_doc_file('doc/' . $path . '.md') === '' &&
- load_doc_file('doc/' . $path . '.bb') === '' &&
- load_doc_file('doc/' . $path . '.html') === ''
+ if($tocpath !== false &&
+ load_doc_file('doc/' . $path . '.md') === '' &&
+ load_doc_file('doc/' . $path . '.bb') === '' &&
+ load_doc_file('doc/' . $path . '.html') === ''
) {
$path = $title;
}
@@ -120,22 +120,28 @@ function preg_callback_help_include($matches) {
}
+/**
+ * @brief
+ *
+ * @return boolean|array
+ */
function determine_help_language() {
- require_once('Text/LanguageDetect.php');
$lang_detect = new Text_LanguageDetect();
// Set this mode to recognize language by the short code like "en", "ru", etc.
$lang_detect->setNameMode(2);
- // If the language was specified in the URL, override the language preference
+ // If the language was specified in the URL, override the language preference
// of the browser. Default to English if both of these are absent.
if($lang_detect->languageExists(argv(1))) {
$lang = argv(1);
$from_url = true;
} else {
$lang = \App::$language;
- if(! isset($lang))
+ if(! isset($lang))
$lang = 'en';
+
$from_url = false;
}
+
return array('language' => $lang, 'from_url' => $from_url);
}
@@ -145,14 +151,14 @@ function load_doc_file($s) {
$x = determine_help_language();
$lang = $x['language'];
$url_idx = ($x['from_url'] ? 1 : 0);
- // The English translation is at the root of /doc/. Other languages are in
+ // The English translation is at the root of /doc/. Other languages are in
// subfolders named by the language code such as "de", "es", etc.
if($lang !== 'en') {
- $path .= '/' . $lang;
+ $path .= '/' . $lang;
}
$b = basename($s);
-
+
for($i=1+$url_idx; $i<argc()-1; $i++) {
$path .= '/' . argv($i);
}