fixed admin languages
This commit is contained in:
parent
f14ef5a029
commit
3b1eaca6fb
|
|
@ -31,5 +31,33 @@ class ShareViewData
|
|||
View::share('languages', LanguageRepo::enabled());
|
||||
View::share('shop_base_url', shop_route('home.index'));
|
||||
View::share('categories', hook_filter('header.categories', CategoryRepo::getTwoLevelCategories()));
|
||||
|
||||
if (is_admin()) {
|
||||
View::share('admin_languages', $this->handleAdminLanguages());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理后台语言包列表
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function handleAdminLanguages(): array
|
||||
{
|
||||
$items = [];
|
||||
$languages = admin_languages();
|
||||
foreach ($languages as $language) {
|
||||
$path = lang_path("{$language}/admin/base.php");
|
||||
if (file_exists($path)) {
|
||||
$baseData = require_once($path);
|
||||
}
|
||||
$name = $baseData['name'] ?? '';
|
||||
$items[] = [
|
||||
'code' => $language,
|
||||
'name' => $name,
|
||||
];
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
namespace Beike\Services;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Beike\Repositories\BrandRepo;
|
||||
use Beike\Repositories\ProductRepo;
|
||||
use Beike\Shop\Http\Resources\BrandDetail;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DesignService
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
/**
|
||||
* base.php
|
||||
*
|
||||
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||
* @link http://www.guangdawangluo.com
|
||||
* @author Edward Yang <yangjin@opencart.cn>
|
||||
* @created 2022-08-04 15:29:49
|
||||
* @modified 2022-08-04 15:29:49
|
||||
*/
|
||||
|
||||
return [
|
||||
'name' => 'English',
|
||||
];
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
/**
|
||||
* base.php
|
||||
*
|
||||
* @copyright 2022 opencart.cn - All Rights Reserved
|
||||
* @link http://www.guangdawangluo.com
|
||||
* @author Edward Yang <yangjin@opencart.cn>
|
||||
* @created 2022-08-04 15:29:49
|
||||
* @modified 2022-08-04 15:29:49
|
||||
*/
|
||||
|
||||
return [
|
||||
'name' => '简体中文',
|
||||
];
|
||||
Loading…
Reference in New Issue