Skip to content

Translate a value

BowlOfSoup edited this page Sep 17, 2020 · 2 revisions

Use statement and alias

Add this use statement to the top of your class.

BowlOfSoup\NormalizerBundle\Annotation as Bos;

Add the annotation to your property/method

You have to combine the Translate annotation with a Normalize annotation.

/**
 * @Bos\Normalize(group={"somegroup"}, name="automobile")
 * @Bos\Translate(group={"translation"})
 */
private $propertyToBeNormalized

The translation needs to be present in Resources/translations/messages.en.xliff.

Annotation options

See Translate Annotations for custom options, like locale (language).

Clone this wiki locally