Last active
August 29, 2015 14:24
-
-
Save rossriley/c74fdee4fec3eaffb12f to your computer and use it in GitHub Desktop.
Add local resources to Bolt translations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace MySite\Bolt\Provider; | |
| use Silex\ServiceProviderInterface; | |
| use Silex\Application; | |
| use Symfony\Component\Translation\Loader\YamlFileLoader; | |
| /** | |
| * | |
| */ | |
| class Translations implements ServiceProviderInterface | |
| { | |
| public function register(Application $app) | |
| { | |
| } | |
| public function boot(Application $app) | |
| { | |
| $app['translator'] = $app->share( | |
| $app->extend( | |
| 'translator', | |
| function ($translator, $app) { | |
| $translator->addLoader('yaml', new YamlFileLoader()); | |
| $path = $app['resources']->getPath('root/app/resources/translations/fr_FR'); | |
| $translator->addResource('yaml', $path.'/messages.yml', 'fr_FR'); | |
| return $translator; | |
| } | |
| ) | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment