Add basic language picker

This commit is contained in:
Daniel Supernault 2018-06-05 01:49:05 -06:00
parent be2f3873e9
commit a817875064
5 changed files with 34 additions and 2 deletions

View file

@ -2,9 +2,17 @@
namespace App\Http\Controllers;
use App;
use Illuminate\Http\Request;
class SiteController extends Controller
{
public function changeLocale(Request $request, $locale)
{
if(!App::isLocale($locale)) {
return redirect()->back();
}
App::setLocale($locale);
return redirect()->back();
}
}

View file

@ -10,7 +10,7 @@
<a href="#" class="text-primary pr-2">Directory</a>
<a href="#" class="text-primary pr-2">Profiles</a>
<a href="#" class="text-primary pr-2">Hashtags</a>
<a href="#" class="text-primary ">Language</a>
<a href="{{route('site.language')}}" class="text-primary">Language</a>
<a href="#" class="text-dark float-right">© {{date('Y')}} PixelFed.org</a>
</p>
</div>

View file

@ -0,0 +1,19 @@
@extends('site.partial.template')
@section('section')
<div class="title">
<h3 class="font-weight-bold">Language</h3>
</div>
<hr>
<div class="alert alert-info font-weight-bold">We're still working on localization support!</div>
<p class="lead">Current Locale: <span class="font-weight-bold">{{App::getLocale()}}</span></p>
<p class="lead">Select from one of the supported languages:</p>
<ul class="list-group">
<a class="list-group-item font-weight-bold" href="/i/lang/en">English</a>
</ul>
@endsection
@push('meta')
<meta property="og:description" content="Language">
@endpush

View file

@ -9,6 +9,9 @@
<li class="nav-item pl-3 {{request()->is('site/help')?'active':''}}">
<a class="nav-link lead text-muted" href="{{route('site.help')}}">Help</a>
</li>
<li class="nav-item pl-3 {{request()->is('site/language')?'active':''}}">
<a class="nav-link lead text-muted" href="{{route('site.language')}}">Language</a>
</li>
<li class="nav-item">
<hr>
</li>

View file

@ -61,6 +61,7 @@ Route::domain(config('pixelfed.domain.app'))->group(function() {
Route::post('like', 'LikeController@store');
Route::post('follow', 'FollowerController@store');
Route::post('bookmark', 'BookmarkController@store');
Route::get('lang/{locale}', 'SiteController@changeLocale');
Route::group(['prefix' => 'report'], function() {
Route::get('/', 'ReportController@showForm')->name('report.form');
@ -123,6 +124,7 @@ Route::domain(config('pixelfed.domain.app'))->group(function() {
Route::view('privacy', 'site.privacy')->name('site.privacy');
Route::view('platform', 'site.platform')->name('site.platform');
Route::view('libraries', 'site.libraries')->name('site.libraries');
Route::view('language', 'site.language')->name('site.language');
});
Route::get('p/{username}/{id}/c/{cid}', 'CommentController@show');