In my current project, I use the Silex framework with template engine TWIG. I have to internationalize my site. For this I imported the required module :
$app->register(new Silex\Provider\TranslationServiceProvider(), array(
'locale_fallbacks' => array('fr'),
));
I created my YAML files in a folder 'translation':
use Symfony\Component\Translation\Loader\YamlFileLoader;
$app['translator'] = $app->share($app->extend('translator', function($translator, $app) {
$translator->addLoader('yaml', new YamlFileLoader());
$translator->addResource('yaml', __DIR__.'/translation/en.yml', 'en');
$translator->addResource('yaml', __DIR__.'/translation/fr.yml', 'fr');
return $translator;
}));
Now I know I should use 'gettext' to extract strings of my TWIG templates in a '.po' file, but I can't find how.
Some people talk about "Twig Gettext Extractor" but I don't think Silex supports this module.
Thanks for your help !