Kaynağa Gözat

Merge pull request #433 from hardywu/master

支持动态改变界面语言
Bruskyii Panda 8 yıl önce
ebeveyn
işleme
27e48abc9d

+ 7 - 0
app/Http/Controllers/UserController.php

@@ -1204,4 +1204,11 @@ class UserController extends Controller
             return Response::json(['status' => 'fail', 'data' => '', 'message' => '充值失败']);
         }
     }
+
+    public function switchLang(Request $request, $locale)
+    {
+        $request->session()->put("locale", $locale);
+        return Redirect::back();
+    }
+
 }

+ 1 - 0
app/Http/Kernel.php

@@ -31,6 +31,7 @@ class Kernel extends HttpKernel
             \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
             \Illuminate\Session\Middleware\StartSession::class,
             // \Illuminate\Session\Middleware\AuthenticateSession::class,
+            \App\Http\Middleware\SetLocale::class,
             \Illuminate\View\Middleware\ShareErrorsFromSession::class,
             \App\Http\Middleware\VerifyCsrfToken::class,
             \Illuminate\Routing\Middleware\SubstituteBindings::class,

+ 33 - 0
app/Http/Middleware/SetLocale.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use Closure;
+use Session;
+use Illuminate\Support\Facades\App;
+
+class SetLocale {
+    /**
+     * Handle an incoming request.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \Closure  $next
+     * @return mixed
+     */
+    public function handle($request, Closure $next)
+    {
+        if (Session::has('locale'))
+        {
+            App::setLocale(Session::get('locale'));
+        }
+
+        if ($request->query('locale'))
+        {
+            Session::put('locale', $request->query('locale'));
+            App::setLocale($request->query('locale'));
+        }
+
+        return $next($request);
+    }
+
+}

+ 44 - 0
resources/lang/en/home.php

