前台后端语言包

This commit is contained in:
TL 2022-08-30 15:15:00 +08:00
parent 4b773c6b18
commit 7fcca73b1d
22 changed files with 100 additions and 24 deletions

View File

@ -34,7 +34,7 @@ class ForgottenController
public function sendVerifyCode(Request $request)
{
AccountService::sendVerifyCodeForForgotten($request->get('email'), 'email');
return json_success('验证码已发送,请查看并输入验证码');
return json_success(trans('shop/forgotten.verification_code_sent'));
}
/**
@ -46,6 +46,6 @@ class ForgottenController
{
AccountService::verifyAndChangePassword($request->get('code'), $request->get('email'), $request->get('password'));
return json_success('密码已修改');
return json_success(trans('shop/forgotten.password_updated'));
}
}

View File

@ -101,9 +101,9 @@ class OrderController extends Controller
$customer = current_customer();
$order = OrderRepo::getOrderByNumber($number, $customer);
if (empty($order)) {
throw new \Exception('无效的订单');
throw new \Exception(trans('shop/order.invalid_order'));
}
$comment = '用户确认收货';
$comment = trans('shop/order.confirm_order');
StateMachineService::getInstance($order)->changeStatus(StateMachineService::COMPLETED, $comment);
return json_success(trans('shop/account.order.completed'));
}
@ -122,9 +122,9 @@ class OrderController extends Controller
$customer = current_customer();
$order = OrderRepo::getOrderByNumber($number, $customer);
if (empty($order)) {
throw new \Exception('无效的订单');
throw new \Exception(trans('shop/order.invalid_order'));
}
$comment = '用户取消订单';
$comment = trans('shop/order.cancel_order');
StateMachineService::getInstance($order)->changeStatus(StateMachineService::CANCELLED, $comment);
return json_success(trans('shop/account.order.cancelled'));
}

View File

@ -65,6 +65,6 @@ class RmaController extends Controller
{
$rma = RmaService::createFromShop($request->only('order_product_id', 'quantity', 'opened', 'rma_reason_id', 'type', 'comment'));
return redirect()->to(shop_route('account.rma.index'))->with('success', '售后服务申请提交成功');
return redirect()->to(shop_route('account.rma.index'))->with('success', trans('common.success'));
}
}

View File

@ -13,7 +13,7 @@ class FileController extends Controller
$path = $file->store($type . '/', 'upload');
return json_success('上传成功', [
return json_success(trans('shop/file.uploaded_success'), [
'url' => asset('upload/' . $path),
'value' => 'upload/' . $path,
]);

View File

@ -24,6 +24,6 @@ class ZoneController extends Controller
'zones' => ZoneRepo::listByCountry($countryId),
];
return json_success('成功!', $data);
return json_success(trans('common.success'), $data);
}
}

View File

@ -20,7 +20,7 @@ class CustomerResource extends JsonResource
'id' => $this->id,
'name' => $this->name,
'email' => $this->email,
'status' => $this->status ? '启用' : '禁用',
'status' => $this->status ? trans('common.enable') : trans('common.disable'),
'avatar' => image_resize($this->avatar),
'from' => $this->from,
'customer_group_name' => $this->customer_group_name,

View File

@ -76,17 +76,17 @@ class AccountService
$verifyCode = VerifyCodeRepo::findByAccount($account);
if ($verifyCode->created_at->addMinutes(10) < Carbon::now()) {
$verifyCode->delete();
throw new \Exception("您的验证码已过期10分钟请重新获取");
throw new \Exception(trans('shop/account.verify_code_expired'));
}
if ($verifyCode->code != $code) {
throw new \Exception("您的验证码错误");
throw new \Exception(trans('shop/account.verify_code_error'));
}
if ($type == 'email') {
$customer = CustomerRepo::findByEmail($account);
if (!$customer) {
throw new \Exception("账号不存在");
throw new \Exception(trans('shop/account.account_not_exist'));
}
} elseif ($type == 'telephone') {
throw new \Exception("暂不支持手机号码找回密码");

View File

@ -35,10 +35,10 @@ class PaymentService
$this->order = $order;
}
if (empty($this->order)) {
throw new \Exception("无效订单");
throw new \Exception(trans('shop/order.invalid_order'));
}
if ($this->order->status != 'unpaid') {
throw new \Exception('订单已支付');
throw new \Exception(trans('shop/order.order_already_paid'));
}
$this->orderId = (int)$this->order->id;
$this->paymentMethodCode = $this->order->payment_method_code;

View File

@ -20,7 +20,7 @@ class OrderTotalService
$amount = $totalService->amount;
$totalData = [
'code' => 'order_total',
'title' => '应付总金额',
'title' => trans('shop/carts.order_total'),
'amount' => $amount,
'amount_format' => currency_format($amount)
];

View File

@ -33,7 +33,7 @@ class ShippingService
$amount = (float)(new $className)->getShippingFee($totalService);
$totalData = [
'code' => 'shipping',
'title' => '运费',
'title' => trans('shop/carts.shipping_fee'),
'amount' => $amount,
'amount_format' => currency_format($amount)
];

View File

@ -22,7 +22,7 @@ class SubtotalService
$amount = collect($carts)->sum('subtotal');
$totalData = [
'code' => 'sub_total',
'title' => '商品总额',
'title' => trans('shop/carts.product_total'),
'amount' => $amount,
'amount_format' => currency_format($amount)
];

View File

@ -29,6 +29,9 @@ return [
'check_details' => 'Check Details',
'all' => 'All',
'items' => 'Items',
'verify_code_expired' => 'The verify code expired (10 minute), please retry.',
'verify_code_error' => 'Verify code error!',
'account_not_exist' => 'Account not exist!',
'edit' => [
'index' => 'Edit',

View File

@ -16,10 +16,11 @@ return [
'commodity' => 'Commodity',
'quantity' => 'Quantity',
'subtotal' => 'Subtotal',
'product_total' => 'Product Totals',
'product_total' => 'Product Total',
'order_total' => 'Order Total',
'shipping_fee' => 'Shipping Fee',
'all' => 'All',
'selected' => 'Selected',
'total_price' => 'Total_Price',
'to_checkout' => 'To Checkout',
'cart_empty' => 'Your shopping cart is empty',
'go_buy' => 'You can go and see what you want to buy',

View File

@ -0,0 +1,14 @@
<?php
/**
* file.php
*
* @copyright 2022 opencart.cn - All Rights Reserved
* @link http://www.guangdawangluo.com
* @author TL <mengwb@opencart.cn>
* @created 2022-08-30 12:03:19
* @modified 2022-08-30 12:03:19
*/
return [
'uploaded_success' => 'Uploaded Success',
];

