diff --git a/resources/lang/ar.json b/resources/lang/ar.json new file mode 100644 index 0000000..cfb6232 --- /dev/null +++ b/resources/lang/ar.json @@ -0,0 +1,4 @@ +{ + "Email Templates": "قوالب البريد الإلكتروني", + "Email Template Themes": "ثيمات قالب البريد الإلكتروني" +} diff --git a/src/EmailTemplatesServiceProvider.php b/src/EmailTemplatesServiceProvider.php index 7b3d22b..5792630 100644 --- a/src/EmailTemplatesServiceProvider.php +++ b/src/EmailTemplatesServiceProvider.php @@ -21,6 +21,7 @@ public function configurePackage(Package $package): void ->hasMigrations(['create_email_templates_themes_table','create_email_templates_table']) ->hasConfigFile(['filament-email-templates', 'filament-tiptap-editor']) ->hasAssets() + ->hasTranslations() ->hasViews('vb-email-templates') ->runsMigrations() ->hasCommands([ @@ -32,6 +33,9 @@ public function packageRegistered(): void { parent::packageRegistered(); + $this->loadJsonTranslationsFrom(__DIR__.'/../resources/lang/'); + + $this->app->singleton(CreateMailableInterface::class, CreateMailableHelper::class); $this->app->singleton(FormHelperInterface::class, FormHelper::class); $this->app->register(EmailTemplatesEventServiceProvider::class); diff --git a/src/Resources/EmailTemplateResource.php b/src/Resources/EmailTemplateResource.php index d541a4b..78cbe51 100644 --- a/src/Resources/EmailTemplateResource.php +++ b/src/Resources/EmailTemplateResource.php @@ -51,12 +51,12 @@ public static function getNavigationSort(): ?int public static function getModelLabel(): string { - return config('filament-email-templates.navigation.templates.label'); + return __(config('filament-email-templates.navigation.templates.label')); } public static function getPluralModelLabel(): string { - return config('filament-email-templates.navigation.templates.label'); + return __(config('filament-email-templates.navigation.templates.label')); } public static function getCluster(): string @@ -94,10 +94,9 @@ public static function form(Form $form): Form Grid::make(['default' => 1, 'sm' => 1, 'md' => 2]) ->schema( [ - TextInput::make('key') - ->afterStateUpdated( - fn (Set $set, ?string $state) => $set('key', Str::slug($state)) - ) + Select::make('key') + ->options(config('filament-email-templates.template_keys')) + ->searchable() ->label(__('vb-email-templates::email-templates.form-fields-labels.key')) ->hint(__('vb-email-templates::email-templates.form-fields-labels.key-hint')) ->required() diff --git a/src/Resources/EmailTemplateThemeResource.php b/src/Resources/EmailTemplateThemeResource.php index e311042..76c71d8 100644 --- a/src/Resources/EmailTemplateThemeResource.php +++ b/src/Resources/EmailTemplateThemeResource.php @@ -36,12 +36,12 @@ public static function getNavigationSort(): ?int public static function getModelLabel(): string { - return config('filament-email-templates.navigation.themes.label'); + return __(config('filament-email-templates.navigation.themes.label')); } public static function getPluralModelLabel(): string { - return config('filament-email-templates.navigation.themes.label'); + return __(config('filament-email-templates.navigation.themes.label')); } public static function getCluster(): string