Skip to content

Commit

Permalink
Added Media Library translation
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanhao Li authored and ifox committed Mar 2, 2020
1 parent abb61e3 commit b593ad3
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 18 deletions.
12 changes: 6 additions & 6 deletions frontend/js/components/Filter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@

<div class="filter__search">
<input type="search" class="form__input form__input--small" name="search" :value="searchValue" :placeholder="placeholder" @input="onSearchInput" />
<a17-button class="filter__toggle" variant="ghost" @click="toggleFilter" v-if="withHiddenFilters" :aria-expanded="opened ? 'true' : 'false'" >Filter <span v-svg symbol="dropdown_module"></span></a17-button>
<a17-button class="filter__toggle" variant="ghost" @click="toggleFilter" v-if="withHiddenFilters" :aria-expanded="opened ? 'true' : 'false'" >{{ $trans('filter.toggle-label', 'Filter') }} <span v-svg symbol="dropdown_module"></span></a17-button>
<slot name="additional-actions"></slot>
</div>
</div>
<transition :css='false' :duration="275" @before-enter="beforeEnter" @enter="enter" @before-leave="beforeLeave" @leave="leave">
<div class="filter__more" v-show="opened" v-if="withHiddenFilters" :aria-hidden="!opened ? true : null" ref="more">
<div class="filter__moreInner" ref="moreInner">
<slot name="hidden-filters"></slot>
<div class="filter__btns">
<a17-button variant="ghost" type="submit">Apply</a17-button>
<a17-button v-if="clearOption" variant="ghost" type="button" @click="clear">Clear</a17-button>
</div>
<a17-button variant="ghost" type="submit">{{ $trans('filter.apply-btn', 'Apply') }}</a17-button>
<a17-button v-if="clearOption" variant="ghost" type="button" @click="clear">{{ $trans('filter.clear-btn', 'Clear') }}</a17-button>
</div>
</div>
</transition>
Expand All @@ -36,7 +34,9 @@
},
placeholder: {
type: String,
default: 'Search'
default () {
return this.$trans('filter.search-placeholder', 'Search')
}
},
closed: {
type: Boolean,
Expand Down
4 changes: 3 additions & 1 deletion frontend/js/components/VSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@
default: null
},
emptyText: {
default: 'Sorry, no matching options.'
default () {
return this.$trans('select.empty-text', 'Sorry, no matching options.')
}
},
options: {
default: function () { return [] }
Expand Down
2 changes: 1 addition & 1 deletion frontend/js/components/media-library/MediaLibrary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<div slot="hidden-filters">
<a17-vselect class="medialibrary__filter-item" ref="filter" name="tag" :options="tags"
placeholder="Filter by tag" :searchable="true" maxHeight="175px"/>
:placeholder="$trans('media-library.filter-select-label', 'Filter by tag')" :searchable="true" maxHeight="175px"/>
</div>
</a17-filter>
</div>
Expand Down
8 changes: 4 additions & 4 deletions frontend/js/components/media-library/MediaSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
<a17-mediasidebar-upload v-if="mediasLoading.length"/>
<template v-else>
<div class="mediasidebar__inner" :class="containerClasses">
<p v-if="!hasMedia" class="f--note">No file selected</p>
<p v-if="!hasMedia" class="f--note">{{ $trans('media-library.sidebar.empty-text', 'No file selected') }}</p>
<p v-if="hasMultipleMedias" class="mediasidebar__info">
{{ medias.length }} files selected <a href="#" @click.prevent="clear">Clear</a>
{{ medias.length }} {{ $trans('media-library.sidebar.files-selected', 'files selected') }} <a href="#" @click.prevent="clear">{{ $trans('media-library.sidebar.clear', 'Clear') }}</a>
</p>

<template v-if="hasSingleMedia">
<img v-if="isImage" :src="firstMedia.thumbnail" class="mediasidebar__img" :alt="firstMedia.original"/>
<p class="mediasidebar__name">{{ firstMedia.name }}</p>
<ul class="mediasidebar__metadatas">
<li class="f--small" v-if="firstMedia.size">File size: {{ firstMedia.size | uppercase }}</li>
<li class="f--small" v-if="firstMedia.size" >File size: {{ firstMedia.size | uppercase }}</li>
<li class="f--small" v-if="isImage && (firstMedia.width + firstMedia.height)">
Dimensions: {{ firstMedia.width }} &times; {{ firstMedia.height }}
{{ $trans('media-library.sidebar.dimensions', 'Dimensions') }}: {{ firstMedia.width }} &times; {{ firstMedia.height }}
</li>
</ul>
</template>
Expand Down
4 changes: 2 additions & 2 deletions frontend/js/components/media-library/Uploader.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<div class="uploader">
<div class="uploader__dropzone" ref="uploaderDropzone">
<div class="button" ref="uploaderBrowseButton">Add new</div>
<div class="uploader__dropzone--desktop">or drop new files here</div>
<div class="button" ref="uploaderBrowseButton">{{ $trans('uploader.upload-btn-label', 'Add new') }}</div>
<div class="uploader__dropzone--desktop">{{ $trans('uploader.dropzone-text', 'or drop new files here') }}</div>
</div>
</div>
</template>
Expand Down
24 changes: 23 additions & 1 deletion views/lang/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,28 @@
'logout' => 'Logout'
],
'media-library' => [
'title' => 'Media Library'
'title' => 'Media Library',
'images' => 'Images',
'files' => 'Files',
'filter-select-label' => 'Filter by tag',
'sidebar' => [
'empty-text' => 'No file selected',
'files-selected' => 'files selected',
'clear' => 'Clear',
'dimensions' => 'Dimensions'
]
],
'filter' => [
'search-placeholder'=> 'Search',
'toggle-label' => 'Filter',
'apply-btn' => 'Apply',
'clear-btn' => 'Clear'
],
'select' => [
'empty-text' => 'Sorry, no matching options.'
],
'uploader' => [
'dropzone-text' => 'or drop new files here',
'upload-btn-label' => 'Add new'
]
];
24 changes: 23 additions & 1 deletion views/lang/ja/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,28 @@
'logout' => 'ログアウト'
],
'media-library' => [
'title' => 'メディアライブラリ'
'title' => 'メディアライブラリ',
'images' => '画像',
'files' => 'ファイル',
'filter-select-label' => 'ラベルによるフィルター',
'sidebar' => [
'empty-text' => 'ファイルが選択されていません',
'files-selected' => '選択されたファイル',
'clear' => 'キャンセル',
'dimensions' => 'サイズ'
]
],
'filter' => [
'search-placeholder'=> '検索',
'toggle-label' => 'フィルタ',
'apply-btn' => '適用する',
'clear-btn' => 'キャンセル'
],
'select' => [
'empty-text' => '一致するオプションはありません'
],
'uploader' => [
'dropzone-text' => 'ここに新しいファイルをドロップします',
'upload-btn-label' => '追加'
]
];
4 changes: 2 additions & 2 deletions views/layouts/main.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
@if (config('twill.enabled.media-library'))
window['{{ config('twill.js_namespace') }}'].STORE.medias.types.push({
value: 'image',
text: 'Images',
text: '{{ __("twill::lang.media-library.images") }}',
total: {{ \A17\Twill\Models\Media::count() }},
endpoint: '{{ route('admin.media-library.medias.index') }}',
tagsEndpoint: '{{ route('admin.media-library.medias.tags') }}',
Expand All @@ -99,7 +99,7 @@
@if (config('twill.enabled.file-library'))
window['{{ config('twill.js_namespace') }}'].STORE.medias.types.push({
value: 'file',
text: 'Files',
text: '{{ __("twill::lang.media-library.files") }}',
total: {{ \A17\Twill\Models\File::count() }},
endpoint: '{{ route('admin.file-library.files.index') }}',
tagsEndpoint: '{{ route('admin.file-library.files.tags') }}',
Expand Down

0 comments on commit b593ad3

Please sign in to comment.