View File

@ -1,7 +1,7 @@
<?php
/**
* currency.php
* forgotten.php
*
* @copyright 2022 opencart.cn - All Rights Reserved
* @link http://www.guangdawangluo.com
@ -28,4 +28,6 @@ return [
'password_err' => 'The passwords entered twice do not match!',
'email_err' => 'Please enter a valid email address!',
'enter_code' => 'Please enter verification code',
'verification_code_sent' => 'Verification code has sent. Please input the code',
'password_updated' => 'Password updated',
];

View File

@ -0,0 +1,18 @@
<?php
/**
* order.php
*
* @copyright 2022 opencart.cn - All Rights Reserved
* @link http://www.guangdawangluo.com
* @author TL <mengwb@opencart.cn>
* @created 2022-07-28 17:21:38
* @modified 2022-07-28 17:21:38
*/
return [
'invalid_order' => 'Invalid order',
'confirm_order' => 'Customer confirm received package',
'cancel_order' => 'Customer cancel the order',
'order_already_paid' => 'The order is paid already',
];

View File

@ -29,6 +29,9 @@ return [
'check_details' => '查看详情',
'all' => '共',
'items' => '件商品',
'verify_code_expired' => '您的验证码已过期10分钟请重新获取',
'verify_code_error' => '您的验证码错误',
'account_not_exist' => '账号不存在',
'edit' => [
'index' => '修改个人信息',

View File

@ -17,9 +17,10 @@ return [
'quantity' => '数量',
'subtotal' => '小计',
'product_total' => '商品总计',
'order_total' => '应付总金额',
'shipping_fee' => '运费',
'all' => '全部',
'selected' => '已选',
'total_price' => '总价',
'to_checkout' => '去结账',
'cart_empty' => '您的购物车是空的',
'go_buy' => '您可以去看看有哪些想买的',

View File

@ -0,0 +1,14 @@
<?php
/**
* file.php
*
* @copyright 2022 opencart.cn - All Rights Reserved
* @link http://www.guangdawangluo.com
* @author TL <mengwb@opencart.cn>
* @created 2022-08-30 12:03:19
* @modified 2022-08-30 12:03:19
*/
return [
'uploaded_success' => '上传成功',
];

View File

@ -1,7 +1,7 @@
<?php
/**
* currency.php
* forgotten.php
*
* @copyright 2022 opencart.cn - All Rights Reserved
* @link http://www.guangdawangluo.com
@ -28,4 +28,6 @@ return [
'password_err' => '两次输入密码不一致!',
'email_err' => '请输入正确邮箱地址!',
'enter_code' => '请输入验证码',
'verification_code_sent' => '验证码已发送,请查看并输入验证码',
'password_updated' => '密码已修改',
];

View File

@ -0,0 +1,18 @@
<?php
/**
* order.php
*
* @copyright 2022 opencart.cn - All Rights Reserved
* @link http://www.guangdawangluo.com
* @author TL <mengwb@opencart.cn>
* @created 2022-07-28 17:21:38
* @modified 2022-07-28 17:21:38
*/
return [
'invalid_order' => '无效的订单',
'confirm_order' => '用户确认收货',
'cancel_order' => '用户取消订单',
'order_already_paid' => '订单已支付',
];

View File

@ -78,7 +78,7 @@
<ul class="list-group list-group-flush">
<li class="list-group-item"><span>{{ __('shop/carts.all') }}</span><span>@{{ products.length }}</span></li>
<li class="list-group-item"><span>{{ __('shop/carts.selected') }}</span><span>@{{ total_quantity }}</span></li>
<li class="list-group-item border-bottom-0"><span>{{ __('shop/carts.total_price') }}</span><span class="total-price">@{{ amount_format }}</span></li>
<li class="list-group-item border-bottom-0"><span>{{ __('shop/carts.product_total') }}</span><span class="total-price">@{{ amount_format }}</span></li>
<li class="list-group-item d-grid gap-2 mt-3 border-bottom-0">
{{-- <a href="{{ shop_route('checkout.index', 'checkout') }}" class="btn btn-primary">去结账</a> --}}
<button type="button" class="btn btn-primary" @click="checkedBtnToCheckout">{{ __('shop/carts.to_checkout') }}</button>