Skip to content

Commit b1520b2

Browse files
committed
feat: add theme and template related translations and UI updates
1 parent 2ddfe75 commit b1520b2

File tree

11 files changed

+85
-5
lines changed

11 files changed

+85
-5
lines changed

resources/lang/en/buttons.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
'label' => 'Cancel',
2828
],
2929

30+
'change_theme' => [
31+
'label' => 'Change theme',
32+
'messages' => [
33+
'success' => [
34+
'title' => 'Theme updated.',
35+
],
36+
'failure' => [
37+
'title' => 'Failed to change theme.',
38+
],
39+
],
40+
],
41+
3042
'choose' => [
3143
'label' => 'Choose',
3244
],
@@ -113,6 +125,18 @@
113125
'label' => 'Export',
114126
],
115127

128+
'export_content_templates' => [
129+
'label' => 'Export content templates',
130+
'messages' => [
131+
'success' => [
132+
'title' => 'Content templates exported successfully.',
133+
],
134+
'failure' => [
135+
'title' => 'Failed to export content templates.',
136+
],
137+
],
138+
],
139+
116140
'fix' => [
117141
'label' => 'Fix',
118142
],
@@ -278,4 +302,9 @@
278302
'label' => 'View',
279303
],
280304

305+
'view_usage' => [
306+
'label' => 'View usage',
307+
'heading' => 'View usage of :name',
308+
],
309+
281310
];

resources/lang/en/inspirecms.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@
55
'content' => 'Content',
66
'created_at' => 'Created at',
77
'created_by' => 'Created by',
8+
'current_xxx' => 'Current :name',
89
'dashboard' => 'Dashboard',
910
'default' => 'Default',
1011
'deleted_at' => 'Deleted at',
1112
'document_type' => 'Document Type',
1213
'export' => 'Export',
14+
'exported_content_template_directory' => 'Exported Content Template Directory',
1315
'field' => 'Fields',
1416
'field_group' => 'Custom Fields',
1517
'id' => 'ID',
1618
'import' => 'Import',
1719
'is_default' => 'Default',
1820
'language' => 'Language',
1921
'last_updated_at' => 'Last updated at',
22+
'layout' => 'Layout',
2023
'media' => 'Media',
2124
'n/a' => 'N/A',
2225
'navigation' => 'Navigation',
@@ -36,6 +39,7 @@
3639
'sitemap' => 'Sitemap',
3740
'table' => 'Table',
3841
'template' => 'Template',
42+
'theme' => 'Theme',
3943
'total_xxx_have_used' => 'Total :name has been used',
4044
'total_xxx_selected' => 'Total :count selected',
4145
'translatable' => 'Translatable',

resources/lang/en/widgets.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@
3535
],
3636

3737
'template_info' => [
38+
'title' => 'Template Info',
3839
'permission_display_name' => 'View Template Info',
3940
],
4041

4142
'theme_info' => [
43+
'title' => 'Theme Info',
4244
'permission_display_name' => 'View Theme Info',
4345
],
4446

resources/lang/zh_TW/buttons.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@
2727
'label' => '取消',
2828
],
2929

30+
'change_theme' => [
31+
'label' => '更改主題',
32+
'messages' => [
33+
'success' => [
34+
'title' => '主題更改成功。',
35+
],
36+
'failure' => [
37+
'title' => '更改主題失敗。',
38+
],
39+
],
40+
],
41+
3042
'choose' => [
3143
'label' => '選擇',
3244
],
@@ -113,6 +125,18 @@
113125
'label' => '匯出',
114126
],
115127

128+
'export_content_templates' => [
129+
'label' => '匯出內容模板',
130+
'messages' => [
131+
'success' => [
132+
'title' => '內容模板匯出成功。',
133+
],
134+
'failure' => [
135+
'title' => '匯出內容模板失敗。',
136+
],
137+
],
138+
],
139+
116140
'fix' => [
117141
'label' => '修復',
118142
],
@@ -278,4 +302,9 @@
278302
'label' => '查看',
279303
],
280304

305+
'view_usage' => [
306+
'label' => '查看使用情況',
307+
'heading' => '查看 :name 的使用情況',
308+
],
309+
281310
];

