fix awful indentation in i18n files of option pages

This commit is contained in:
printempw 2017-01-17 22:16:03 +08:00
parent db15ff2314
commit a0494ce3d0
6 changed files with 246 additions and 225 deletions

View File

@ -89,13 +89,12 @@ class AdminController extends Controller
$signIn = Option::form('sign_in', OptionForm::AUTO_DETECT, function($form)
{
$form->group('sign_score')
->text('sign_score_from')->addon(trans('options.sign_score.addon1'))
->text('sign_score_to')->addon(trans('options.sign_score.addon2'));
->text('sign_score_from')->addon(trans('options.sign_in.sign_score.addon1'))
->text('sign_score_to')->addon(trans('options.sign_in.sign_score.addon2'));
$form->group('sign_gap_time')->text('sign_gap_time')->addon(OptionForm::AUTO_DETECT);
$form->group('sign_gap_time')->text('sign_gap_time')->addon();
$form->checkbox('sign_after_zero')->label(OptionForm::AUTO_DETECT)
->hint(OptionForm::AUTO_DETECT);
$form->checkbox('sign_after_zero')->label()->hint();
})->handle(function() {
$sign_score = $_POST['sign_score_from'].','.$_POST['sign_score_to'];
Option::set('sign_score', $sign_score);
@ -116,27 +115,27 @@ class AdminController extends Controller
{
$form->text('site_name');
$form->text('site_description');
$form->text('site_url')->hint(OptionForm::AUTO_DETECT);
$form->text('site_url')->hint();
$form->checkbox('user_can_register')->label(OptionForm::AUTO_DETECT);
$form->checkbox('user_can_register')->label();
$form->text('regs_per_ip');
$form->group('max_upload_file_size')
->text('max_upload_file_size')->addon('KB')
->hint(trans('options.max_upload_file_size.hint', ['size' => ini_get('upload_max_filesize')]));
->hint(trans('options.general.max_upload_file_size.hint', ['size' => ini_get('upload_max_filesize')]));
$form->checkbox('allow_chinese_playername')->label(OptionForm::AUTO_DETECT);
$form->checkbox('allow_chinese_playername')->label();
$form->select('api_type')
->option('0', 'CustomSkinLoader API')
->option('1', 'UniversalSkinAPI');
$form->checkbox('auto_del_invalid_texture')->label(OptionForm::AUTO_DETECT)->hint(OptionForm::AUTO_DETECT);
$form->checkbox('auto_del_invalid_texture')->label()->hint();
$form->textarea('comment_script')->rows(6)->description(OptionForm::AUTO_DETECT);
$form->textarea('comment_script')->rows(6)->description();
$form->checkbox('allow_sending_statistic')->label(OptionForm::AUTO_DETECT)->hint(OptionForm::AUTO_DETECT);
$form->checkbox('allow_sending_statistics')->label()->hint();
})->handle(function() {
if (substr($_POST['site_url'], -1) == "/")
@ -145,21 +144,21 @@ class AdminController extends Controller
$announ = Option::form('announ', OptionForm::AUTO_DETECT, function($form)
{
$form->textarea('announcement')->description(OptionForm::AUTO_DETECT);
$form->textarea('announcement')->rows(10)->description();
})->renderWithOutTable()->handle();
$cache = Option::form('cache', OptionForm::AUTO_DETECT, function($form)
$resources = Option::form('resources', OptionForm::AUTO_DETECT, function($form)
{
$form->checkbox('force_ssl')->label(OptionForm::AUTO_DETECT)->hint(OptionForm::AUTO_DETECT);
$form->checkbox('auto_detect_asset_url')->label(OptionForm::AUTO_DETECT)->description(OptionForm::AUTO_DETECT);
$form->checkbox('return_200_when_notfound')->label(OptionForm::AUTO_DETECT);
$form->checkbox('force_ssl')->label()->hint();
$form->checkbox('auto_detect_asset_url')->label()->description();
$form->checkbox('return_200_when_notfound')->label()->description();
$form->text('cache_expire_time')->hint(OptionForm::AUTO_DETECT);
})->type('warning')->hint(OptionForm::AUTO_DETECT)->handle();
return view('admin.options')->with('forms', compact('general', 'cache', 'announ'));
return view('admin.options')->with('forms', compact('general', 'resources', 'announ'));
}
/**

View File

@ -67,13 +67,15 @@ class OptionForm
throw new BadMethodCallException("Method [$method] does not exist on option form.");
}
// assign name for option item
if (!isset($params[1]) || Arr::get($params, 1) == OptionForm::AUTO_DETECT) {
$params[1] = Arr::get(trans("options.$params[0]"), 'title', trans("options.$params[0]"));
$params[1] = Arr::get(trans("options.$this->id.$params[0]"), 'title', trans("options.$this->id.$params[0]"));
}
$class = new ReflectionClass('App\Services\OptionForm'.Str::title($method));
// use ReflectionClass to create a new OptionFormItem instance
$item = $class->newInstanceArgs($params);
$item->setParentId($this->id);
$this->items[] = $item;
return $item;
@ -98,7 +100,7 @@ class OptionForm
* @param array $info
* @return $this
*/
public function hint($hintContent)
public function hint($hintContent = self::AUTO_DETECT)
{
if ($hintContent == self::AUTO_DETECT) {
$hintContent = trans("options.$this->id.hint");
@ -384,12 +386,21 @@ class OptionFormItem
public $description;
protected $parentId;
public function __construct($id, $name = null)
{
$this->id = $id;
$this->name = $name;
}
public function setParentId($id)
{
$this->parentId = $id;
return $this;
}
public function value($value)
{
$this->value = $value;
@ -397,10 +408,10 @@ class OptionFormItem
return $this;
}
public function hint($hintContent)
public function hint($hintContent = OptionForm::AUTO_DETECT)
{
if ($hintContent == OptionForm::AUTO_DETECT) {
$hintContent = trans("options.$this->id.hint");
$hintContent = trans("options.$this->parentId.$this->id.hint");
}
$this->hint = view('vendor.option-form.hint')->with('hint', $hintContent)->render();
@ -415,10 +426,10 @@ class OptionFormItem
return $this;
}
public function description($description)
public function description($description = OptionForm::AUTO_DETECT)
{
if ($description == OptionForm::AUTO_DETECT) {
$description = trans("options.$this->id.description");
$description = trans("options.$this->parentId.$this->id.description");
}
$this->description = $description;
@ -454,10 +465,10 @@ class OptionFormCheckbox extends OptionFormItem
{
protected $label;
public function label($label)
public function label($label = OptionForm::AUTO_DETECT)
{
if ($label == OptionForm::AUTO_DETECT) {
$label = trans("options.$this->id.label");
$label = trans("options.$this->parentId.$this->id.label");
}
$this->label = $label;
@ -531,10 +542,10 @@ class OptionFormGroup extends OptionFormItem
return $this;
}
public function addon($value)
public function addon($value = OptionForm::AUTO_DETECT)
{
if ($value == OptionForm::AUTO_DETECT) {
$value = trans("options.$this->id.addon");
$value = trans("options.$this->parentId.$this->id.addon");
}
$this->items[] = ['type' => 'addon', 'id' => null, 'value' => $value];

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-07-29 11:53:11
* @Last Modified by: printempw
* @Last Modified time: 2017-01-14 22:05:22
* @Last Modified time: 2017-01-17 21:47:29
*/
return [
@ -20,7 +20,7 @@ return [
'custom_js' => '',
'allow_chinese_playername' => 'true',
'comment_script' => '',
'allow_sending_statistic' => 'true',
'allow_sending_statistics' => 'true',
'user_initial_score' => '1000',
'sign_gap_time' => '24',
'sign_score' => '10,100',

View File

@ -2,120 +2,129 @@ option-saved: Option Saved.
homepage:
title: Homepage
home_pic_url:
title: Picture URL at Homepage
hint: Path relative to homepage or full URL.
favicon_url:
title: Website Icon
hint: Path relative to resources/assets/ or full URL.
description: The given image must have same width and height.
copyright_prefer:
title: Program Copyright
description: Any evil modification applied on the footer program copyright (including deleting, modifying author, changing link target) with out permission is <b>FORBIDDEN</b>. The author reserves the right to pursue relevant responsibilities.
copyright_text:
title: Custom Copyright Text
description: Placeholders are available in custom copyright text. e.g. <code>{site_name}</code> & <code>{site_url}</code>
home_pic_url:
title: Picture URL at Homepage
hint: Path relative to homepage or full URL.
favicon_url:
title: Website Icon
hint: Path relative to resources/assets/ or full URL.
description: The given image must have same width and height.
copyright_prefer:
title: Program Copyright
description: Any evil modification applied on the footer program copyright (including deleting, modifying author, changing link target) with out permission is <b>FORBIDDEN</b>. The author reserves the right to pursue relevant responsibilities.
copyright_text:
title: Custom Copyright Text
description: Placeholders are available in custom copyright text. e.g. <code>{site_name}</code> & <code>{site_url}</code>
customJsCss:
title: Custom CSS/JavaScript
message: |
The contents will be attached to &lt;style&gt; and &lt;script&gt; tags.<br>
- Here are some useful examples: <a href="https://github.com/printempw/blessing-skin-server/wiki/Examples-of-custom-CSS-JavaScript">Examples of Custom CSS JavaScript @GitHub WiKi</a>
custom_css: CSS
custom_js: JavaScript
custom_css: CSS
custom_js: JavaScript
rate:
title: About Scores
score_per_storage:
title: Storage
addon: scores = 1 KB
private_score_per_storage:
title: Private Storage
addon: scores = 1 KB
hint: Uploading private textures will cost more scores.
score_per_closet_item:
title: Favorites
addon: score = 1 closet item
return_score:
title: Score Return
label: Return scores back to user after deleting players/textures/closet items.
score_per_player:
title: Players
addon: scores = 1 player
user_initial_score: User Initial Score
score_per_storage:
title: Storage
addon: scores = 1 KB
private_score_per_storage:
title: Private Storage
addon: scores = 1 KB
hint: Uploading private textures will cost more scores.
score_per_closet_item:
title: Favorites
addon: score = 1 closet item
return_score:
title: Score Return
label: Return scores back to user after deleting players/textures/closet items.
score_per_player:
title: Players
addon: scores = 1 player
user_initial_score: User Initial Score
sign_in:
title: Signing In
sign_score:
title: Score Granted
addon1: scores ~
addon2: scores
sign_gap_time:
title: Gap Time
addon: hours
sign_after_zero:
title: Time
label: Can sign in after 0 everyday
hint: The above option will be ignored if this is checked.
sign_score:
title: Score Granted
addon1: scores ~
addon2: scores
sign_gap_time:
title: Gap Time
addon: hours
sign_after_zero:
title: Time
label: Users can sign in after 0 everyday.
hint: The above option will be ignored if this is checked.
general:
title: General Options
site_name: Site Name
site_description: Site Description
site_url:
title: Site URL
hint: Begin with http(s)://, nerver ends with slash
user_can_register:
title: Open Registration
label: Everyone is allowed to register
regs_per_ip: Max accounts of one IP
max_upload_file_size:
title: Max Upload Size
hint: "Limit of PHP in php.ini: :size"
allow_chinese_playername:
title: Player Name
label: Allow chinese player names
api_type: Prefered JSON API
auto_del_invalid_texture:
title: Invalid Textures
label: Delete invalid textures from skinlib automatically.
hint: Delete textures records whose file no longer exists automatically.
comment_script:
title: Comment Script
description: Placeholders are available in comment scripts. <code>{tid}</code> will be replaced with texture id, <code>{name}</code> will be replaced with texture name, <code>{url}</code> will be replaced with current URL.
allow_sending_statistic:
title: Statistics
label: Send usage statistics anonymously.
hint: Information about privacy will nerver be sent.
site_name: Site Name
site_description: Site Description
site_url:
title: Site URL
hint: Begin with http(s)://, nerver ends with slash
user_can_register:
title: Open Registration
label: Everyone is allowed to register.
regs_per_ip: Max accounts of one IP
max_upload_file_size:
title: Max Upload Size
hint: "Limit of PHP in php.ini: :size"
allow_chinese_playername:
title: Player Name
label: Allow chinese player names.
api_type: Prefered JSON API
auto_del_invalid_texture:
title: Invalid Textures
label: Delete invalid textures automatically.
hint: Delete textures records whose file no longer exists from skinlib.
comment_script:
title: Comment Script
description: Placeholders are available in comment scripts. <code>{tid}</code> will be replaced with texture id, <code>{name}</code> will be replaced with texture name, <code>{url}</code> will be replaced with current URL.
allow_sending_statistics:
title: Statistics
label: Send usage statistics anonymously.
hint: Information about privacy will nerver be sent.
announ:
title: Site Announcement
announcement:
description: Styling with Markdown is supported.
title: Announcement
cache:
announcement:
description: Styling with Markdown is supported.
resources:
title: Resource Files
hint: Please adjust these options when CDN cache is on
force_ssl:
title: Force SSL
label: Force to use HTTPS protocol to load resources
hint: Check SSL available before turning on
auto_detect_asset_url:
title: Assets URL
label: Determine assets url automatically
description: Load asset files according to current URL. The site url will be used if this is not enabled. Please unable this if requests don't go through CDN.
return_200_when_notfound:
title: HTTP Response Code
label: Return 200 instead of 404 when requesting un-existent player
cache_expire_time:
title: Cache Exipre Time
hint: In seconds, 86400 = one day, 31536000 = one year
force_ssl:
title: Force SSL
label: Use HTTPS protocol to load resources forcely.
hint: Check SSL available before turning on
auto_detect_asset_url:
title: Assets URL
label: Determine assets url automatically.
description: Load asset files according to current URL. The site url will be used if this is not enabled. Please unable this if requests don't go through CDN.
return_200_when_notfound:
title: HTTP Response Code
label: Return 200 instead of 404 when requesting un-existent player.
description: If your CDN doesn't cache 404 pages, please turn this on. A flood of requests to un-existent players will greatly slow down the site.
cache_expire_time:
title: Cache Exipre Time
hint: In seconds, 86400 = one day, 31536000 = one year
update:
title: Check Update
check_update:
title: Check Update
label: Check update automatically and notify me.
update_source:
title: Update Source
description: 'Available update source list can be found at: <a href="https://github.com/printempw/blessing-skin-server/wiki/%E6%9B%B4%E6%96%B0%E6%BA%90%E5%88%97%E8%A1%A8">@GitHub Wiki</a>'
check_update:
title: Check Update
label: Check update automatically and notify me.
update_source:
title: Update Source
description: 'Available update source list can be found at: <a href="https://github.com/printempw/blessing-skin-server/wiki/%E6%9B%B4%E6%96%B0%E6%BA%90%E5%88%97%E8%A1%A8">@GitHub Wiki</a>'

View File

@ -2,120 +2,129 @@ option-saved: 设置已保存。
homepage:
title: 首页配置
home_pic_url:
title: 首页图片地址
hint: 相对于首页的路径或者完整的 URL
favicon_url:
title: 网站图标
hint: 相对 resources/assets/ 的路径或者完整的 URL
description: 所使用的图像必须具有相同的宽度和高度
copyright_prefer:
title: 程序版权信息
description: 对于任何恶意修改页面<b>右下角</b>的版权信息(包括不限于删除、修改作者信息、修改链接指向)的用户,作者保留对其追究责任的权力。
copyright_text:
title: 自定义版权文字
description: 自定义版权文字内可使用占位符,<code>{site_name}</code> 将会被自动替换为站点名称,<code>{site_url}</code> 会被替换为站点地址。
home_pic_url:
title: 首页图片地址
hint: 相对于首页的路径或者完整的 URL
favicon_url:
title: 网站图标
hint: 相对 resources/assets/ 的路径或者完整的 URL
description: 所使用的图像必须具有相同的宽度和高度
copyright_prefer:
title: 程序版权信息
description: 对于任何恶意修改页面<b>右下角</b>的版权信息(包括不限于删除、修改作者信息、修改链接指向)的用户,作者保留对其追究责任的权力。
copyright_text:
title: 自定义版权文字
description: 自定义版权文字内可使用占位符,<code>{site_name}</code> 将会被自动替换为站点名称,<code>{site_url}</code> 会被替换为站点地址。
customJsCss:
title: 自定义 CSS/JavaScript
message: |
内容将会被追加至每个页面的 &lt;style&gt; 和 &lt;script&gt; 标签中。<br>
- 这里有一些有用的示例:<a href="https://github.com/printempw/blessing-skin-server/wiki/Examples-of-custom-CSS-JavaScript">「自定义 CSS JavaScript」功能的一些实例@GitHub WiKi</a>
custom_css: CSS
custom_js: JavaScript
custom_css: CSS
custom_js: JavaScript
rate:
title: 积分换算
score_per_storage:
title: 存储
addon: 积分 = 1 KB
private_score_per_storage:
title: 私密材质存储
addon: 积分 = 1 KB
hint: 上传私密材质将消耗更多积分
score_per_closet_item:
title: 收藏消耗积分
addon: 积分 = 一个衣柜物品
return_score:
title: 积分返还
label: 用户删除角色/材质/收藏时返还积分
score_per_player:
title: 角色
addon: 积分 = 一个角色
user_initial_score: 新用户默认积分
score_per_storage:
title: 存储
addon: 积分 = 1 KB
private_score_per_storage:
title: 私密材质存储
addon: 积分 = 1 KB
hint: 上传私密材质将消耗更多积分
score_per_closet_item:
title: 收藏消耗积分
addon: 积分 = 一个衣柜物品
return_score:
title: 积分返还
label: 用户删除角色/材质/收藏时返还积分
score_per_player:
title: 角色
addon: 积分 = 一个角色
user_initial_score: 新用户默认积分
sign_in:
title: 签到配置
sign_score:
title: 签到获得积分
addon1: 积分 ~
addon2: 积分
sign_gap_time:
title: 签到间隔时间
addon: 小时
sign_after_zero:
title: 签到时间
label: 每天零点后可签到
hint: 勾选后将无视上一条,每天零时后均可签到
sign_score:
title: 签到获得积分
addon1: 积分 ~
addon2: 积分
sign_gap_time:
title: 签到间隔时间
addon: 小时
sign_after_zero:
title: 签到时间
label: 每天零点后可签到
hint: 勾选后将无视上一条,每天零时后均可签到
general:
title: 常规选项
site_name: 站点标题
site_description: 站点描述
site_url:
title: 站点地址URL
hint: 以 http(s):// 开头,不要以 / 结尾
user_can_register:
title: 开放注册
label: 任何人都可以注册
regs_per_ip: 每个 IP 限制注册数
max_upload_file_size:
title: 最大允许上传大小
hint: PHP 限制::size定义在 php.ini 中。
allow_chinese_playername:
title: 角色名
label: 允许中文角色名
api_type: 首选 JSON API
auto_del_invalid_texture:
title: 失效材质
label: 自动删除失效材质
hint: 自动从皮肤库中删除文件不存在的材质记录
comment_script:
title: 评论代码
description: 评论代码内可使用占位符,<code>{tid}</code> 将会被自动替换为材质的 id<code>{name}</code> 会被替换为材质名称,<code>{url}</code> 会被替换为当前页面地址。
allow_sending_statistic:
title: 统计信息
label: 发送程序使用情况统计信息以帮助开发
hint: 隐私信息不会被收集
site_name: 站点标题
site_description: 站点描述
site_url:
title: 站点地址URL
hint: 以 http(s):// 开头,不要以 / 结尾
user_can_register:
title: 开放注册
label: 任何人都可以注册
regs_per_ip: 每个 IP 限制注册数
max_upload_file_size:
title: 最大允许上传大小
hint: PHP 限制::size定义在 php.ini 中。
allow_chinese_playername:
title: 角色名
label: 允许中文角色名
api_type: 首选 JSON API
auto_del_invalid_texture:
title: 失效材质
label: 自动删除失效材质
hint: 自动从皮肤库中删除文件不存在的材质记录
comment_script:
title: 评论代码
description: 评论代码内可使用占位符,<code>{tid}</code> 将会被自动替换为材质的 id<code>{name}</code> 会被替换为材质名称,<code>{url}</code> 会被替换为当前页面地址。
allow_sending_statistics:
title: 统计信息
label: 发送程序使用情况统计信息以帮助开发
hint: 隐私信息不会被收集
announ:
title: 站点公告
announcement:
description: 可使用 Markdown 进行排版
cache:
announcement:
description: 可使用 Markdown 进行排版
resources:
title: 资源文件配置
hint: 如果启用了 CDN 缓存请适当修改这些配置
force_ssl:
title: 强制 SSL
label: 强制使用 HTTPS 协议加载资源
hint: 请确认 SSL 可用后再开启
auto_detect_asset_url:
title: 资源地址
label: 自动判断资源文件地址
description: 根据当前 URL 自动加载资源文件,如果关闭则将根据「站点地址」填写的内容加载。如果出现 CDN 回源问题请关闭
return_200_when_notfound:
title: HTTP 响应码
label: 请求不存在的角色时返回 200 而不是 404
cache_expire_time:
title: 缓存失效时间
hint: 秒数86400 = 一天31536000 = 一年
force_ssl:
title: 强制 SSL
label: 强制使用 HTTPS 协议加载资源
hint: 请确认 SSL 可用后再开启
auto_detect_asset_url:
title: 资源地址
label: 自动判断资源文件地址
description: 根据当前 URL 自动加载资源文件,如果关闭则将根据「站点地址」填写的内容加载。如果出现 CDN 回源问题请关闭
return_200_when_notfound:
title: HTTP 响应码
label: 请求不存在的角色时返回 200 而不是 404
description: 如果你的 CDN 不缓存 404 页面,请打开此项。否则大量对不存在角色的 Profile 请求会加重站点负载。
cache_expire_time:
title: 缓存失效时间
hint: 秒数86400 = 一天31536000 = 一年
update:
title: 更新选项
check_update:
title: 检查更新
label: 自动检查更新并提示
update_source:
title: 更新源
description: 可用的更新源列表可以在这里查看:<a href="https://github.com/printempw/blessing-skin-server/wiki/%E6%9B%B4%E6%96%B0%E6%BA%90%E5%88%97%E8%A1%A8">@GitHub Wiki</a>
check_update:
title: 检查更新
label: 自动检查更新并提示
update_source:
title: 更新源
description: 可用的更新源列表可以在这里查看:<a href="https://github.com/printempw/blessing-skin-server/wiki/%E6%9B%B4%E6%96%B0%E6%BA%90%E5%88%97%E8%A1%A8">@GitHub Wiki</a>

View File

@ -25,7 +25,7 @@
<div class="col-md-6">
{!! $forms['announ']->render() !!}
{!! $forms['cache']->render() !!}
{!! $forms['resources']->render() !!}
</div>
</div>
@ -34,10 +34,3 @@
</div><!-- /.content-wrapper -->
@endsection
@section('style')
<style type="text/css">
.box-body > textarea { height: 200px; }
.description { margin: 7px 0 0 0; color: #555; }
</style>
@endsection