Allow configuring of automatic localization. Closes #1747

This commit is contained in:
James Brooks
2016-05-05 10:41:42 +01:00
parent 9ddf9e3e1a
commit 47e1dff5c5
4 changed files with 19 additions and 1 deletions

View File

@@ -42,8 +42,9 @@ class AppComposer
$view->withAppHeader(Config::get('setting.header'));
$view->withAppFooter(Config::get('setting.footer'));
$view->withAppName($name = Config::get('setting.app_name'));
$view->withAppName(Config::get('setting.app_name'));
$view->withShowSupport($support = Config::get('setting.show_support'));
$view->withAutomaticLocalization(Config::get('setting.automatic_localization'));
if ($support) {
$view->withSiteTitle(Config::get('setting.app_name').' | Cachet');

View File

@@ -55,6 +55,11 @@ class Localize
*/
public function handle(Request $request, Closure $next)
{
// Early exit optimization.
if (!$this->config->get('setting.automatic_localization')) {
return $next($request);
}
$supportedLanguages = $request->getLanguages();
$userLanguage = $this->config->get('app.locale');

View File

@@ -108,6 +108,7 @@ return [
'banner' => 'Banner Image',
'banner-help' => "It's recommended that you upload files no bigger than 930px wide .",
'subscribers' => 'Allow people to signup to email notifications?',
'automatic_localization' => 'Automatically localise your status page to your visitor\'s language?',
],
'analytics' => [
'analytics_google' => 'Google Analytics code',

View File

@@ -84,6 +84,17 @@
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="checkbox">
<label>
<input type="hidden" value="0" name="automatic_localization">
<input type="checkbox" value="1" name="automatic_localization" {{ $automatic_localization ? 'checked' : null }}>
{{ trans('forms.settings.app-setup.automatic_localization') }}
</label>
</div>
</div>
</div>
</fieldset>
<div class="row">