From 29e167e734eaef3083b9f26914c7b7acbd7e282e Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Sat, 29 Oct 2022 04:19:39 +0800 Subject: [PATCH] finish searchbox relate trans --- .../Resources/Section/CodecResource.php | 6 +- resources/lang/en/admin.php | 7 ++ resources/lang/en/label.php | 76 +++++++++++++++++++ resources/lang/en/searchbox.php | 2 +- resources/lang/zh_TW/admin.php | 7 ++ resources/lang/zh_TW/label.php | 72 ++++++++++++++++++ resources/lang/zh_TW/searchbox.php | 2 +- 7 files changed, 168 insertions(+), 4 deletions(-) diff --git a/app/Filament/Resources/Section/CodecResource.php b/app/Filament/Resources/Section/CodecResource.php index d0e4c49a..132493b1 100644 --- a/app/Filament/Resources/Section/CodecResource.php +++ b/app/Filament/Resources/Section/CodecResource.php @@ -61,8 +61,10 @@ class CodecResource extends Resource ->options(SearchBox::query()->pluck('name', 'id')->toArray()) ->label(__('label.search_box.taxonomy.mode')) ->query(function (Builder $query, array $data) { - return $query->where(function (Builder $query) use ($data) { - return $query->where('mode', 0)->orWhere('mode', $data['value']); + return $query->when($data['value'], function (Builder $query, $value) { + return $query->where(function (Builder $query) use ($value) { + return $query->where('mode', $value)->orWhere('mode', 0); + }); }); }) , diff --git a/resources/lang/en/admin.php b/resources/lang/en/admin.php index ce81cbeb..8f2f74b4 100644 --- a/resources/lang/en/admin.php +++ b/resources/lang/en/admin.php @@ -24,6 +24,13 @@ return [ 'menu' => 'Custom menu', 'username_change_log' => 'Username change log', 'torrent_deny_reason' => 'Deny Reasons', + 'roles' => 'Role', + 'permissions' => 'Permissions', + 'section' => 'Search boxes', + 'icon' => 'Category icons', + 'plugin' => 'Plugins', + 'category' => 'Categories', + 'second_icon' => 'Second icons', ], 'resources' => [ 'agent_allow' => [ diff --git a/resources/lang/en/label.php b/resources/lang/en/label.php index 3273d595..53b4ae32 100644 --- a/resources/lang/en/label.php +++ b/resources/lang/en/label.php @@ -232,4 +232,80 @@ return [ \App\Models\UserMeta::META_KEY_PERSONALIZED_USERNAME => 'Rainbow ID', ], ], + 'search_box' => [ + 'label' => 'Search box', + 'name' => 'SearchBox Name', + 'name_help' => 'Allowed Characters: [a-z] (in lower case), [0-9], [_./].', + 'section_name' => 'Section name', + 'section_name_help' => 'If set, displayed on the menu', + 'is_default' => 'Default or not', + 'showsubcat' => 'Show sub-category', + 'taxonomies' => 'Taxonomy', + 'taxonomy_display_text' => 'Display text', + 'torrent_field' => 'Torrents table field', + 'catsperrow' => 'Items per row', + 'catsperrow_help' => "Set how many items should show in a row in searchbox, e.g. '8'.", + 'catpadding' => "Padding between items", + 'catpadding_help' => "In pixels. The horizional padding space between items in searchbox, e.g. '3'.", + 'custom_fields' => 'Enable custom field ', + 'custom_fields_display_name' => 'Custom field display name', + 'custom_fields_display' => 'Custom field display', + 'custom_fields_display_help' => "Use 'specific label' to represent custom field's label and value,such as one custom field's name is 'artist', +then it's label:<%artist.label%>,it's value:<%artist.value%>", + 'category' => 'Category', + 'torrent_field_duplicate' => 'Torrent table field::field cannot be reused!', + 'taxonomy' => [ + 'name' => 'Name', + 'sort_index' => 'Sort', + 'sort_index_help' => "Ascendantly, i.e. '0' comes first.", + 'class_name' => 'class attribute', + 'class_name_help' => "The name of image file. Allowed Characters: [a-z] (in lower case), [0-9], [_./].", + 'image' => 'Image', + 'image_help' => 'The name of image file. Allowed Characters: [a-z] (in lower case), [0-9], [_./].', + 'icon_id' => 'Category icon pack', + 'mode' => 'SearchBox', + 'mode_help' => 'Leave blank to indicate that it applies to all sections', + ], + ], + 'icon' => [ + 'label' => 'Category icon', + 'folder' => 'Icon Pack Folder', + 'folder_help' => "The folder name of the icon pack. Allowed Characters: [a-z] (in lower case), [0-9], [_./].MUST add a trailing slash (/) at the end, e.g. 'mycaticon/'", + 'cssfile' => 'CSS file', + 'cssfile_help' => "CSS file for this icon pack. Enter the full path, e.g. 'styles/scenetorrents.css'. Leave it blank if none. +Allowed Characters: [a-z] (in lower case), [0-9], [_./].", + 'multilang' => 'Multi-lang.', + 'multilang_help' => "Whether use different category icons for different languages. If set to 'yes', put several packs of icons in several folders named 'en', 'chs', etc.", + 'secondicon' => 'Second Icon', + 'secondicon_help' => "Whether use second icons for additional information. If set to 'yes', put second icons in a folder named 'additional' together with normal icons.", + 'designer' => 'Designer', + 'designer_help' => 'The person who designed the icon pack.', + 'comment' => 'Comment', + 'comment_help' => ' Infomation about the icon pack.', + 'desc' => "You need to put the icons in the right directory for these settings to work. Put the normal icons in 'pic/category/searchbox_name/icon_pack_folder[language_short_name/]' and the second icons in 'pic/category/searchbox_name/icon_pack_folder[language_short_name/]additional/'. +Don't get it? See if the following examples could help: +When + searchbox_name='nhd' + icon_pack_folder='scenetorrents/' + multi-lang='yes' + second_icon='no' +you should put an English normal icon file for movies (e.g. 'movies.png') in 'pic/category/nhd/scenetorrents/en/' . +When + searchbox_name='chd' + icon_pack_folder='nanosofts/' + multi-lang='no' + second_icon='yes' +you should put a normal icon file for movies (e.g. movies.png) in 'pic/category/chd/nanosofts/' and an additional icon file (e.g. 'bdh264.png') in 'pic/category/chd/nanosofts/additional/'.", + ], + 'second_icon' => [ + 'label' => 'Second icon', + 'name' => 'Name', + 'name_help' => "Don't use long name. Recommend less than 10 letters.", + 'image' => "Image", + 'image_help' => "The name of image file. Allowed Characters: [a-z] (in lower case), [0-9], [_./].", + 'class_name' => 'class attribute', + 'class_name_help' => "The value of 'class' attribute of the image. Leave it blank if none. Allowed Characters: [a-z] (in lower case), [0-9], [_], and the first letter must be in [a-z].", + 'select_section' => 'Selections', + 'select_section_help' => "If a selection is not defined, all options from the selection are allowed for the rule. At least one selection should be defined.", + ], ]; diff --git a/resources/lang/en/searchbox.php b/resources/lang/en/searchbox.php index c4396836..302519b7 100644 --- a/resources/lang/en/searchbox.php +++ b/resources/lang/en/searchbox.php @@ -8,7 +8,7 @@ return [ 'sub_category_team_label' => 'Team', 'sub_category_processing_label' => 'Processing', 'sub_category_codec_label' => 'Codec', - 'sub_category_audio_codec_label' => 'AudioCodec', + 'sub_category_audiocodec_label' => 'AudioCodec', 'extras' => [ \App\Models\SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => 'Display cover on torrent list', \App\Models\SearchBox::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST => 'Display seed box icon on torrent list', diff --git a/resources/lang/zh_TW/admin.php b/resources/lang/zh_TW/admin.php index 07664aed..134366d6 100644 --- a/resources/lang/zh_TW/admin.php +++ b/resources/lang/zh_TW/admin.php @@ -24,6 +24,13 @@ return [ 'menu' => '自定義菜單', 'username_change_log' => '改名記錄', 'torrent_deny_reason' => '拒絕原因', + 'roles' => '角色', + 'permissions' => '權限', + 'section' => '分類模式', + 'icon' => '分類圖標', + 'plugin' => '插件', + 'category' => '主分類', + 'second_icon' => '第二圖標', ], 'resources' => [ 'agent_allow' => [ diff --git a/resources/lang/zh_TW/label.php b/resources/lang/zh_TW/label.php index d1ac1dca..3e7b97d9 100644 --- a/resources/lang/zh_TW/label.php +++ b/resources/lang/zh_TW/label.php @@ -232,4 +232,76 @@ return [ \App\Models\UserMeta::META_KEY_PERSONALIZED_USERNAME => '彩虹 ID', ], ], + 'search_box' => [ + 'label' => '分類模式', + 'name' => '名稱', + 'section_name' => '分區名稱', + 'section_name_help' => '若設置,顯示在菜單上', + 'is_default' => '是否默認', + 'showsubcat' => '次分類', + 'taxonomies' => '分類法', + 'taxonomy_display_text' => '顯示文案', + 'torrent_field' => '種子表字段', + 'catsperrow' => '每行項目數', + 'catsperrow_help' => "設置在搜索箱中每行顯示的項目數,如'8'。", + 'catpadding' => "項目間距", + 'catpadding_help' => "單位為像素。搜索箱中項目的水平間隔距離,如'3'。", + 'custom_fields' => '啟用自字義字段', + 'custom_fields_display_name' => '自定義字段展示名稱', + 'custom_fields_display' => '自定義字段展示', + 'custom_fields_display_help' => '使用特殊的標簽代表字段的名稱和值,如某字段其 Name 為 artist,則它的名稱為:<%artist.label%>,它的值為:<%artist.value%>', + 'category' => '分類', + 'torrent_field_duplicate' => '種子表字段::field 不能重復使用!', + 'taxonomy' => [ + 'name' => '名稱', + 'sort_index' => '排序', + 'sort_index_help' => "遞增排序,即'0'排在最前。", + 'class_name' => 'class屬性值', + 'class_name_help' => "為圖片指定class屬性值。若無請留空。允許的字符: [a-z](小寫),[0-9],[_],第一個字符必須是字母。", + 'image' => '圖片文件名', + 'image_help' => '圖片文件的名字。允許的字符:[a-z](小寫),[0-9],[_./]。', + 'icon_id' => '分類圖標', + 'mode' => '分區', + 'mode_help' => '留空表示適用於全部分區', + ], + ], + 'icon' => [ + 'label' => '分類圖標', + 'folder' => '圖標文件夾', + 'folder_help' => "分類圖標所在的文件夾名。允許的字符:[a-z](小寫),[0-9],[_./]。必須在末尾添加斜杠(/),如'mycaticon/'", + 'cssfile' => 'CSS 文件', + 'cssfile_help' => "為此分類圖標指定CSS文件。填寫完整路徑,如'styles/scenetorrents.css'。若無請留空。允許的字符:[a-z](小寫),[0-9],[_./]。", + 'multilang' => '多語言', + 'multilang_help' => "是否為不同語言使用不同的分類圖標。如果設為'是',將多份圖標分別放入命名如'en','chs'等的文件夾中。", + 'secondicon' => '第二圖標', + 'secondicon_help' => "是否使用第二圖標顯示補充信息。如果設為'是',將第二圖標放入普通圖標目錄下命名為'additional'的文件夾中。", + 'designer' => '設計者', + 'designer_help' => '此圖標集的設計者。', + 'comment' => '說明', + 'comment_help' => '此圖標集的說明。', + 'desc' => "你必須將圖標文件放入服務器正確的目錄才能使得以下設定起作用。將普通的分類圖標放入'pic/category/分類模式名字/圖標文件夾[語言縮寫/]',將第二圖標放入'pic/category/分類模式名字/圖標文件夾[語言縮寫/]additional/'.不明白?參考下面的例子: +當 + 分類模式名字='nhd' + 圖標文件夾='scenetorrents/' + 多語言='是' + 第二圖標='否' +你應該將一個英語的電影類型的圖標(如'movies.png')文件放入'pic/category/nhd/scenetorrents/en/'。 +當 + 分類模式名字='chd' + 圖標文件夾='nanosofts/' + 多語言='否' + 第二圖標='是' +你應該將一個電影類型的圖標(如'movies.png')文件放入'pic/category/chd/nanosofts/',將一個第二圖標(如'bdh264.png')放入'pic/category/chd/nanosofts/additional/'。", + ], + 'second_icon' => [ + 'label' => '第二圖標', + 'name' => '名字', + 'name_help' => '不要使用過長的名字。建議在10個字母內。', + 'image' => "圖片文件名", + 'image_help' => "圖片文件的名字。允許的字符:[a-z](小寫),[0-9],[_./]。", + 'class_name' => 'class屬性值', + 'class_name_help' => "為圖片指定class屬性值。若無請留空。允許的字符: [a-z](小寫),[0-9],[_],第一個字符必須是字母。", + 'select_section' => '選擇', + 'select_section_help' => "如果某個選擇未指定,其所有選項都符合此規則。必須至少指定一個選擇。", + ], ]; diff --git a/resources/lang/zh_TW/searchbox.php b/resources/lang/zh_TW/searchbox.php index 73558bae..3b4801a9 100644 --- a/resources/lang/zh_TW/searchbox.php +++ b/resources/lang/zh_TW/searchbox.php @@ -8,7 +8,7 @@ return [ 'sub_category_team_label' => '製作組', 'sub_category_processing_label' => '處理', 'sub_category_codec_label' => '編碼', - 'sub_category_audio_codec_label' => '音頻編碼', + 'sub_category_audiocodec_label' => '音頻編碼', 'extras' => [ \App\Models\SearchBox::EXTRA_DISPLAY_COVER_ON_TORRENT_LIST => '種子列表頁展示封面', \App\Models\SearchBox::EXTRA_DISPLAY_SEED_BOX_ICON_ON_TORRENT_LIST => '種子列表頁展示 SeedBox 圖標',