@@ -157,7 +157,7 @@ the `GetLabel` class and invoke it.
157157use Greg0ire\Enum\Bridge\Symfony\Translator\GetLabel;
158158
159159$label = new GetLabel();
160- $label($value, ' Your\Enum\Class' );
160+ $label(Your\Enum\Class::VALUE, Your\Enum\Class::class );
161161```
162162
163163To enable translation, require the ` symfony/translation ` component
@@ -169,26 +169,26 @@ use Greg0ire\Enum\Bridge\Symfony\Translator\GetLabel;
169169use Symfony\Contracts\Translation\TranslationInterface;
170170
171171$label = new GetLabel($translator);
172- $label($value, ' Your\Enum\Class' );
172+ $label(Your\Enum\Class::VALUE, Your\Enum\Class::class );
173173```
174174
175- If you're using Symfony, tag the service and simply inject it.
175+ If you're using Symfony, alias the service and simply inject it.
176176If translations are enabled, the ` TranslatorInterface ` will be automatically injected.
177177
178178``` yaml
179179services :
180180 # ...
181- Greg0ire\Enum\Bridge\Symfony\Translator\Label : " @greg0ire_enum.symfony.translator.label "
181+ Greg0ire\Enum\Bridge\Symfony\Translator\GetLabel : " @greg0ire_enum.symfony.translator.get_label "
182182` ` `
183183
184184` ` ` php
185185public function index(GetLabel $label)
186186{
187- $label($value, ' Your\Enum\Class' );
188- $label($value, ' Your\Enum\Class' , 'another_domain'); // Change the translation domain
189- $label($value, ' Your\Enum\Class' , false); // Disable translation. In this case the class prefix wont be added
190- $label($value, ' Your\Enum\Class' , false, true); // Disable translation but keep class prefix
191- $label($value, ' Your\Enum\Class' , false, true, '.'); // Disable translation but keep class prefix with a custom separator
187+ $label(Your\Enum\Class::VALUE, Your\Enum\Class::class );
188+ $label(Your\Enum\Class::VALUE, Your\Enum\Class::class , 'another_domain'); // Change the translation domain
189+ $label(Your\Enum\Class::VALUE, Your\Enum\Class::class , false); // Disable translation. In this case the class prefix wont be added
190+ $label(Your\Enum\Class::VALUE, Your\Enum\Class::class , false, true); // Disable translation but keep class prefix
191+ $label(Your\Enum\Class::VALUE, Your\Enum\Class::class , false, true, '.'); // Disable translation but keep class prefix with a custom separator
192192}
193193```
194194
0 commit comments