]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Help.php
Issue 10983: Use the user's settings for the help language
[friendica.git] / src / Module / Help.php
index a65bff6eaec95ecfc517a84bc7176a8d62f6c8c9..f85fd10a73b6143b09e186a506a3556ad3d2a1d8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -26,7 +26,6 @@ use Friendica\Content\Nav;
 use Friendica\Content\Text\Markdown;
 use Friendica\DI;
 use Friendica\Network\HTTPException;
-use Friendica\Util\Strings;
 
 /**
  * Shows the friendica help based on the /doc/ directory
@@ -40,16 +39,16 @@ class Help extends BaseModule
                $text = '';
                $filename = '';
 
-               $a = DI::app();
                $config = DI::config();
-               $lang = $config->get('system', 'language');
-
+               $lang = DI::session()->get('language');
+               $lang = $lang ?? $config->get('system', 'language');
+               
                // @TODO: Replace with parameter from router
-               if ($a->argc > 1) {
+               if (DI::args()->getArgc() > 1) {
                        $path = '';
                        // looping through the argv keys bigger than 0 to build
                        // a path relative to /help
-                       for ($x = 1; $x < $a->argc; $x ++) {
+                       for ($x = 1; $x < DI::args()->getArgc(); $x ++) {
                                if (strlen($path)) {
                                        $path .= '/';
                                }
@@ -59,7 +58,7 @@ class Help extends BaseModule
                        $title = basename($path);
                        $filename = $path;
                        $text = self::loadDocFile('doc/' . $path . '.md', $lang);
-                       DI::page()['title'] = DI::l10n()->t('Help:') . ' ' . str_replace('-', ' ', Strings::escapeTags($title));
+                       DI::page()['title'] = DI::l10n()->t('Help:') . ' ' . str_replace('-', ' ', $title);
                }
 
                $home = self::loadDocFile('doc/Home.md', $lang);