enhance translations of skinlib

This commit is contained in:
printempw 2016-09-30 20:46:15 +08:00
parent 7ead22de93
commit a079331bf8
14 changed files with 325 additions and 340 deletions

View File

@ -4,6 +4,7 @@ namespace App\Services;
use App\Exceptions\PrettyPageException;
use Storage;
use Log;
class Utils
{
@ -42,16 +43,24 @@ class Utils
$path = 'tmp'.time();
$absolute_path = BASE_DIR."/storage/textures/$path";
if (false === move_uploaded_file($file['tmp_name'], $absolute_path)) {
throw new App\Exceptions\E('Failed to remove uploaded files, please check the permission', 1);
} else {
$hash = hash_file('sha256', $absolute_path);
if (!Storage::disk('textures')->has($hash)) {
Storage::disk('textures')->move($path, $hash);
try {
if (false === move_uploaded_file($file['tmp_name'], $absolute_path)) {
throw new Exception('Failed to remove uploaded files, please check the permission', 1);
}
} catch (\Exception $e) {
Log::warning("Failed to move uploaded file, $e");
} finally {
if (file_exists($absolute_path)) {
$hash = hash_file('sha256', $absolute_path);
return $hash;
if (!Storage::disk('textures')->has($hash)) {
Storage::disk('textures')->move($path, $hash);
}
return $hash;
} else {
Log::warning("Failed to upload file $path");
}
}
}

View File

@ -1,67 +1,76 @@
index:
now-showing: Now showing
any-model: (Any model)
steve-model: Steve Model
alex-model: Alex Model
uploader: User ( :name ) uploaded
newest-uploaded: Newestly uploaded
most-likes: Most likes
no-result: 'No result.'
item:
remove-from-closet: Remove from closet.
add-to-closet: Add to closet.
not-logged-in: Please login.
private: Private
master:
general:
filter: Filter
my-upload: My upload
sort: Sorting
search-textures: Search textures
upload-new-skin: Upload new skin
search:
title: Result
no-given-keywords: 'No keywords'
my-upload: My Uploaded
sort: Sort
search-textures: Search For Textures
upload-new-skin: Upload New Skin
no-result: No result.
show:
title: Details of texture
login-before-using-closet: Please login before using closet.
number-of-likes: Number of likes
detail: Details
name: Name
modify-name: Modify name
suitable-model: Suitable model
download-raw: Right-click and choose SAVE AS then you can download raw skin file.
size-of-file: Size of file
uploader: Uploader
upload-at: Date of upload
delete-texture: Delete texture
change-privacy: Change privacy
message: 'Textures setted to be private or deleted will be removed from all collectors'' closets.'
set-private: Be private
set-public: Be public
set-message: 'You can make this texture private or delete it, which will remove it from all collectors'' closets.'
comment: Comments
no-comment: We have not enabled comment service.
filter:
now-showing: Now showing
skin: Skin
cape: Cape
any-model: (Any Model)
steve-model: (Steve Model)
alex-model: (Alex Model)
uploader: User (:name) Uploaded
deleted: The requested texture file is already deleted.
contact-admin: Please contact the admin to delete this texture.
private: The requested texture is private and is only visible to uploader and admins.
sort:
newest-uploaded: Newestly Uploaded
most-liked: Most Liked
item:
steve: (Steve)
alex: (Alex)
cape: (Cape)
remove-from-closet: Remove from closet
add-to-closet: Add to closet
anonymous: Please login first
private: Private
search:
title: 'Search Result: :query'
no-keywords: No keywords given
show:
title: Texture Details
anonymous: You must login to use closets
likes: People who like this
detail: Details
name: Texture Name
edit-name: Edit Name
model: Applicable Model
download-raw: Click to download raw texture
size: File Size
uploader: Uploader
upload-at: Upload At
manage-panel: Manage Panel
delete-texture: Delete Texture
notice: The texture which was deleted or setted to private will be removed from the closet of everyone who had favorited it.
notice-admin: You are able to delete this texture or make it private. The operations will make it removed from the closet of everyone who had favorited it.
comment: Comment
comment-not-available: Comment is not available.
deleted: The requested texture was already deleted.
contact-admin: Please contact the admins to remove this entry.
private: The requested texture is private and only visible to the uploader and admins.
upload:
title: Upload texture
title: Upload Texture
texture-name: Texture Name
name-rule: Less than 32 characters and must not contain any special one.
texture-type: Texture Type
select-file: Select File
private-score-notice: It will spend you more scores to set it as private. You will be charged :score scores for every KB storage.
privacy-notice: Prevent it from being visible at skin library.
set-as-private: Make it Private
button: Upload
upload: Upload
texture-name: Texture name
name-message: Length of texture name should be less than 32 bytes and it cannot contain invaild character.
texture-type: Texture type
choose-file: Choose file
storage-message: Private texture will cost more scores. Every KB costs :score scores
privacy-message: Others cannot find it in skin library.
set-private: Make it private.
type-error: Incorrect mime type of uploaded file.
invalid-size: Invalid :type file (Width :width, Height :height)
@ -74,6 +83,9 @@ delete:
success: The texture was deleted successfully.
privacy:
change-privacy: Change Privacy
set-as-private: Set as Private
set-as-public: Set as Public
success: The texture was setted to :privacy successfully.
rename:
@ -81,4 +93,3 @@ rename:
no-permission: You aren't the uploader of this texture.
non-existent: Non-existent texture.

View File

@ -1,51 +1,58 @@
index:
now-showing: 当前正显示
any-model: (任意模型)
steve-model: Steve 模型
alex-model: Alex 模型
uploader: 用户( :name )上传
newest-uploaded: 最新上传
most-likes: 最多收藏
no-result: 无结果
item:
remove-from-closet: 从衣柜中移除
add-to-closet: 添加至衣柜
not-logged-in: 请先登录
private: 私密
master:
general:
filter: 过滤器
my-upload: 我的上传
sort: 排序
search-textures: 搜索材质
upload-new-skin: 上传新皮肤
no-result: 无结果
filter:
now-showing: 当前正显示
skin: 皮肤
cape: 披风
any-model: (任意模型)
steve-model: Steve 模型)
alex-model: Alex 模型)
uploader: 用户(:name上传
sort:
newest-uploaded: 最新上传
most-likes: 最多收藏
item:
steve: Steve
alex: Alex
cape: (披风)
remove-from-closet: 从衣柜中移除
add-to-closet: 添加至衣柜
anonymous: 请先登录
private: 私密
search:
title: 搜索结果
no-given-keywords: 未指定关键字
no-result: 无结果
title: 搜索结果::query
no-keywords: 未指定关键字
show:
title: 材质详情
login-before-using-closet: 登录后才能使用衣柜哦
number-of-likes: 收藏人数
anonymous: 登录后才能使用衣柜哦
likes: 收藏人数
detail: 详细信息
name: 名称
modify-name: 修改名称
suitable-model: 适用模型
edit-name: 修改名称
model: 适用模型
download-raw: 右键另存为即可下载原始皮肤文件
size-of-file: 文件大小
size: 文件大小
uploader: 上传者
upload-at: 上传日期
manage-panel: 管理面板
delete-texture: 删除材质
change-privacy: 设置隐私
message: 材质设为隐私或被删除后将会从每一个收藏者的衣柜中移除。
set-private: 设为隐私
set-public: 设为公开
set-message: 你可以将此材质设为隐私或删除。这将会使此材质从每一个收藏者的衣柜中移除。
notice: 材质设为隐私或被删除后将会从每一个收藏者的衣柜中移除。
notice-admin: 你可以将此材质设为隐私或删除。这将会使此材质从每一个收藏者的衣柜中移除。
comment: 评论区
no-comment: 本站未开启评论服务
comment-not-available: 本站未开启评论服务
deleted: 请求的材质文件已经被删除
contact-admin: 请联系管理员删除该条目
@ -53,15 +60,16 @@ show:
upload:
title: 上传材质
button: 确认上传
upload: 上传
texture-name: 材质名称
name-message: 材质名称应该小于 32 个字节且不能包含奇怪的符号
name-rule: 材质名称应该小于 32 个字节且不能包含奇怪的符号
texture-type: 材质类型
choose-file: 选择文件
storage-message: 私密材质将会消耗更多的积分:每 KB 存储空间 :score 积分
privacy-message: 其他人将不会在皮肤库中看到此材质
set-private: 设置为私密材质
select-file: 选择文件
private-score-notice: 私密材质将会消耗更多的积分:每 KB 存储空间 :score 积分
privacy-notice: 其他人将不会在皮肤库中看到此材质
set-as-private: 设置为私密材质
button: 确认上传
type-error: 文件格式不对哦
invalid-size: 不是有效的 :type 文件(宽 :width高 :height
@ -74,6 +82,9 @@ delete:
success: 材质已被成功删除
privacy:
change-privacy: 设置隐私
set-as-private: 设为隐私
set-as-public: 设为公开
success: 材质已被设为 :privacy
rename:

View File

@ -12,29 +12,7 @@
{{ trans('general.skinlib') }}
<small>Skin Library</small>
</h1>
<ol class="breadcrumb">
<li><i class="fa fa-tags"></i> {{ trans('skinlib.index.now-showing') }}</li>
<li>
@if ($filter == "skin")
{{ trans('general.skin') }}<small>{{ trans('skinlib.index.any-model') }}</small>
@elseif ($filter == "steve")
{{ trans('skinlib.index.any-model') }}<small>({{ trans('skinlib.index.steve-model') }})</small>
@elseif ($filter == "alex")
{{ trans('general.skin') }}<small>{{ trans('skinlib.index.alex-model') }}</small>
@elseif ($filter == "cape")
{{ trans('general.cape') }}
@elseif ($filter == "user")
{{ trans('skinlib.index.uploader', ['name' => (new App\Models\User($_GET['uid']))->getNickName()]) }}
@endif
</li>
<li class="active">
@if ($sort == "time")
{{ trans('skinlib.index.newest-uploaded') }}
@elseif ($sort == "likes")
{{ trans('skinlib.index.most-likes') }}
@endif
</li>
</ol>
@include('vendor.breadcrumb')
</section>
<!-- Main content -->
@ -46,38 +24,12 @@
@include('skinlib.item')
</a>
@empty
<p style="text-align: center; margin: 30px 0;">{{ trans('skinlib.index.no-result') }}</p>
<p style="text-align: center; margin: 30px 0;">{{ trans('skinlib.general.no-result') }}</p>
@endforelse
</div><!-- /.box-body -->
<div class="box-footer">
<!-- Pagination -->
<ul class="pagination pagination-sm no-margin pull-right">
<?php
$base_url = ($filter != "" && $sort != "") ? "?filter=$filter&sort=$sort&" : "?";
if (isset($_GET['uid'])) $base_url.= "uid=".$_GET['uid']."&";
?>
<li><a href="{{ $base_url }}page=1">«</a></li>
@if ($page != 1)
<li><a href="{{ $base_url }}page={{ $page-1 }}">{{ $page - 1 }}</a></li>
@endif
<li><a href="{{ $base_url }}page={{ $page }}" class="active">{{ $page }}</a></li>
@if ($total_pages > $page)
<li><a href="{{ $base_url }}page={{ $page+1 }}">{{ $page+1 }}</a></li>
@endif
<li><a href="{{ $base_url }}page={{ $total_pages }}">»</a></li>
</ul>
<select id="page-select" class="pull-right">
@for ($i = 1; $i <= $total_pages; $i++)
<option value='{{ $i }}' {{ ($i == $page) ? 'selected="selected"' : '' }}>{{ $i }}</option>
@endfor
</select>
<p class="pull-right">{{ trans('general.pagination', ['page' => $page , 'total' => $total_pages]) }}</p>
@include('vendor.pagination')
</div>
</div><!-- /.box -->
</section><!-- /.content -->

View File

@ -1,14 +1,15 @@
<div class="item" tid="{{ $texture['tid'] }}">
<div class="item-body">
<img src="{{ url('preview/'.$texture['tid'].'.png') }}">
<img src="{{ url("preview/{$texture['tid']}.png") }}">
</div>
<div class="item-footer">
<p class="texture-name">
<span title="{{ $texture['name'] }}">{{ $texture['name'] }} <small>({{ $texture['type'] }})</small></span>
<span title="{{ $texture['name'] }}">{{ $texture['name'] }}
<small>{{ trans("skinlib.item.{$texture['type']}") }}</small>
</span>
</p>
@if (Session::has('uid'))
@if ($user->closet->has($texture['tid']))
@ -18,7 +19,7 @@
@endif
@else
<a title="{{ trans('skinlib.item.not-logged-in') }}" class="more like" href="javascript:;" data-placement="top" data-toggle="tooltip"><i class="fa fa-heart"></i></a>
<a title="{{ trans('skinlib.item.anonymous') }}" class="more like" href="javascript:;" data-placement="top" data-toggle="tooltip"><i class="fa fa-heart"></i></a>
@endif
@if ($texture['public'] == "0")

View File

@ -31,31 +31,35 @@
<ul class="nav navbar-nav">
<li class="active"><a href="{{ url('skinlib') }}">{{ trans('general.skinlib') }}</a></li>
<li><a href="{{ url('user/closet') }}">{{ trans('general.my-closet') }}</a></li>
@unless (isset($with_out_filter))
<!-- Filters -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-filter" aria-hidden="true"></i> {{ trans('skinlib.master.filter') }} <span class="caret"></span>
<i class="fa fa-filter" aria-hidden="true"></i> {{ trans('skinlib.general.filter') }} <span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li><a href='?{{ isset($_GET["q"]) ? "q=$q&" : "" }}filter=skin&sort={{ $sort }}'>{{ trans('general.skin') }}<small>{{ trans('skinlib.index.any-model') }}</small></a></li>
<li><a href='?{{ isset($_GET["q"]) ? "q=$q&" : "" }}filter=steve&sort={{ $sort }}'>{{ trans('general.skin') }}<small>({{ trans('skinlib.index.steve-model') }})</small></a></li>
<li><a href='?{{ isset($_GET["q"]) ? "q=$q&" : "" }}filter=alex&sort={{ $sort }}'>{{ trans('general.skin') }}<small>({{ trans('skinlib.index.alex-model') }})</small></a></li>
<li><a href='?{{ isset($_GET["q"]) ? "q=$q&" : "" }}filter=skin&sort={{ $sort }}'>{{ trans('general.skin') }} <small>{{ trans('skinlib.filter.any-model') }}</small></a></li>
<li><a href='?{{ isset($_GET["q"]) ? "q=$q&" : "" }}filter=steve&sort={{ $sort }}'>{{ trans('general.skin') }} <small>{{ trans('skinlib.filter.steve-model') }}</small></a></li>
<li><a href='?{{ isset($_GET["q"]) ? "q=$q&" : "" }}filter=alex&sort={{ $sort }}'>{{ trans('general.skin') }} <small>{{ trans('skinlib.filter.alex-model') }}</small></a></li>
<li class="divider"></li>
<li><a href='?{{ isset($_GET["q"]) ? "q=$q&" : "" }}filter=cape&sort={{ $sort }}'>{{ trans('general.cape') }}</a></li>
@if (!is_null($user))
<li class="divider"></li>
<li><a href="?filter=user&uid={{ $user->uid }}&sort={{ $sort }}">{{ trans('skinlib.master.my-upload') }}</a></li>
<li><a href="?filter=user&uid={{ $user->uid }}&sort={{ $sort }}">{{ trans('skinlib.general.my-upload') }}</a></li>
@endif
</ul>
</li>
<!-- Sort -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-sort-amount-desc" aria-hidden="true"></i> {{ trans('skinlib.master.sort') }} <span class="caret"></span>
<i class="fa fa-sort-amount-desc" aria-hidden="true"></i> {{ trans('skinlib.general.sort') }} <span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li><a href='?{{ isset($_GET["q"]) ? "q=$q&" : "" }}filter={{ $filter }}{{ isset($_GET['uid']) ? "&uid={$_GET['uid']}" : "" }}&sort=likes'>{{ trans('skinlib.index.most-likes') }}</a></li>
<li><a href='?{{ isset($_GET["q"]) ? "q=$q&" : "" }}filter={{ $filter }}{{ isset($_GET['uid']) ? "&uid={$_GET['uid']}" : "" }}&sort=likes'>{{ trans('skinlib.sort.most-liked') }}</a></li>
<li class="divider"></li>
<li><a href='?{{ isset($_GET["q"]) ? "q=$q&" : "" }}filter={{ $filter }}{{ isset($_GET['uid']) ? "&uid={$_GET['uid']}" : "" }}&sort=time'>{{ trans('skinlib.index.newest-uploaded') }}</a></li>
<li><a href='?{{ isset($_GET["q"]) ? "q=$q&" : "" }}filter={{ $filter }}{{ isset($_GET['uid']) ? "&uid={$_GET['uid']}" : "" }}&sort=time'>{{ trans('skinlib.sort.newest-uploaded') }}</a></li>
</ul>
</li>
@endunless
@ -64,14 +68,14 @@
</ul>
<form class="navbar-form navbar-left" role="search" action="{{ url('skinlib/search') }}">
<div class="form-group">
<input type="text" class="form-control" id="navbar-search-input" name="q" placeholder="{{ trans('skinlib.master.search-textures') }}" value="{{ $q or '' }}" />
<input type="text" class="form-control" id="navbar-search-input" name="q" placeholder="{{ trans('skinlib.general.search-textures') }}" value="{{ $q or '' }}" />
</div>
</form>
</div><!-- /.navbar-collapse -->
<!-- Navbar Right Menu -->
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<li><a href="{{ url('skinlib/upload') }}"><i class="fa fa-upload" aria-hidden="true"></i> {{ trans('skinlib.master.upload-new-skin') }}</a></li>
<li><a href="{{ url('skinlib/upload') }}"><i class="fa fa-upload" aria-hidden="true"></i> {{ trans('skinlib.general.upload-new-skin') }}</a></li>
@if (!is_null($user))
<!-- User Account Menu -->
<li class="dropdown user user-menu">

View File

@ -1,6 +1,6 @@
@extends('skinlib.master')
@section('title', trans('skinlib.search.title'))
@section('title', trans('skinlib.search.title', ['query' => isset($_GET['q']) ? $_GET['q'] : trans('skinlib.search.no-keywords')]))
@section('content')
<!-- Full Width Column -->
@ -9,45 +9,23 @@
<!-- Content Header (Page header) -->
<section class="content-header">
<h1>
{{ trans('skinlib.search.title') }}: {{ $_GET['q'] or trans('skinlib.search.no-given-keywords') }}
<small>Skin Library</small>
{{ $__env->getSections()['title'] }}
<small>Search Result</small>
</h1>
@include('vendor.breadcrumb')
</section>
<!-- Main content -->
<section class="content">
<div class="box box-default">
<div class="box-header with-border">
<h3 class="box-title">{{ trans('skinlib.index.now-showing') }}:
<small>{{ trans('skinlib.master.filter') }}:
@if ($filter == "skin")
{{ trans('general.skin').trans('skinlib.index.any-model') }}
@elseif ($filter == "steve")
{{ trans('general.skin').'('.trans('skinlib.index.steve-model').')' }}
@elseif ($filter == "alex")
{{ trans('general.skin').'('.trans('skinlib.index.alex-model').')' }}
@elseif ($filter == "cape")
{{ trans('general.cape') }}
@endif
</small>
<small>,{{ trans('skinlib.master.sort') }}:
@if ($sort == "time")
{{ trans('skinlib.index.newest-uploaded') }}
@elseif ($sort == "likes")
{{ trans('skinlib.index.most-likes') }}
@endif
</small>
</h3>
</div><!-- /.box-header -->
<div class="box-body">
@forelse ($textures as $texture)
<a href="{{ url('skinlib/show?tid='.$texture['tid']) }}">
@include('skinlib.item')
</a>
@empty
<p style="text-align: center; margin: 30px 0;">{{ trans('skinlib.search.no-result') }}</p>
<p style="text-align: center; margin: 30px 0;">{{ trans('skinlib.general.no-result') }}</p>
@endforelse
</div><!-- /.box-body -->
</div><!-- /.box -->

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

26
resources/views/vendor/breadcrumb.tpl vendored Normal file
View File

@ -0,0 +1,26 @@
<ol class="breadcrumb">
<li><i class="fa fa-tags"></i> {{ trans('skinlib.filter.now-showing') }}</li>
<li>
@if ($filter == "skin")
{{ trans('skinlib.filter.skin') }}
<small>{{ trans('skinlib.filter.any-model') }}</small>
@elseif ($filter == "steve")
{{ trans('skinlib.filter.any-model') }}
<small>({{ trans('skinlib.filter.steve-model') }})</small>
@elseif ($filter == "alex")
{{ trans('skinlib.filter.skin') }}
<small>{{ trans('skinlib.filter.alex-model') }}</small>
@elseif ($filter == "cape")
{{ trans('skinlib.filter.cape') }}
@elseif ($filter == "user")
{{ trans('skinlib.filter.uploader', ['name' => (new App\Models\User($_GET['uid']))->getNickName()]) }}
@endif
</li>
<li class="active">
@if ($sort == "time")
{{ trans('skinlib.sort.newest-uploaded') }}
@elseif ($sort == "likes")
{{ trans('skinlib.sort.most-likes') }}
@endif
</li>
</ol>

18
resources/views/vendor/manage-panel.tpl vendored Normal file
View File

@ -0,0 +1,18 @@
<div class="box box-danger">
{{-- Texture Manage Panel --}}
<div class="box-header with-border">
<h3 class="box-title">{{ $title }}</h3>
</div><!-- /.box-header -->
<div class="box-body">
<p>{{ $message }}</p>
</div><!-- /.box-body -->
<div class="box-footer">
@if ($texture->public == "1")
<a href="javascript:changePrivacy({{ $texture->tid }});" class="btn btn-warning">{{ trans('skinlib.privacy.set-as-private') }}</a>
@else
<a href="javascript:changePrivacy({{ $texture->tid }});" class="btn btn-warning">{{ trans('skinlib.privacy.set-as-public') }}</a>
@endif
<a href="javascript:deleteTexture({{ $texture->tid }});" class="btn btn-danger pull-right">{{ trans('skinlib.show.delete-texture') }}</a>
</div><!-- /.box-footer -->
</div><!-- /.box -->

30
resources/views/vendor/pagination.tpl vendored Normal file
View File

@ -0,0 +1,30 @@
<!-- Pagination -->
<ul class="pagination pagination-sm no-margin pull-right">
<?php
// build base URL
$base_url = ($filter != "" && $sort != "") ? "?filter=$filter&sort=$sort&" : "?";
$base_url .= isset($_GET['uid']) ? "uid={$_GET['uid']}&" : "";
?>
<li><a href="{{ $base_url }}page=1">«</a></li>
@if ($page != 1)
<li><a href="{{ $base_url }}page={{ $page-1 }}">{{ $page - 1 }}</a></li>
@endif
<li><a href="{{ $base_url }}page={{ $page }}" class="active">{{ $page }}</a></li>
@if ($total_pages > $page)
<li><a href="{{ $base_url }}page={{ $page+1 }}">{{ $page+1 }}</a></li>
@endif
<li><a href="{{ $base_url }}page={{ $total_pages }}">»</a></li>
</ul>
<select id="page-select" class="pull-right">
@for ($i = 1; $i <= $total_pages; $i++)
<option value='{{ $i }}' {{ ($i == $page) ? 'selected="selected"' : '' }}>{{ $i }}</option>
@endfor
</select>
<p class="pull-right">{{ trans('general.pagination', ['page' => $page , 'total' => $total_pages]) }}</p>

File diff suppressed because one or more lines are too long