mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Add basic language picker
This commit is contained in:
parent
be2f3873e9
commit
a817875064
5 changed files with 34 additions and 2 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
19
resources/views/site/language.blade.php
Normal file
19
resources/views/site/language.blade.php
Normal 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
|
|
@ -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>
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in a new issue