模板多语言

This commit is contained in:
WispX 2021-07-26 13:23:26 +08:00
parent b704a2c30a
commit 7b5634b439
4 changed files with 51 additions and 32 deletions

View File

@ -19,7 +19,7 @@
<select class="where mdui-select mdui-float-left" mdui-select>
<option value="{}">{:lang('All')}</option>
{foreach $strategyList as $key => $value}
<option value='{"strategy": "{$key}"}' {if $key eq $strategy}selected{/if}>{$value.name}</option>
<option value='{"strategy": "{$key}"}' {if $key eq $strategy}selected{/if}>{:lang($value.name)}</option>
{/foreach}
<option value='{"user_id": "0"}' {eq name="user_id" value="0"} selected{/eq}>{:lang('Visitor picture')}</option>
<option value='{"suspicious": "1"}' {eq name="suspicious" value="1"} selected{/eq}>{:lang('Suspicious picture')}</option>
@ -33,22 +33,22 @@
<table class="mdui-table mdui-table-selectable">
<thead>
<tr>
<th>所属用户</th>
<th>储存策略</th>
<th>别名</th>
<th>路径</th>
<th>大小</th>
<th>类型</th>
<th>上传IP</th>
<th>上传时间</th>
<th>操作</th>
<th>{:lang('User')}</th>
<th>{:lang('Storage strategy')}</th>
<th>{:lang('Alias')}</th>
<th>{:lang('Route')}</th>
<th>{:lang('Size')}</th>
<th>{:lang('Type')}</th>
<th>{:lang('Upload IP')}</th>
<th>{:lang('Upload time')}</th>
<th>{:lang('Operation')}</th>
</tr>
</thead>
<tbody>
{foreach $images as $key => $value}
<tr data-id="{$value.id}">
<td>{$value.username}</td>
<td>{$value.strategyStr}</td>
<td>{:lang($value.strategyStr)}</td>
<td>{$value.alias_name ?: '-'}</td>
<td>{$value.pathname}</td>
<td class="mdui-text-color-light-blue">{$value.size|format_size}</td>
@ -58,8 +58,8 @@
<td>
<img class="none" data-original="{$value.url}" src="{$value.url}">
<div class="mdui-btn-group">
<button class="mdui-btn mdui-btn-raised mdui-ripple mdui-btn-dense see" data-key="{$key}">查看</button>
<button class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-red mdui-btn-dense del">删除</button>
<button class="mdui-btn mdui-btn-raised mdui-ripple mdui-btn-dense see" data-key="{$key}">{:lang('See')}</button>
<button class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-red mdui-btn-dense del">{:lang('Delete')}</button>
</div>
</td>
</tr>
@ -85,9 +85,9 @@
<script>
var methods = {
delete: function (id, batch, callback) {
var msg = '确认删除该图片吗?';
var msg = lang('Are you sure to delete this picture?');
if (batch) {
msg = '确认删除选中项图片吗?';
msg = lang('Are you sure to delete the selected picture?');
}
mdui.confirm(msg, function () {
app.request("{:url('admin/images/delete')}", {id: id}, function () {
@ -95,7 +95,7 @@
});
}, function () {
}, {confirmText: '确定', cancelText: '取消'});
}, {confirmText: lang('Confirm'), cancelText: lang('Cancel')});
}
};
@ -112,7 +112,7 @@
});
} else {
mdui.snackbar({
message: '至少选择一项数据!'
message: lang('Select at least one data!')
});
}
}
@ -153,11 +153,11 @@
app.ajax("{:url('admin/images/getIpInfo')}", {ip: $(this).text()}, function (response) {
if (response.code) {
mdui.alert(
'国家:' + response.data.country +
'<br />地区:' + response.data.area +
'<br />区域:' + response.data.region +
'<br />城市:' + response.data.city +
'<br />县:' + response.data.county +
lang('Country:') + response.data.country +
'<br />' + lang('Region:') + response.data.area +
'<br />' + lang('Area:') + response.data.region +
'<br />' + lang('City:') + response.data.city +
'<br />' + lang('County:') + response.data.county +
'<br />ISP' + response.data.isp
, 'IP' + response.data.ip
);

View File

@ -8,12 +8,12 @@
<div class="strategy-container">
<div class="mdui-typo">
<blockquote class="mdui-m-l-0">
<p>储存策略,可配置多个,使用不同的角色组来控制用户图片储存策略。</p>
<p>{:lang('Storage strategy tips')}</p>
</blockquote>
</div>
<div id="tab" class="mdui-tab mdui-tab-scrollable" mdui-tab>
{foreach $strategy as $key => $value}
<a href="#tab-{$key}" class="mdui-ripple {if $key eq $config.storage_strategy}mdui-tab-active{/if}">{$value.name}</a>
<a href="#tab-{$key}" class="mdui-ripple {if $key eq $config.storage_strategy}mdui-tab-active{/if}">{:lang($value.name)}</a>
{/foreach}
</div>
<div class="mdui-col-sm-8 mdui-col-md-8">
@ -44,8 +44,8 @@
</div>
{/foreach}
<input type="hidden" name="storage_strategy" value="{$key}">
<button type="submit" class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme-accent">保存</button>
<button type="reset" class="mdui-btn mdui-btn-raised mdui-ripple">重置</button>
<button type="submit" class="mdui-btn mdui-btn-raised mdui-ripple mdui-color-theme-accent">{:lang('Save')}</button>
<button type="reset" class="mdui-btn mdui-btn-raised mdui-ripple">{:lang('Reset')}</button>
</form>
</div>
{/foreach}

View File

@ -208,4 +208,23 @@ return [
'Are you sure to freeze this user?' => '确认冻结该用户吗?',
'Are you sure to freeze the selected users?' => '确认冻结选中项用户吗?',
'Visitor picture' => '访客图片',
'User' => '所属用户',
'Alias' => '别名',
'Route' => '路径',
'Size' => '大小',
'Type' => '类型',
'Upload time' => '上传时间',
'See' => '查看',
'Country:' => '国家:',
'Region:' => '地区:',
'Area:' => '区域:',
'City:' => '城市:',
'County:' => '县:',
'Local' => '本地',
'Aliyun OSS' => '阿里云OSS',
'Tencent COS' => '腾讯云COS',
'Qiniu KODO' => '七牛云KODO',
'Upyun USS' => '又拍云USS',
'Remote' => '远程',
'Storage strategy tips' => '储存策略,可配置多个,使用不同的角色组来控制用户图片储存策略。'
];

View File

@ -10,27 +10,27 @@
return [
'local' => [
'name' => '本地',
'name' => 'Local',
'class' => \strategy\driver\Local::class
],
'oss' => [
'name' => '阿里云OSS',
'name' => 'Aliyun OSS',
'class' => \strategy\driver\Oss::class
],
'cos' => [
'name' => '腾讯云COS',
'name' => 'Tencent COS',
'class' => \strategy\driver\Cos::class
],
'kodo' => [
'name' => '七牛云KODO',
'name' => 'Qiniu KODO',
'class' => \strategy\driver\Kodo::class
],
'uss' => [
'name' => '又拍云USS',
'name' => 'Upyun USS',
'class' => \strategy\driver\Uss::class
],
'remote' => [
'name' => '远程',
'name' => 'Remote',
'class' => \strategy\driver\Remote::class
],
];