add language chooser at setup page

This commit is contained in:
printempw 2016-12-31 17:14:19 +08:00
parent 47b0b17c15
commit acedbcce0b
6 changed files with 38 additions and 5 deletions

View File

@ -2,7 +2,7 @@
* @Author: printempw
* @Date: 2016-07-28 13:15:18
* @Last Modified by: printempw
* @Last Modified time: 2016-11-18 15:12:18
* @Last Modified time: 2016-12-31 17:08:19
*/
@import "style.scss";
@ -76,6 +76,12 @@ p {
}
}
#language-chooser {
float: right;
margin-top: 4px;
height: 24px;
}
.step {
margin: 20px 0 15px;
text-align: left;

View File

@ -1,7 +1,10 @@
@extends('setup.wizard.master')
@section('content')
<h1>{{ trans('setup.wizard.finish.title') }}</h1>
<h1>{{ trans('setup.wizard.finish.title') }}
@include('setup.wizard.language')
</h1>
<p>{{ trans('setup.wizard.finish.text') }}</p>
<table class="form-table install-success">

View File

@ -1,7 +1,10 @@
@extends('setup.wizard.master')
@section('content')
<h1>{{ trans('setup.wizard.info.title') }}</h1>
<h1>{{ trans('setup.wizard.info.title') }}
@include('setup.wizard.language')
</h1>
<p>{{ trans('setup.wizard.info.text') }}</p>
<form id="setup" method="post" action="{{ url('setup/finish') }}" novalidate="novalidate">

View File

@ -0,0 +1,5 @@
<select id="language-chooser" onchange="refreshWithLangPrefer()">
@foreach(config('locales') as $code => $langInfo)
<option value="{{ $code }}" {!! $code == config('app.locale') ? 'selected="selected"' : '' !!}>{{ $langInfo['short_name'] }} - {{ $langInfo['name'] }}</option>
@endforeach
</select>

View File

@ -7,6 +7,7 @@
<title>{{ trans('setup.wizard.master.title') }}</title>
<link rel="shortcut icon" href="../resources/assets/images/favicon.ico">
<link rel="stylesheet" type="text/css" href="../resources/assets/dist/css/install.css">
@yield('style')
</head>
<body class="container">
@ -14,6 +15,19 @@
@yield('content')
</body>
<script>
function refreshWithLangPrefer() {
var e = document.getElementById("language-chooser");
var lang = e.options[e.selectedIndex].value;
// set cookie
document.cookie = "locale=" + lang + "; path=/";
location.reload();
}
</script>
@yield('script')
</body>
</html>

View File

@ -1,7 +1,9 @@
@extends('setup.wizard.master')
@section('content')
<h1>{{ trans('setup.wizard.welcome.title') }}</h1>
<h1>{{ trans('setup.wizard.welcome.title') }}
@include('setup.wizard.language')
</h1>
<p>{{ trans('setup.wizard.welcome.text', ['version' => config('app.version')]) }}</p>
<p>{{ trans('setup.database.connection-success', ['server' => $server]) }}</p>