File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22/**
33 * Copyright 2025 (C) IDMarinas - All Rights Reserved
44 *
5- * Last modified by "IDMarinas" on 31/03 /2025, 17:17
5+ * Last modified by "IDMarinas" on 14/04 /2025, 21:22
66 *
77 * @project IDMarinas Settings Bundle
88 * @see https://github.com/idmarinas/settings-bundle
2020namespace Idm \Bundle \Settings \Enums ;
2121
2222use Idm \Bundle \Common \Traits \Enums \EnumToArrayTrait ;
23- use Idm \Bundle \User \Enums \TranslatableChoicesEnumTrait ;
23+ use Symfony \Contracts \Translation \TranslatableInterface ;
24+ use Symfony \Contracts \Translation \TranslatorInterface ;
2425
25- enum SettingsEnum: string
26+ enum SettingsEnum: string implements TranslatableInterface
2627{
2728 use EnumToArrayTrait;
28- use TranslatableChoicesEnumTrait;
2929
3030 case STRING = 'string ' ;
3131 case BOOL = 'bool ' ;
@@ -41,4 +41,11 @@ public function format (mixed $value): float|bool|int|string
4141 default => (string )$ value , // Default is string
4242 };
4343 }
44+
45+ public function trans (TranslatorInterface $ translator , ?string $ locale = null ): string
46+ {
47+ $ key = 'enum.setting.type. ' . strtolower ($ this ->name );
48+
49+ return $ translator ->trans ($ key , domain: 'IdmSettingsBundle ' , locale: $ locale );
50+ }
4451}
You can’t perform that action at this time.
0 commit comments