@@ -32,7 +32,43 @@ return [
     'account_bandwidth_usage' => 'Bandwidth Usage',
     'account_total_traffic' => 'Total',
     'account_usage_traffic' => 'Usage',
+    'account_reset_notice' => ' reset bandwidth on day :reset_day of each month',
     'article_title' => 'Article List',
+    'recharge' => 'Recharge',
+    'enabled' => 'normal',
+    'disabled' => 'disabled',
+    'nerver_used' => 'never used',
+    'expired' => 'expired',
+    'never_loggedin' => 'never logged in',
+    'announcement' => 'Announcement',
+    'recharge_balance' => 'Recharge Balance',
+    'payment_method' => 'charge method',
+    'close' => 'Close',
+    'redeem_score' => 'Redeem for bandwidth',
+    'redeem' => 'Redeem',
+    'redeem_info' => 'You have got :score points and can redeem :scoreM free bandwidth.',
+    'coupon_code' => 'Coupon Code',
+    'please_input_coupon' => 'Please input the coupon code',
+    'scan_qrcode' => 'Scan qrcode with your client',
+    'setting_info' => 'Setting Information',
+    'ratio' => 'traffic  ratio',
+    'coupon_not_empty' => 'coupon code can not be empty',
+    'recharging' => 'Recharging...',
+    'error_response' => 'Error reponse, please retry',
+    'error' => 'Error',
+
+    // 用户资料
+    'submit' => 'submit',
+    'contact' => 'contact',
+    'ssr_setting' => 'SSR setting',
+    'password' => 'password',
+    'new_password' => 'new password',
+    'current_password' => 'current password',
+    'wechat' => 'wechat',
+    'connection_password' => 'connection password',
+    'encrpytion' => 'encrpytion',
+    'protocal' => 'protocal',
+    'obfs' => 'obfs',
 
     // 购买服务
     'service_title' => 'Services',
@@ -57,6 +93,8 @@ return [
     'traffic_log_30days' => '30Days Statistics',
     'traffic_log_24hours' => '24Hours Statistics',
     'traffic_log_keywords' => 'Bandwidth',
+    'traffic_log_unit' => 'unit: M',
+    'traffic_log_max' => 'Max',
 
     // 邀请码
     'invite_code_make' => 'Generate Invite Code',
@@ -72,6 +110,7 @@ return [
     'invite_code_table_status_un' => 'Active',
     'invite_code_table_status_yes' => 'Already Used',
     'invite_code_table_status_expire' => 'Overdue',
+    'invite_code_summary' => 'total of :total invite codes',
 
     // 单据
     'invoice_title' => 'My Invoices',
@@ -114,4 +153,9 @@ return [
     'referral_table_date' => 'Date',
     'referral_table_none' => 'None Data',
     'referral_table_apply' => 'Apply',
+    'referral_summary' => 'total of :total records, total rewards of :amount RMB, minimum withdraw limit of :money RMB.',
+    'console' => 'Console',
+    'profile' => 'Profile',
+    'logout' => 'Log out',
+    'promote' => 'Any actived freind you invited would bring you :traffic brandwidth as bonus. Meanwhile, you will get :referral_percent% cash reward every time your invited friends make payments.',
 ];

+ 44 - 0
resources/lang/zh-CN/home.php

@@ -32,7 +32,43 @@ return [
     'account_bandwidth_usage' => '已用流量',
     'account_total_traffic' => '共计',
     'account_usage_traffic' => '已使用',
+    'account_reset_notice' => '每月:reset_day日自动重置流量',
     'article_title' => '文章',
+    'recharge' => '充值',
+    'enabled' => '正常',
+    'disabled' => '禁用',
+    'nerver_used' => '从未使用',
+    'expired' => '已过期',
+    'never_loggedin' => '未登录',
+    'announcement' => '公告',
+    'recharge_balance' => '余额充值',
+    'payment_method' => '充值方式',
+    'close' => '关闭',
+    'redeem_score' => '兑换流量',
+    'redeem' => '立即兑换',
+    'redeem_info' => '您有 :score 积分,共计可兑换 :scoreM 免费流量。',
+    'coupon_code' => '券码',
+    'please_input_coupon' => '请输入券码',
+    'scan_qrcode' => '请使用客户端扫描二维码',
+    'setting_info' => '配置信息',
+    'ratio' => '结算比例',
+    'coupon_not_empty' => '券码不能为空',
+    'recharging' => '充值中...',
+    'error_response' => '请求错误,请重试',
+    'error' => '错误',
+
+    // 用户资料
+    'submit' => '提 交',
+    'contact' => '联系方式',
+    'ssr_setting' => 'SSR(R)设置',
+    'password' => '登陆密码',
+    'new_password' => '新密码',
+    'current_password' => '旧密码',
+    'wechat' => '微信',
+    'connection_password' => '连接密码',
+    'encrpytion' => '加密方式',
+    'protocal' => '协议',
+    'obfs' => '混淆',
 
     // 购买服务
     'service_title' => '购买服务',
@@ -57,6 +93,8 @@ return [
     'traffic_log_30days' => '30日内流量消耗情况',
     'traffic_log_24hours' => '24小时内流量消耗情况',
     'traffic_log_keywords' => '消耗流量',
+    'traffic_log_unit' => '单位M',
+    'traffic_log_max' => '最大值',
 
     // 邀请码
     'invite_code_make' => '生成邀请码',
@@ -72,6 +110,7 @@ return [
     'invite_code_table_status_un' => '未使用',
     'invite_code_table_status_yes' => '已使用',
     'invite_code_table_status_expire' => '已过期',
+    'invite_code_summary' => '共 :total 个邀请码',
 
     // 单据
     'invoice_title' => '消费记录',
@@ -114,4 +153,9 @@ return [
     'referral_table_date' => '返利时间',
     'referral_table_none' => '暂无数据',
     'referral_table_apply' => '申请提现',
+    'referral_summary' => '共 :total 条记录,合计返利 :amount 元,满 :money 元可申请提现。',
+    'console' => '管理中心',
+    'profile' => '个人资料',
+    'logout' => '退出',
+    'promote' => '通过您的推广链接注册并激活的用户可获得 :traffic 流量奖励,同时您也可以获得 :traffic 流量奖励;当他们消费时,您可以获得他们每笔消费金额的 :referral_percent% 作为奖励。',
 ];

+ 7 - 0
resources/views/login.blade.php

@@ -37,6 +37,13 @@
 <!-- END LOGO -->
 <!-- BEGIN LOGIN -->
 <div class="content">
+    <nav style="padding-bottom: 20px;text-align: center;">
+        @if(app()->getLocale() == 'zh-CN')
+            <a style="border: 1px solid;padding: 10px;" href="{{url('lang', ['locale' => 'en'])}}">English</a>
+        @else
+            <a style="border: 1px solid;padding: 10px;" href="{{url('lang', ['locale' => 'zh-CN'])}}">中文</a>
+        @endif
+    </nav>
     <!-- BEGIN LOGIN FORM -->
     <form class="login-form" action="{{url('login')}}" method="post">
         <div class="alert alert-danger display-hide">

+ 7 - 0
resources/views/register.blade.php

@@ -37,6 +37,13 @@
 <!-- END LOGO -->
 <!-- BEGIN LOGIN -->
 <div class="content">
+    <nav style="padding-bottom: 20px;text-align: center;">
+        @if(app()->getLocale() == 'zh-CN')
+            <a style="border: 1px solid;padding: 10px;" href="{{url('lang', ['locale' => 'en'])}}">English</a>
+        @else
+            <a style="border: 1px solid;padding: 10px;" href="{{url('lang', ['locale' => 'zh-CN'])}}">中文</a>
+        @endif
+    </nav>
     <!-- BEGIN REGISTRATION FORM -->
     <form class="register-form" action="{{url('register')}}" method="post" style="display: block;">
         @if($is_register)

+ 7 - 0
resources/views/user/active.blade.php

@@ -37,6 +37,13 @@
 <!-- END LOGO -->
 <!-- BEGIN LOGIN -->
 <div class="content">
+    <nav style="padding-bottom: 20px;text-align: center;">
+        @if(app()->getLocale() == 'zh-CN')
+            <a style="border: 1px solid;padding: 10px;" href="{{url('lang', ['locale' => 'en'])}}">English</a>
+        @else
+            <a style="border: 1px solid;padding: 10px;" href="{{url('lang', ['locale' => 'zh-CN'])}}">中文</a>
+        @endif
+    </nav>
     @if(Session::get('errorMsg'))
         <div class="alert alert-danger">
             <span> {{Session::get('errorMsg')}} </span>

+ 7 - 0
resources/views/user/activeUser.blade.php

@@ -37,6 +37,13 @@
 <!-- END LOGO -->
 <!-- BEGIN LOGIN -->
 <div class="content">
+    <nav style="padding-bottom: 20px;text-align: center;">
+        @if(app()->getLocale() == 'zh-CN')
+            <a style="border: 1px solid;padding: 10px;" href="{{url('lang', ['locale' => 'en'])}}">English</a>
+        @else
+            <a style="border: 1px solid;padding: 10px;" href="{{url('lang', ['locale' => 'zh-CN'])}}">中文</a>
+        @endif
+    </nav>
     @if (Session::get('errorMsg'))
         <div class="alert alert-danger">
             <button class="close" data-close="alert"></button>

+ 12 - 0
resources/views/user/free.blade.php

@@ -45,6 +45,18 @@
             </a>
         </div>
         <!-- END LOGO -->
+        <!-- BEGIN PAGE TOP -->
+        <div class="page-top">
+            <!-- BEGIN Language TOGGLER -->
+            <div style="display:inline-table;height:100%;float:left;">
+                @if(app()->getLocale() == 'zh-CN')
+                    <a style="display:table-cell;vertical-align:middle;color:red;font-weight:600;" href="{{url('lang', ['locale' => 'en'])}}">English</a>
+                @else
+                    <a style="display:table-cell;vertical-align:middle;color:red;font-weight:600;" href="{{url('lang', ['locale' => 'zh-CN'])}}">中文</a>
+                @endif
+            </div>
+            <!-- END Language TOGGLER -->
+        </div>
     </div>
     <!-- END HEADER INNER -->
 </div>

+ 23 - 23
resources/views/user/index.blade.php

@@ -71,33 +71,33 @@
             <div class="col-md-4">
                 <ul class="list-group">
                     <li class="list-group-item">
-                        {{trans('home.account_status')}}:{{$info['enable'] ? '正常' : '禁用'}}
+                        {{trans('home.account_status')}}:{{$info['enable'] ? trans('home.enabled') : trans('home.disabled') }}
                     </li>
                     @if($login_add_score)
                         <li class="list-group-item">
                             {{trans('home.account_score')}}:{{$info['score']}}
                             <span class="badge badge-info">
-                            <a href="javascript:;" data-toggle="modal" data-target="#exchange_modal" style="color:#FFF;">兑换</a>
+                            <a href="javascript:;" data-toggle="modal" data-target="#exchange_modal" style="color:#FFF;">{{trans('home.redeem_coupon')}}</a>
                         </span>
                         </li>
                     @endif
                     <li class="list-group-item">
                         {{trans('home.account_balance')}}:{{$info['balance']}}
                         <span class="badge badge-danger">
-                            <a href="javascript:;" data-toggle="modal" data-target="#charge_modal" style="color:#FFF;">充值</a>
+                            <a href="javascript:;" data-toggle="modal" data-target="#charge_modal" style="color:#FFF;">{{trans('home.recharge')}}</a>
                         </span>
                     </li>
                     <li class="list-group-item">
-                        {{trans('home.account_expire')}}:{{date('Y-m-d 0:0:0') > $info['expire_time'] ? '已过期' : $info['expire_time']}}
+                        {{trans('home.account_expire')}}:{{date('Y-m-d 0:0:0') > $info['expire_time'] ? trans('expired') : $info['expire_time']}}
                     </li>
                     <li class="list-group-item">
-                        {{trans('home.account_last_usage')}}:{{empty($info['t']) ? '从未使用' : date('Y-m-d H:i:s', $info['t'])}}
+                        {{trans('home.account_last_usage')}}:{{empty($info['t']) ? trans('home.nerver_used') : date('Y-m-d H:i:s', $info['t'])}}
                     </li>
                     <li class="list-group-item">
-                        {{trans('home.account_last_login')}}:{{empty($info['last_login']) ? '未登录' : date('Y-m-d H:i:s', $info['last_login'])}}
+                        {{trans('home.account_last_login')}}:{{empty($info['last_login']) ? trans('home.nerver_loggedin') : date('Y-m-d H:i:s', $info['last_login'])}}
                     </li>
                     <li class="list-group-item">
-                        {{trans('home.account_bandwidth_usage')}}:{{$info['usedTransfer']}}({{$info['totalTransfer']}})@if($info['traffic_reset_day']) &ensp;每月{{$info['traffic_reset_day']}}日自动重置流量 @endif
+                        {{trans('home.account_bandwidth_usage')}}:{{$info['usedTransfer']}}({{$info['totalTransfer']}})@if($info['traffic_reset_day']) &ensp;{{trans('home.account_reset_notice', ['reset_day' => $info['traffic_reset_day']])}}  @endif
                         <div class="progress progress-striped active" style="margin-bottom:0;" title="{{trans('home.account_total_traffic')}} {{$info['totalTransfer']}},{{trans('home.account_usage_traffic')}} {{$info['usedTransfer']}}">
                             <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="{{$info['usedPercent'] * 100}}" aria-valuemin="0" aria-valuemax="100" style="width: {{$info['usedPercent'] * 100}}%">
                                 <span class="sr-only"> {{$info['usedTransfer']}} / {{$info['totalTransfer']}} </span>
@@ -121,32 +121,32 @@
                 <div class="modal-content">
                     <div class="modal-header">
                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
-                        <h4 class="modal-title">余额充值</h4>
+                        <h4 class="modal-title">{{trans('home.recharge_balance')}}</h4>
                     </div>
                     <div class="modal-body">
                         <div class="alert alert-danger" style="display: none; text-align: center;" id="charge_msg"></div>
                         <form action="#" method="post" class="form-horizontal">
                             <div class="form-body">
                                 <div class="form-group">
-                                    <label for="charge_type" class="col-md-4 control-label">充值方式</label>
+                                    <label for="charge_type" class="col-md-4 control-label">{{trans('home.payment_method')}}</label>
                                     <div class="col-md-6">
                                         <select class="form-control" name="charge_type" id="charge_type">
-                                            <option value="1" selected>卡券</option>
+                                            <option value="1" selected>{{trans('home.coupon')}}</option>
                                         </select>
                                     </div>
                                 </div>
                                 <div class="form-group">
-                                    <label for="charge_coupon" class="col-md-4 control-label"> 券码 </label>
+                                    <label for="charge_coupon" class="col-md-4 control-label"> {{trans('home.coupon_code')}} </label>
                                     <div class="col-md-6">
-                                        <input type="text" class="form-control" name="charge_coupon" id="charge_coupon" placeholder="请输入券码">
+                                        <input type="text" class="form-control" name="charge_coupon" id="charge_coupon" placeholder="{{trans('home.please_input_coupon')}}">
                                     </div>
                                 </div>
                             </div>
                         </form>
                     </div>
                     <div class="modal-footer">
-                        <button type="button" data-dismiss="modal" class="btn dark btn-outline">关闭</button>
-                        <button type="button" class="btn red btn-outline" onclick="return charge();">充值</button>
+                        <button type="button" data-dismiss="modal" class="btn dark btn-outline">{{trans('home.close')}}</button>
+                        <button type="button" class="btn red btn-outline" onclick="return charge();">{{trans('home.recharge')}}</button>
                     </div>
                 </div>
             </div>
@@ -156,14 +156,14 @@
                 <div class="modal-content">
                     <div class="modal-header">
                         <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
-                        <h4 class="modal-title"> 兑换流量 </h4>
+                        <h4 class="modal-title"> {{trans('home.redeem_score')}} </h4>
                     </div>
                     <div class="modal-body">
-                        <div class="alert alert-info" id="msg">您有 {{$info['score']}} 积分,共计可兑换 {{$info['score']}}M 免费流量。</div>
+                        <div class="alert alert-info" id="msg">{{trans('home.redeem_info', ['score' => $info['score']])}}</div>
                     </div>
                     <div class="modal-footer">
-                        <button type="button" data-dismiss="modal" class="btn dark btn-outline">关闭</button>
-                        <button type="button" class="btn red btn-outline" onclick="return exchange();">立即兑换</button>
+                        <button type="button" data-dismiss="modal" class="btn dark btn-outline">{{trans('home.close')}}</button>
+                        <button type="button" class="btn red btn-outline" onclick="return exchange();">{{trans('home.redeem')}}</button>
                     </div>
                 </div>
             </div>
@@ -175,7 +175,7 @@
                     <div class="modal-content">
                         <div class="modal-header">
                             <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
-                            <h4 class="modal-title">配置信息</h4>
+                            <h4 class="modal-title">{{trans('home.setting_info')}}</h4>
                         </div>
                         <div class="modal-body">
                             <textarea class="form-control" rows="10" readonly="readonly">{{$node->txt}}</textarea>
@@ -201,7 +201,7 @@
                     <div class="modal-content">
                         <div class="modal-header">
                             <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
-                            <h4 class="modal-title">请使用客户端扫描二维码</h4>
+                            <h4 class="modal-title">{{trans('home.scan_qrcode')}}</h4>
                         </div>
                         <div class="modal-body">
                             <div class="row">
@@ -240,7 +240,7 @@
             var charge_coupon = $("#charge_coupon").val();
 
             if (charge_type == '1' && (charge_coupon == '' || charge_coupon == undefined)) {
-                $("#charge_msg").show().html("券码不能为空");
+                $("#charge_msg").show().html("{{trans('home.coupon_not_empty')}}");
                 $("#charge_coupon").focus();
                 return false;
             }
@@ -250,7 +250,7 @@
                 type:"POST",
                 data:{_token:_token, coupon_sn:charge_coupon},
                 beforeSend:function(){
-                    $("#charge_msg").show().html("充值中...");
+                    $("#charge_msg").show().html("{{trans('home.recharging')}}");
                 },
                 success:function(ret){
                     if (ret.status == 'fail') {
@@ -262,7 +262,7 @@
                     window.location.reload();
                 },
                 error:function(){
-                    $("#charge_msg").show().html("请求错误,请重试");
+                    $("#charge_msg").show().html("{{trans('home.error_response')}}");
                 },
                 complete:function(){}
             });

+ 1 - 1
resources/views/user/invite.blade.php

@@ -75,7 +75,7 @@
                             </div>
                             <div class="row">
                                 <div class="col-md-4 col-sm-4">
-                                    <div class="dataTables_info" role="status" aria-live="polite">{{$inviteList->total()}} 个邀请码</div>
+                                    <div class="dataTables_info" role="status" aria-live="polite">{{trans('home.invite_code_summary', ['total' => $inviteList->total()])}}</div>
                                 </div>
                                 <div class="col-md-8 col-sm-8">
                                     <div class="dataTables_paginate paging_bootstrap_full_number pull-right">

+ 12 - 3
resources/views/user/layouts.blade.php

@@ -52,6 +52,15 @@
         <!-- END RESPONSIVE MENU TOGGLER -->
         <!-- BEGIN PAGE TOP -->
         <div class="page-top">
+            <!-- BEGIN Language TOGGLER -->
+            <div style="display:inline-table;height:100%;float:left;">
+                @if(app()->getLocale() == 'zh-CN')
+                    <a style="display:table-cell;vertical-align:middle;color:red;font-weight:600;" href="{{url('lang', ['locale' => 'en'])}}">English</a>
+                @else
+                    <a style="display:table-cell;vertical-align:middle;color:red;font-weight:600;" href="{{url('lang', ['locale' => 'zh-CN'])}}">中文</a>
+                @endif
+            </div>
+            <!-- END Language TOGGLER -->
             <!-- BEGIN TOP NAVIGATION MENU -->
             <div class="top-menu">
                 <ul class="nav navbar-nav pull-right">
@@ -66,15 +75,15 @@
                         <ul class="dropdown-menu dropdown-menu-default">
                             @if(Session::get('user')['is_admin'])
                                 <li>
-                                    <a href="{{url('admin')}}"> <i class="icon-settings"></i> 管理中心 </a>
+                                    <a href="{{url('admin')}}"> <i class="icon-settings"></i>{{trans('home.console')}}</a>
                                 </li>
                             @endif
                             <li>
-                                <a href="{{url('user/profile')}}"> <i class="icon-user"></i> 个人资料 </a>
+                                <a href="{{url('user/profile')}}"> <i class="icon-user"></i>{{trans('home.profile')}}</a>
                             </li>
                             <li class="divider"> </li>
                             <li>
-                                <a href="{{url('logout')}}"> <i class="icon-key"></i> 退出 </a>
+                                <a href="{{url('logout')}}"> <i class="icon-key"></i>{{trans('home.logout')}}</a>
                             </li>
                         </ul>
                     </li>

+ 15 - 15
resources/views/user/profile.blade.php

@@ -19,7 +19,7 @@
                 @if (Session::has('errorMsg'))
                     <div class="alert alert-danger alert-dismissable">
                         <button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button>
-                        <strong>错误:</strong> {{Session::get('errorMsg')}}
+                        <strong>{{trans('home.error')}}:</strong> {{Session::get('errorMsg')}}
                     </div>
                 @endif
                 <!-- BEGIN PROFILE CONTENT -->
@@ -30,17 +30,17 @@
                                 <div class="portlet-title tabbable-line">
                                     <div class="caption caption-md">
                                         <i class="icon-globe theme-font hide"></i>
-                                        <span class="caption-subject font-blue-madison bold uppercase">个人资料</span>
+                                        <span class="caption-subject font-blue-madison bold uppercase">{{trans('home.profile')}}</span>
                                     </div>
                                     <ul class="nav nav-tabs">
                                         <li class="active">
-                                            <a href="#tab_1" data-toggle="tab">登录密码</a>
+                                            <a href="#tab_1" data-toggle="tab">{{trans('home.password')}}</a>
                                         </li>
                                         <li>
-                                            <a href="#tab_2" data-toggle="tab">联系方式</a>
+                                            <a href="#tab_2" data-toggle="tab">{{trans('home.contact')}}</a>
                                         </li>
                                         <li>
-                                            <a href="#tab_3" data-toggle="tab">SSR(R)设置</a>
+                                            <a href="#tab_3" data-toggle="tab">{{trans('home.ssr_setting')}}</a>
                                         </li>
                                     </ul>
                                 </div>
@@ -49,18 +49,18 @@
                                         <div class="tab-pane active" id="tab_1">
                                             <form action="{{url('user/profile')}}" method="post" enctype="multipart/form-data" class="form-bordered">
                                                 <div class="form-group">
-                                                    <label class="control-label"> 旧密码 </label>
+                                                    <label class="control-label">{{trans('home.current_password')}}</label>
                                                     <input type="password" class="form-control" name="old_password" id="old_password" autofocus required />
                                                     <input type="hidden" name="_token" value="{{csrf_token()}}" />
                                                 </div>
                                                 <div class="form-group">
-                                                    <label class="control-label"> 新密码 </label>
+                                                    <label class="control-label">{{trans('home.new_password')}}</label>
                                                     <input type="password" class="form-control" name="new_password" id="new_password" required />
                                                 </div>
                                                 <div class="form-actions">
                                                     <div class="row">
                                                         <div class=" col-md-4">
-                                                            <button type="submit" class="btn green"> 提 交 </button>
+                                                            <button type="submit" class="btn green">{{trans('home.submit')}}</button>
                                                         </div>
                                                     </div>
                                                 </div>
@@ -69,7 +69,7 @@
                                         <div class="tab-pane" id="tab_2">
                                             <form action="{{url('user/profile')}}" method="post" enctype="multipart/form-data" class="form-bordered">
                                                 <div class="form-group">
-                                                    <label class="control-label"> 微信 </label>
+                                                    <label class="control-label">{{trans('home.wechat')}}</label>
                                                     <input type="text" class="form-control" name="wechat" value="{{$info->wechat}}" id="wechat" required />
                                                     <input type="hidden" name="_token" value="{{csrf_token()}}" />
                                                 </div>
@@ -80,7 +80,7 @@
                                                 <div class="form-actions">
                                                     <div class="row">
                                                         <div class="col-md-12">
-                                                            <button type="submit" class="btn green"> 提 交 </button>
+                                                            <button type="submit" class="btn green">{{trans('home.submit')}}</button>
                                                         </div>
                                                     </div>
                                                 </div>
@@ -89,12 +89,12 @@
                                         <div class="tab-pane" id="tab_3">
                                             <form action="{{url('user/profile')}}" method="post" enctype="multipart/form-data" class="form-bordered">
                                                 <div class="form-group">
-                                                    <label class="control-label"> 连接密码 </label>
+                                                    <label class="control-label"> {{trans('home.connection_password')}} </label>
                                                     <input type="text" class="form-control" name="passwd" value="{{$info->passwd}}" id="passwd" required />
                                                     <input type="hidden" name="_token" value="{{csrf_token()}}" />
                                                 </div>
                                                 <div class="form-group">
-                                                    <label class="control-label"> 加密方式 </label>
+                                                    <label class="control-label"> {{trans('home.encrpytion')}} </label>
                                                     <select class="form-control" name="method" id="method">
                                                         @foreach ($method_list as $method)
                                                             <option value="{{$method->name}}" @if($method->name == $info->method) selected @endif>{{$method->name}}</option>
@@ -102,7 +102,7 @@
                                                     </select>
                                                 </div>
                                                 <div class="form-group">
-                                                    <label class="control-label"> 协议 </label>
+                                                    <label class="control-label"> {{trans('home.protocal')}} </label>
                                                     <select class="form-control" name="protocol" id="protocol">
                                                         @foreach ($protocol_list as $protocol)
                                                             <option value="{{$protocol->name}}" @if($protocol->name == $info->protocol) selected @endif>{{$protocol->name}}</option>
@@ -110,7 +110,7 @@
                                                     </select>
                                                 </div>
                                                 <div class="form-group">
-                                                    <label class="control-label"> 混淆 </label>
+                                                    <label class="control-label"> {{trans('home.obfs')}} </label>
                                                     <select class="form-control" name="obfs" id="obfs">
                                                         @foreach ($obfs_list as $obfs)
                                                             <option value="{{$obfs->name}}" @if($obfs->name == $info->obfs) selected @endif>{{$obfs->name}}</option>
@@ -120,7 +120,7 @@
                                                 <div class="form-actions">
                                                     <div class="row">
                                                         <div class="col-md-12">
-                                                            <button type="submit" class="btn green"> 提 交 </button>
+                                                            <button type="submit" class="btn green"> {{trans('home.submit')}} </button>
                                                         </div>
                                                     </div>
                                                 </div>

+ 2 - 2
resources/views/user/referral.blade.php

@@ -17,7 +17,7 @@
         <div class="row">
             <div class="col-md-12">
                 <div class="note note-info">
-                    <p> 通过您的推广链接注册并激活的用户可获得 {{$referral_traffic}} 流量奖励,同时您也可以获得 {{$referral_traffic}} 流量奖励;当他们消费时,您可以获得他们每笔消费金额的 {{$referral_percent * 100}}% 作为奖励。 </p>
+                    <p>{{trans('home.promote', ['traffic' => $referral_traffic, 'referral_percent' => $referral_percent * 100])}}</p>
                 </div>
             </div>
         </div>
@@ -92,7 +92,7 @@
                         </div>
                         <div class="row">
                             <div class="col-md-5 col-sm-5">
-                                <div class="dataTables_info" role="status" aria-live="polite">共 {{$referralLogList->total()}} 条记录,合计返利 {{$canAmount}} 元,满 <span style="color:red;">{{$referral_money}}</span> 元可申请提现。</div>
+                                <div class="dataTables_info" role="status" aria-live="polite">{{trans('home.referral_summary', ['total' => $referralLogList->total(), 'amount' => $canAmount, 'money' => $referral_money])}}</div>
                             </div>
                             <div class="col-md-7 col-sm-7">
                                 <div class="dataTables_paginate paging_bootstrap_full_number pull-right">

+ 7 - 0
resources/views/user/reset.blade.php

@@ -37,6 +37,13 @@
 <!-- END LOGO -->
 <!-- BEGIN LOGIN -->
 <div class="content">
+    <nav style="padding-bottom: 20px;text-align: center;">
+        @if(app()->getLocale() == 'zh-CN')
+            <a style="border: 1px solid;padding: 10px;" href="{{url('lang', ['locale' => 'en'])}}">English</a>
+        @else
+            <a style="border: 1px solid;padding: 10px;" href="{{url('lang', ['locale' => 'zh-CN'])}}">中文</a>
+        @endif
+    </nav>
     <!-- BEGIN REGISTRATION FORM -->
     <form class="register-form" action="{{url(Request::getRequestUri())}}" method="post" style="display: block;">
         @if(Session::get('errorMsg'))

+ 7 - 0
resources/views/user/resetPassword.blade.php

@@ -37,6 +37,13 @@
 <!-- END LOGO -->
 <!-- BEGIN LOGIN -->
 <div class="content">
+    <nav style="padding-bottom: 20px;text-align: center;">
+        @if(app()->getLocale() == 'zh-CN')
+            <a style="border: 1px solid;padding: 10px;" href="{{url('lang', ['locale' => 'en'])}}">English</a>
+        @else
+            <a style="border: 1px solid;padding: 10px;" href="{{url('lang', ['locale' => 'zh-CN'])}}">中文</a>
+        @endif
+    </nav>
     @if (Session::get('errorMsg'))
         <div class="alert alert-danger">
             <button class="close" data-close="alert"></button>

+ 4 - 4
resources/views/user/trafficLog.blade.php

@@ -46,7 +46,7 @@
         option = {
             title: {
                 text: '{{trans('home.traffic_log_30days')}}',
-                subtext: '单位M'
+                subtext: '{{trans('home.traffic_log_unit')}}'
             },
             tooltip: {
                 trigger: 'axis'
@@ -76,7 +76,7 @@
                     data:[{!! $trafficDaily !!}],
                     markPoint: {
                         data: [
-                            {type: 'max', name: '最大值'}
+                            {type: 'max', name: '{{trans('home.traffic_log_max')}}'}
                         ]
                     }
                 }
@@ -92,7 +92,7 @@
         option = {
             title: {
                 text: '{{trans('home.traffic_log_24hours')}}',
-                subtext: '单位M'
+                subtext: '{{trans('home.traffic_log_unit')}}'
             },
             tooltip: {
                 trigger: 'axis'
@@ -122,7 +122,7 @@
                     data:[{!! $trafficHourly !!}],
                     markPoint: {
                         data: [
-                            {type: 'max', name: '最大值'}
+                            {type: 'max', name: '{{trans('home.traffic_log_max')}}'}
                         ]
                     }
                 }

+ 1 - 0
routes/web.php

@@ -3,6 +3,7 @@
 Route::get('s/{code}', 'SubscribeController@index'); // 节点订阅地址
 
 Route::group(['middleware' => ['forbidden']], function () {
+    Route::get('lang/{locale}', 'UserController@switchLang'); // 语言切换
     Route::any('login', 'LoginController@index'); // 登录
     Route::get('logout', 'LoginController@logout'); // 退出
     Route::any('register', 'RegisterController@index'); // 注册