Add language in cache as well.

This commit is contained in:
James Cole
2016-04-09 09:27:04 +02:00
parent 6e4991a34b
commit 0715b7406e
3 changed files with 12 additions and 9 deletions

View File

@@ -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 Controller
if ($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);