trans()

trans()

Twig Function

The trans() or __() function is the preferred way to translate strings in your theme, using the applications localization configuration. The localization strings can be loaded by passing the default translation of your string.

___TWIG0___

The trans() function is interchangable with the __() function.

___TWIG0___

Replacing parameters in translation strings is possible by passing an array as the second argument. Every parameter is prefixed with a : character.

___TWIG0___

# Pluralization

The trans_choice() function is used to process pluralized values, where the second argument determines the count.

___TWIG0___

The third argument can contain the parameters.

___TWIG0___

# Filter Syntax

The |trans, |_ and |__ filters are also available as an alternative to the function syntax, where |trans and |_ translate a string and |__ processes pluralized values.

___TWIG0___

___TWIG1___

___TWIG2___

# See Also