resources/lang/zh_TW/inspirecms.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
'content' => '內容',
66
'created_at' => '創建於',
77
'created_by' => '創建者',
8+
'current_xxx' => '當前 :name',
89
'dashboard' => '儀表板',
910
'default' => '默認',
1011
'deleted_at' => '刪除於',
1112
'export' => '匯出',
13+
'exported_content_template_directory' => '匯出內容模板目錄',
1214
'document_type' => '文件類型',
1315
'field' => '字段',
1416
'field_group' => '自定義字段',
@@ -17,6 +19,7 @@
1719
'is_default' => '默認',
1820
'language' => '語言',
1921
'last_updated_at' => '最後更新於',
22+
'layout' => '佈局',
2023
'media' => '媒體',
2124
'n/a' => '不適用',
2225
'navigation' => '導航',
@@ -36,6 +39,7 @@
3639
'sitemap' => '網站地圖',
3740
'table' => '表格',
3841
'template' => '模板',
42+
'theme' => '主題',
3943
'total_xxx_have_used' => '總共使用了 :name',
4044
'total_xxx_selected' => '總共選擇了 :count',
4145
'translatable' => '可翻譯',

resources/lang/zh_TW/widgets.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@
3535
],
3636

3737
'template_info' => [
38+
'title' => '模板資訊',
3839
'permission_display_name' => '查看模板資訊',
3940
],
4041

4142
'theme_info' => [
43+
'title' => '主題資訊',
4244
'permission_display_name' => '查看主題資訊',
4345
],
4446

resources/views/filament/widgets/template-info.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
$this->exportContentTemplatesAction,
55
]">
66
<x-slot name="heading">
7-
Template info
7+
{{ __('inspirecms::widgets.template_info.title') }}
88
</x-slot>
99

1010
{{ $this->infolist }}

resources/views/filament/widgets/theme-info.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
$this->cloneThemeAction,
66
]">
77
<x-slot name="heading">
8-
Theme info
8+
{{ __('inspirecms::widgets.theme_info.title') }}
99
</x-slot>
1010

1111
{{ $this->infolist }}

src/Filament/Resources/TemplateResource/Pages/ListTemplates.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function table(Table $table): Table
4242
{
4343
return parent::table($table)
4444
->modifyQueryUsing(fn ($query) => $query->with(['documentTypes', 'contents' => fn ($query) => $query->withoutGlobalScopes([SoftDeletingScope::class])]))
45+
->recordTitle(fn (Model | Template $record) => $record->slug)
4546
->headerActions([
4647
Tables\Actions\SelectAction::make('theme')
4748
->options(TemplateResourceHelper::getThemeSelectOptions())
@@ -83,6 +84,8 @@ public function table(Table $table): Table
8384
count($record->contents ?? []) <= 0;
8485
}),
8586
Tables\Actions\Action::make('viewUsage')
87+
->label(__('inspirecms::buttons.view_usage.label'))
88+
->modalHeading(fn (Tables\Actions\Action $action, $record) => __('inspirecms::buttons.view_usage.heading', ['name' => ($record ? $action->getRecordTitle($record) : null) ?? $this->getModelLabel()]))
8689
->modalSubmitAction(fn () => false) // Disable the form submission
8790
->color('gray')
8891
->icon(FilamentIcon::resolve('actions::view-action') ?? 'heroicon-m-eye')

src/Filament/Widgets/TemplateInfo.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public function infolist(Infolist $infolist): Infolist
8383
->columns(1)
8484
->schema([
8585
Infolists\Components\TextEntry::make('exported_content_template_directory')
86+
->label(__('inspirecms::inspirecms.exported_content_template_directory'))
8687
->fontFamily(FontFamily::Mono)
8788
->size('xs')
8889
->placeholder(fn () => strval(__('inspirecms::inspirecms.n/a')))
@@ -93,11 +94,12 @@ public function infolist(Infolist $infolist): Infolist
9394
public function exportContentTemplatesAction(): Action
9495
{
9596
return Action::make('exportContentTemplates')
97+
->label(__('inspirecms::buttons.export_content_templates.label'))
9698
->icon(FilamentIcon::resolve('inspirecms::export'))
9799
->modalIcon(FilamentIcon::resolve('inspirecms::export'))
98100
->color('gray')
99-
->successNotificationTitle(__('inspirecms::messages.success'))
100-
->failureNotificationTitle(__('inspirecms::messages.failure'))
101+
->successNotificationTitle(__('inspirecms::buttons.export_content_templates.messages.success.title'))
102+
->failureNotificationTitle(__('inspirecms::buttons.export_content_templates.messages.failure.title'))
101103
->action(function (Action $action) {
102104

103105
$templates = InspireCmsConfig::getTemplateModelClass()::all();

0 commit comments

Comments
 (0)