FEATURE: add language to content pages
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
<?php namespace App\Providers;
|
||||
|
||||
use App\Models\File;
|
||||
use App\Models\Language;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
@@ -12,13 +10,20 @@ class LaravelLocalizationServiceProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
|
||||
$languages = DB::table('languages')->get();
|
||||
$languages = DB::table('languages')
|
||||
->get();
|
||||
|
||||
$supportedLocales = ['en' => ['native' => 'English', 'script' => 'Latn', 'name' => 'common.lang.english']];
|
||||
$supportedLocales = [
|
||||
config('app.locale') => [
|
||||
'native' => env('LOCALE_NATIVE_NAME'),
|
||||
'script' => env('LOCALE_SCRIPT'),
|
||||
'name' => env('LOCALE_TRANSLATED_NAME'),
|
||||
]
|
||||
];
|
||||
foreach ($languages as $language) {
|
||||
$supportedLocales[$language->code] = [
|
||||
'native' => $language->native,
|
||||
'name' => $language->name,
|
||||
'name' => $language->name,
|
||||
'script' => $language->script
|
||||
];
|
||||
}
|
||||
@@ -30,7 +35,8 @@ class LaravelLocalizationServiceProvider extends ServiceProvider
|
||||
]);
|
||||
}
|
||||
|
||||
public function boot() {
|
||||
\App::setLocale(LaravelLocalization::setLocale());
|
||||
public function boot()
|
||||
{
|
||||
\App::setLocale(LaravelLocalization::getCurrentLocale());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user