¨4.0.1¨

This commit is contained in:
¨NW¨
2023-12-03 14:07:47 +00:00
parent c08b36d1b6
commit f35052522d
1112 changed files with 43019 additions and 24987 deletions

View File

@@ -4,15 +4,12 @@ namespace Modules\Translation\Providers;
use Illuminate\Support\Carbon;
use Astrotomic\Translatable\Locales;
use Modules\Support\Traits\AddsAsset;
use Illuminate\Translation\Translator;
use Illuminate\Support\ServiceProvider;
use Modules\Translation\TranslationLoader;
class TranslationServiceProvider extends ServiceProvider
{
use AddsAsset;
/**
* Bootstrap any application services.
*
@@ -20,27 +17,15 @@ class TranslationServiceProvider extends ServiceProvider
*/
public function boot()
{
if (! config('app.installed')) {
if (!config('app.installed')) {
return;
}
Carbon::setLocale(locale());
$this->setupTranslatable();
$this->addAdminAssets('admin.translations.index', ['admin.translation.css', 'admin.translation.js']);
}
private function setupTranslatable()
{
$this->app['config']->set('translatable.use_fallback', true);
$this->app['config']->set('translatable.fallback_locale', setting('default_locale'));
$this->app['config']->set('translatable.locales', supported_locale_keys());
// Re-register translatable locales helper after overriding config.
$this->app->singleton('translatable.locales', Locales::class);
$this->app->singleton(Locales::class);
}
/**
* Register the service provider.
@@ -54,6 +39,19 @@ class TranslationServiceProvider extends ServiceProvider
$this->registerTranslator();
}
private function setupTranslatable()
{
$this->app['config']->set('translatable.use_fallback', true);
$this->app['config']->set('translatable.fallback_locale', setting('default_locale'));
$this->app['config']->set('translatable.locales', supported_locale_keys());
// Re-register translatable locales helper after overriding config.
$this->app->singleton('translatable.locales', Locales::class);
$this->app->singleton(Locales::class);
}
private function registerLoader()
{
$this->app->singleton('translation.loader', function ($app) {
@@ -61,6 +59,7 @@ class TranslationServiceProvider extends ServiceProvider
});
}
private function registerTranslator()
{
$this->app->singleton('translator', function ($app) {