Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Add language in cache as well.
James Cole0715b7406e3e
diff --git a/app/Helpers/Help/Help.php b/app/Helpers/Help/Help.phpindex 36ffa3f9e2..25fa36fe99 100644--- a/app/Helpers/Help/Help.php+++ b/app/Helpers/Help/Help.php@@ -91,13 +91,14 @@ class Help implements HelpInterface/**** @param string $route+ * @param string $language* @param array $content** @internal param $title*/- public function putInCache(string $route, array $content)+ public function putInCache(string $route, string $language, array $content){- Cache::put('help.' . $route . '.text', $content['text'], 10080); // a week.- Cache::put('help.' . $route . '.title', $content['title'], 10080);+ Cache::put('help.' . $route . '.text.' . $language, $content['text'], 10080); // a week.+ Cache::put('help.' . $route . '.title.' . $language, $content['title'], 10080);}}diff --git a/app/Helpers/Help/HelpInterface.php b/app/Helpers/Help/HelpInterface.phpindex 5f2c07b215..28c30e11ea 100644--- a/app/Helpers/Help/HelpInterface.php+++ b/app/Helpers/Help/HelpInterface.php@@ -41,7 +41,8 @@ interface HelpInterface/*** @param string $route+ * @param string $language* @param array $content*/- public function putInCache(string $route, array $content);+ public function putInCache(string $route, string $language, array $content);}diff --git a/app/Http/Controllers/HelpController.php b/app/Http/Controllers/HelpController.phpindex 5f1d5d4d03..9f7b58ff78 100644--- a/app/Http/Controllers/HelpController.php+++ b/app/Http/Controllers/HelpController.php@@ -28,7 +28,8 @@ class HelpController extends Controller*/public function show(HelpInterface $help, string $route){- $content = [+ $language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;+ $content = ['text' => '<p>' . strval(trans('firefly.route_has_no_help')) . '</p>','title' => 'Help',];@@ -41,17 +42,17 @@ class HelpController extends Controllerif ($help->inCache($route)) {$content = [- 'text' => $help->getFromCache('help.' . $route . '.text'),- 'title' => $help->getFromCache('help.' . $route . '.title'),+ 'text' => $help->getFromCache('help.' . $route . '.text.' . $language),+ 'title' => $help->getFromCache('help.' . $route . '.title.' . $language),];return Response::json($content);}- $language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;+Log::debug('Will get help from Github for language "' . $language . '" and route "' . $route . '".');$content = $help->getFromGithub($language, $route);- $help->putInCache($route, $content);+ $help->putInCache($route, $language, $content);return Response::json($content);