This repository has been archived by the owner on Jan 1, 2018. It is now read-only.
bitExpert/silex-twig-translation
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
README ====== What is Silex Twig Translation Extension? ---------------- The Silex Twig Translation Extension as the name implies is an extension for the Twig templating engine allowing to use Symfony/Translation within the Twig templates of an Silex powered application. Requirements ---------------- You will need a working Silex + Symfony/Translation + Twig application. Setup Symfony/Translation provider: $app->register(new Silex\Provider\TranslationServiceProvider(), array( 'locale_fallback' => 'en', 'translation.class_path' => 'vendor/symfony/src', )); $app['translator.messages'] = array( 'en' => 'locales/en.yml', 'de' => 'locales/de.yml' ); $app['translator.loader'] = new Symfony\Component\Translation\Loader\YamlFileLoader(); Setup Twig: $app->register(new Silex\Provider\TwigServiceProvider(), array( 'twig.path' => __DIR__.'/views', 'twig.class_path' => __DIR__.'/vendor/twig/lib' ) )); Register silex-twig-extension: $app['twig']->addExtension(new bitExpert_Silex_Twig_Translation_Extension()); How to use? ---------------- Example: {% translate my_translation_key %} Will pass my_translation_key to Symfony/Translation and render the result within the twig template.
About
[DEPRECATED] Silex / Twig extension to deal with Symfony/Translation in templates.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published