|
|
@@ -107,6 +107,7 @@ class AdminServiceProvider extends ServiceProvider
|
|
|
{
|
|
|
$this->registerDefaultSections();
|
|
|
$this->registerViews();
|
|
|
+ $this->registerTranslations();
|
|
|
$this->ensureHttps();
|
|
|
$this->bootApplication();
|
|
|
$this->registerPublishing();
|
|
|
@@ -127,6 +128,21 @@ class AdminServiceProvider extends ServiceProvider
|
|
|
$this->loadViewsFrom(__DIR__.'/../resources/views', 'admin');
|
|
|
}
|
|
|
|
|
|
+ protected function registerTranslations()
|
|
|
+ {
|
|
|
+ // For Laravel 11 compatibility, we need to merge translations into the main lang directory
|
|
|
+ // instead of using a namespace, so that __('admin.key') works without admin:: prefix
|
|
|
+ $langPath = $this->app->langPath();
|
|
|
+ $adminLangPath = __DIR__.'/../resources/lang';
|
|
|
+
|
|
|
+ // Check if admin translations are already published
|
|
|
+ if (!file_exists($langPath.'/zh_CN/admin.php') && file_exists($adminLangPath)) {
|
|
|
+ // Load translations from vendor directory without namespace
|
|
|
+ $this->loadTranslationsFrom($adminLangPath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 是否强制使用https.
|
|
|
*
|