How to work with I18N in PHP and Symfony?

0

Is there an add-on for Symfony that allows working with i18n and .po and .mo files, or is it really necessary to implement a solution for this? Ideally, I could call the translation in both the twig and the Controller. If there is any or what the options are?

    
asked by anonymous 30.07.2014 / 23:09

1 answer

1

Symfony itself has a component for internationalization, and XML or YAML files are used for this. You can still read the translation of a database. Take a look at their documentation regarding:

link

You can use internationalization in both PHP and template files (using Twig). In the first case, after calling the service internationalization service container, just translate this:

$translator->trans('Hi!');

As with Twig, just use the trans filter:

{{ "Hi!"|trans }}
    
07.08.2014 / 17:54