From 5372de0b6ac55bab915b476d7fbb32350be0a3ff Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Thu, 4 Aug 2022 12:16:21 +0800 Subject: [PATCH] fixed languages --- beike/Admin/View/Components/Sidebar.php | 50 ++++++++++++------------- resources/lang/en/admin/common.php | 13 ++++++- resources/lang/zh_cn/admin/common.php | 14 ++++++- 3 files changed, 49 insertions(+), 28 deletions(-) diff --git a/beike/Admin/View/Components/Sidebar.php b/beike/Admin/View/Components/Sidebar.php index 00c70797..57fb8dd0 100644 --- a/beike/Admin/View/Components/Sidebar.php +++ b/beike/Admin/View/Components/Sidebar.php @@ -37,41 +37,41 @@ class Sidebar extends Component $routeName = str_replace($adminName . '.', '', $routeNameWithPrefix); if (Str::startsWith($routeName, ['home.'])) { - $this->addLink('首页装修', 'design.index', 'fa fa-tachometer-alt', $this->equalRoute('design.index'), true); - $this->addLink('插件列表', 'plugins.index', 'fa fa-tachometer-alt', $this->equalRoute('plugins.index')); - $this->addLink('商品分类', 'categories.index', 'fa fa-tachometer-alt', $this->equalRoute('categories.index')); - $this->addLink('品牌管理', 'brands.index', 'fa fa-tachometer-alt', $this->equalRoute('brands.index')); - $this->addLink('税率设置', 'tax_rates.index', 'fa fa-tachometer-alt', $this->equalRoute('tax_rates.index')); - $this->addLink('语言管理', 'tax_rates.index', 'fa fa-tachometer-alt', $this->equalRoute('tax_rates.index')); - $this->addLink('货币管理', 'currencies.index', 'fa fa-tachometer-alt', $this->equalRoute('currencies.index')); + $this->addLink('design.index', 'fa fa-tachometer-alt', $this->equalRoute('design.index'), true); + $this->addLink('plugins.index', 'fa fa-tachometer-alt', $this->equalRoute('plugins.index')); + $this->addLink('categories.index', 'fa fa-tachometer-alt', $this->equalRoute('categories.index')); + $this->addLink('brands.index', 'fa fa-tachometer-alt', $this->equalRoute('brands.index')); + $this->addLink('tax_rates.index', 'fa fa-tachometer-alt', $this->equalRoute('tax_rates.index')); + $this->addLink('tax_rates.index', 'fa fa-tachometer-alt', $this->equalRoute('tax_rates.index')); + $this->addLink('currencies.index', 'fa fa-tachometer-alt', $this->equalRoute('currencies.index')); } if (Str::startsWith($routeName, ['products.', 'categories.', 'brands.'])) { - $this->addLink('商品分类', 'categories.index', 'fa fa-tachometer-alt', $this->equalRoute('categories.index')); - $this->addLink('商品列表', 'products.index', 'fa fa-tachometer-alt', $this->equalRoute('products.index')); - $this->addLink('品牌管理', 'brands.index', 'fa fa-tachometer-alt', $this->equalRoute('brands.index')); - $this->addLink('回收站', 'products.trashed', 'fa fa-tachometer-alt', $this->equalRoute('products.trashed')); + $this->addLink('categories.index', 'fa fa-tachometer-alt', $this->equalRoute('categories.index')); + $this->addLink('products.index', 'fa fa-tachometer-alt', $this->equalRoute('products.index')); + $this->addLink('brands.index', 'fa fa-tachometer-alt', $this->equalRoute('brands.index')); + $this->addLink('products.trashed', 'fa fa-tachometer-alt', $this->equalRoute('products.trashed')); } if (Str::startsWith($routeName, ['customers.', 'customer_groups.'])) { - $this->addLink('会员管理', 'customers.index', 'fa fa-tachometer-alt', $this->equalRoute('customers.index')); - $this->addLink('用户组', 'customer_groups.index', 'fa fa-tachometer-alt', $this->equalRoute('customer_groups.index')); + $this->addLink('customers.index', 'fa fa-tachometer-alt', $this->equalRoute('customers.index')); + $this->addLink('customer_groups.index', 'fa fa-tachometer-alt', $this->equalRoute('customer_groups.index')); } if (Str::startsWith($routeName, ['orders.', 'rmas.'])) { - $this->addLink('订单列表', 'orders.index', 'fa fa-tachometer-alt', $this->equalRoute('orders.index')); - $this->addLink('售后列表', 'rmas.index', 'fa fa-tachometer-alt', $this->equalRoute('rmas.index')); + $this->addLink('orders.index', 'fa fa-tachometer-alt', $this->equalRoute('orders.index')); + $this->addLink('rmas.index', 'fa fa-tachometer-alt', $this->equalRoute('rmas.index')); } if (Str::startsWith($routeName, ['settings.', 'admin_users.', 'admin_roles.', 'plugins.', 'tax_classes', 'tax_rates', 'regions', 'currencies'])) { - $this->addLink('系统设置', 'settings.index', 'fa fa-tachometer-alt', $this->equalRoute('settings.index')); - $this->addLink('后台用户', 'admin_users.index', 'fa fa-tachometer-alt', $this->equalRoute('admin_users.index')); - $this->addLink('插件列表', 'plugins.index', 'fa fa-tachometer-alt', $this->equalRoute('plugins.index')); - $this->addLink('区域分组', 'regions.index', 'fa fa-tachometer-alt', $this->equalRoute('regions.index')); - $this->addLink('税率设置', 'tax_rates.index', 'fa fa-tachometer-alt', $this->equalRoute('tax_rates.index')); - $this->addLink('税费类别', 'tax_classes.index', 'fa fa-tachometer-alt', $this->equalRoute('tax_classes.index')); - $this->addLink('货币管理', 'currencies.index', 'fa fa-tachometer-alt', $this->equalRoute('currencies.index')); - $this->addLink('首页装修', 'design.index', 'fa fa-tachometer-alt', $this->equalRoute('design.index'), true); + $this->addLink('settings.index', 'fa fa-tachometer-alt', $this->equalRoute('settings.index')); + $this->addLink('admin_users.index', 'fa fa-tachometer-alt', $this->equalRoute('admin_users.index')); + $this->addLink('plugins.index', 'fa fa-tachometer-alt', $this->equalRoute('plugins.index')); + $this->addLink('regions.index', 'fa fa-tachometer-alt', $this->equalRoute('regions.index')); + $this->addLink('tax_rates.index', 'fa fa-tachometer-alt', $this->equalRoute('tax_rates.index')); + $this->addLink('tax_classes.index', 'fa fa-tachometer-alt', $this->equalRoute('tax_classes.index')); + $this->addLink('currencies.index', 'fa fa-tachometer-alt', $this->equalRoute('currencies.index')); + $this->addLink('design.index', 'fa fa-tachometer-alt', $this->equalRoute('design.index'), true); } return view('admin::components.sidebar'); @@ -81,19 +81,19 @@ class Sidebar extends Component /** * 添加左侧菜单链接 * - * @param $title * @param $route * @param $icon * @param $active * @param false $newWindow */ - public function addLink($title, $route, $icon, $active, bool $newWindow = false) + public function addLink($route, $icon, $active, bool $newWindow = false) { $permissionRoute = str_replace('.', '_', $route); if ($this->adminUser->cannot($permissionRoute)) { return; } + $title = trans("admin/common.{$permissionRoute}"); $url = admin_route($route); $this->links[] = [ 'title' => $title, diff --git a/resources/lang/en/admin/common.php b/resources/lang/en/admin/common.php index d8545233..2a52209b 100644 --- a/resources/lang/en/admin/common.php +++ b/resources/lang/en/admin/common.php @@ -12,6 +12,7 @@ return [ 'edit' => '编辑', + // header 'home' => 'Home', 'order' => 'Orders', 'product' => 'Products', @@ -22,5 +23,15 @@ return [ 'region' => 'Region', 'tax_rate' => 'Tax Rate', 'tax_class' => 'Tax Class', - 'currency' => 'Currency' + 'currency' => 'Currency', + + // sidebar + 'settings_index' => 'Setting', + 'admin_users_index' => 'Admin Users', + 'plugins_index' => 'Plugins', + 'regions_index' => 'Regions', + 'tax_rates_index' => 'Tax Rates', + 'tax_classes_index' => 'Tax Classes', + 'currencies_index' => 'Currencies', + 'design_index' => 'Page Builder', ]; diff --git a/resources/lang/zh_cn/admin/common.php b/resources/lang/zh_cn/admin/common.php index b17134aa..3e2963ea 100644 --- a/resources/lang/zh_cn/admin/common.php +++ b/resources/lang/zh_cn/admin/common.php @@ -15,12 +15,22 @@ return [ 'home' => '管理首页', 'order' => '订单管理', 'product' => '商品管理', - 'customer' => '会员管理', + 'customer' => '客户管理', 'setting' => '系统设置', 'plugin' => '插件管理', 'admin_user' => '后台用户', 'region' => '区域分组', 'tax_rate' => '税率管理', 'tax_class' => '税类管理', - 'currency' => '货币管理' + 'currency' => '货币管理', + + // sidebar + 'settings_index' => '系统设置', + 'admin_users_index' => '后台用户', + 'plugins_index' => '插件列表', + 'regions_index' => '区域分组', + 'tax_rates_index' => '税率设置', + 'tax_classes_index' => '税费类别', + 'currencies_index' => '货币管理', + 'design_index' => '首页装修', ];