mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2025-01-24 14:04:07 +08:00
Add L10n support for site name and description
This commit is contained in:
parent
def8cc39b6
commit
da34062a9c
@ -155,7 +155,8 @@ class AdminController extends Controller
|
||||
$general = Option::form('general', OptionForm::AUTO_DETECT, function($form)
|
||||
{
|
||||
$form->text('site_name');
|
||||
$form->text('site_description');
|
||||
$form->text('site_description')->description();
|
||||
|
||||
$form->text('site_url')
|
||||
->hint()
|
||||
->format(function ($url) {
|
||||
@ -207,13 +208,14 @@ class AdminController extends Controller
|
||||
|
||||
$form->checkbox('allow_sending_statistics')->label()->hint();
|
||||
|
||||
})->handle();
|
||||
})->handle(function () {
|
||||
Option::set('site_name_'.config('app.locale'), request('site_name'));
|
||||
Option::set('site_description_'.config('app.locale'), request('site_description'));
|
||||
});
|
||||
|
||||
$announ = Option::form('announ', OptionForm::AUTO_DETECT, function ($form) {
|
||||
$form->textarea('announcement')->rows(10)->description();
|
||||
})->renderWithOutTable()->with('announcement',
|
||||
option('announcement_'.config('app.locale'), option('announcement'))
|
||||
)->handle(function () {
|
||||
})->renderWithOutTable()->handle(function () {
|
||||
Option::set('announcement_'.config('app.locale'), request('announcement'));
|
||||
});
|
||||
|
||||
|
@ -33,7 +33,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
// Provide some application information for javascript
|
||||
$blessing = array_merge(array_except(config('app'), ['key', 'providers', 'aliases', 'cipher', 'log', 'url']), [
|
||||
'base_url' => url('/'),
|
||||
'site_name' => option('site_name')
|
||||
'site_name' => option_localized('site_name')
|
||||
]);
|
||||
|
||||
$event->addContent('<script>var blessing = '.json_encode($blessing).';</script>');
|
||||
|
@ -66,7 +66,9 @@ general:
|
||||
title: General Options
|
||||
|
||||
site_name: Site Name
|
||||
site_description: Site Description
|
||||
site_description:
|
||||
title: Site Description
|
||||
description: You can also specify a different site name and description for each language. To edit a specific language's corresponding site name or description text, please switch to that language and submit your edit.
|
||||
site_url:
|
||||
title: Site URL
|
||||
hint: Begin with http(s)://, nerver ends with slash
|
||||
|
@ -66,7 +66,9 @@ general:
|
||||
title: 常规选项
|
||||
|
||||
site_name: 站点标题
|
||||
site_description: 站点描述
|
||||
site_description:
|
||||
title: 站点描述
|
||||
description: 每种支持的语言都可以对应不同的站点标题与站点描述文本,如果想要编辑某种特定语言下的站点标题与描述,请在右上角切换至该语言后再提交修改。
|
||||
site_url:
|
||||
title: 站点地址(URL)
|
||||
hint: 以 http(s):// 开头,不要以 / 结尾
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>@yield('title') - {{ option('site_name') }}</title>
|
||||
<title>@yield('title') - {{ option_localized('site_name') }}</title>
|
||||
{!! bs_favicon() !!}
|
||||
<!-- Tell the browser to be responsive to screen width -->
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
@ -26,7 +26,7 @@
|
||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
||||
<span class="logo-mini"> <i class="fa fa-bookmark"></i> </span>
|
||||
<!-- logo for regular state and mobile devices -->
|
||||
<span class="logo-lg">{{ option('site_name') }}</span>
|
||||
<span class="logo-lg">{{ option_localized('site_name') }}</span>
|
||||
</a>
|
||||
|
||||
<!-- Header Navbar -->
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<a href="{{ url('/') }}">{{ option('site_name') }}</a>
|
||||
<a href="{{ url('/') }}">{{ option_localized('site_name') }}</a>
|
||||
</div>
|
||||
<!-- /.login-logo -->
|
||||
<div class="login-box-body">
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<a href="{{ url('/') }}">{{ option('site_name') }}</a>
|
||||
<a href="{{ url('/') }}">{{ option_localized('site_name') }}</a>
|
||||
</div>
|
||||
<!-- /.login-logo -->
|
||||
<div class="login-box-body">
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<a href="{{ url('/') }}">{{ option('site_name') }}</a>
|
||||
<a href="{{ url('/') }}">{{ option_localized('site_name') }}</a>
|
||||
</div>
|
||||
<!-- /.login-logo -->
|
||||
<div class="login-box-body">
|
||||
|
@ -4,9 +4,9 @@
|
||||
<center>
|
||||
<div style="margin:0 auto;width:580px;background:#fff;text-align:left">
|
||||
<h1 style="margin:0 40px;color:#999;border-bottom:1px dotted #ddd;padding:40px 0 30px;text-align:center;font-size: 35px;font-family:Minecraft,Copperplate,'Copperplate Gothic Light',Palatino,'Palatino Linotype','Palatino LT STD',Georgia,'Microsoft Yahei','Microsoft Jhenghei',serif">
|
||||
{{ option('site_name') }}
|
||||
{{ option_localized('site_name') }}
|
||||
</h1>
|
||||
<div style="padding:30px 40px 40px">{!! trans('auth.mail.message', ['sitename' => "<a style='color:#009a61;text-decoration:none' href='".option('site_url')."'>".option('site_name')."</a>"]) !!}<br><br>
|
||||
<div style="padding:30px 40px 40px">{!! trans('auth.mail.message', ['sitename' => "<a style='color:#009a61;text-decoration:none' href='".option('site_url')."'>".option_localized('site_name')."</a>"]) !!}<br><br>
|
||||
<div style="border-left:5px solid #ddd;padding:0 0 0 24px;color:#888">
|
||||
{{ trans('auth.mail.ignore') }}
|
||||
</div>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>@yield('title') - {{ option('site_name') }}</title>
|
||||
<title>@yield('title') - {{ option_localized('site_name') }}</title>
|
||||
{!! bs_favicon() !!}
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
<!-- App Styles -->
|
||||
|
@ -6,11 +6,11 @@
|
||||
|
||||
<div class="register-box">
|
||||
<div class="register-logo">
|
||||
<a href="{{ url('/') }}">{{ option('site_name') }}</a>
|
||||
<a href="{{ url('/') }}">{{ option_localized('site_name') }}</a>
|
||||
</div>
|
||||
|
||||
<div class="register-box-body">
|
||||
<p class="login-box-msg">{{ trans('auth.register.message', ['sitename' => option('site_name')]) }}</p>
|
||||
<p class="login-box-msg">{{ trans('auth.register.message', ['sitename' => option_localized('site_name')]) }}</p>
|
||||
|
||||
<form id="register-form">
|
||||
<div class="form-group has-feedback">
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<div class="login-box">
|
||||
<div class="login-logo">
|
||||
<a href="{{ url('/') }}">{{ option('site_name') }}</a>
|
||||
<a href="{{ url('/') }}">{{ option_localized('site_name') }}</a>
|
||||
</div>
|
||||
|
||||
<div class="login-box-body">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>{{ option('site_name') }}</title>
|
||||
<title>{{ option_localized('site_name') }}</title>
|
||||
{!! bs_favicon() !!}
|
||||
<!-- Tell the browser to be responsive to screen width -->
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
@ -19,7 +19,7 @@
|
||||
<nav class="navbar navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<a href="{{ option('site_url') }}" class="navbar-brand">{{ option('site_name') }}</a>
|
||||
<a href="{{ option('site_url') }}" class="navbar-brand">{{ option_localized('site_name') }}</a>
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
|
||||
<i class="fa fa-bars"></i>
|
||||
</button>
|
||||
@ -53,9 +53,9 @@
|
||||
|
||||
<div class="container">
|
||||
<div class="splash">
|
||||
<h1 class="splash-head">{{ option('site_name') }}</h1>
|
||||
<h1 class="splash-head">{{ option_localized('site_name') }}</h1>
|
||||
<p class="splash-subhead">
|
||||
{{ option('site_description') }}
|
||||
{{ option_localized('site_description') }}
|
||||
</p>
|
||||
<p>
|
||||
@if (is_null($user))
|
||||
@ -102,7 +102,7 @@
|
||||
<div id="footerwrap">
|
||||
<div class="container">
|
||||
<div class="col-lg-6">
|
||||
{{ trans('index.introduction', ['sitename' => option('site_name')]) }}
|
||||
{{ trans('index.introduction', ['sitename' => option_localized('site_name')]) }}
|
||||
</div>
|
||||
|
||||
<div class="col-lg-6">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>@yield('title') - {{ option('site_name') }}</title>
|
||||
<title>@yield('title') - {{ option_localized('site_name') }}</title>
|
||||
{!! bs_favicon() !!}
|
||||
<!-- Tell the browser to be responsive to screen width -->
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
@ -21,7 +21,7 @@
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<a href="{{ option('site_url') }}" class="navbar-brand">
|
||||
{{ option('site_name') }}
|
||||
{{ option_localized('site_name') }}
|
||||
</a>
|
||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
|
||||
<i class="fa fa-bars"></i>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>@yield('title') - {{ option('site_name') }}</title>
|
||||
<title>@yield('title') - {{ option_localized('site_name') }}</title>
|
||||
{!! bs_favicon() !!}
|
||||
<!-- Tell the browser to be responsive to screen width -->
|
||||
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
|
||||
@ -24,7 +24,7 @@
|
||||
<!-- mini logo for sidebar mini 50x50 pixels -->
|
||||
<span class="logo-mini"> <i class="fa fa-bookmark"></i> </span>
|
||||
<!-- logo for regular state and mobile devices -->
|
||||
<span class="logo-lg">{{ option('site_name') }}</span>
|
||||
<span class="logo-lg">{{ option_localized('site_name') }}</span>
|
||||
</a>
|
||||
|
||||
<!-- Header Navbar -->
|
||||
|
@ -92,7 +92,7 @@
|
||||
</div><!-- /.box-header -->
|
||||
<div class="box-body">
|
||||
@if (!$user->isAdmin())
|
||||
<p>{{ trans('user.profile.delete.notice', ['site' => option('site_name')]) }}</p>
|
||||
<p>{{ trans('user.profile.delete.notice', ['site' => option_localized('site_name')]) }}</p>
|
||||
<button id="delete" class="btn btn-danger" data-toggle="modal" data-target="#modal-delete-account">{{ trans('user.profile.delete.button') }}</button>
|
||||
@else
|
||||
<p>{{ trans('user.profile.delete.admin') }}</p>
|
||||
|
@ -113,8 +113,8 @@ class AdminControllerTest extends TestCase
|
||||
->type('code', 'comment_script')
|
||||
->uncheck('allow_sending_statistics')
|
||||
->press('submit_general');
|
||||
$this->assertEquals('My Site', option('site_name'));
|
||||
$this->assertEquals('hi', option('site_description'));
|
||||
$this->assertEquals('My Site', option_localized('site_name'));
|
||||
$this->assertEquals('hi', option_localized('site_description'));
|
||||
$this->assertEquals('http://blessing.skin', option('site_url'));
|
||||
$this->assertFalse(option('user_can_register'));
|
||||
$this->assertEquals('8', option('regs_per_ip'));
|
||||
|
@ -459,7 +459,7 @@ class AuthControllerTest extends TestCase
|
||||
|
||||
$mock->shouldReceive('from')
|
||||
->once()
|
||||
->with(option('mail.username'), option('site_name'));
|
||||
->with(option('mail.username'), option_localized('site_name'));
|
||||
|
||||
$mock->shouldReceive('to')
|
||||
->once()
|
||||
@ -468,7 +468,7 @@ class AuthControllerTest extends TestCase
|
||||
|
||||
$mock->shouldReceive('subject')
|
||||
->once()
|
||||
->with(trans('auth.mail.title', ['sitename' => option('site_name')]));
|
||||
->with(trans('auth.mail.title', ['sitename' => option_localized('site_name')]));
|
||||
$closure($mock);
|
||||
return true;
|
||||
})
|
||||
|
@ -12,8 +12,8 @@ class HomeControllerTest extends TestCase
|
||||
public function testIndex()
|
||||
{
|
||||
$this->get('/')
|
||||
->see(option('site_name'))
|
||||
->see(option('site_description'))
|
||||
->see(option_localized('site_name'))
|
||||
->see(option_localized('site_description'))
|
||||
->assertViewHas('home_pic_url', option('home_pic_url'));
|
||||
|
||||
$this->visit('/')->click('Log In')->seePageIs('/auth/login');
|
||||
|
Loading…
Reference in New Issue
Block a user