public function register()
{
$this->app['config']->package('anahkiasen/polyglot', __DIR__ . '/config');
// Bind services
$this->app->singleton('polyglot.translator', 'Polyglot\\Services\\Lang');
$this->app->singleton('polyglot.router', function ($app) {
return new Router($app['events'], $app);
});
$this->app->singleton('polyglot.url', function ($app) {
$routes = $app['polyglot.router']->getRoutes();
return new UrlGenerator($routes, $app->rebinding('request', function ($app, $request) {
$app['url']->setRequest($request);
}));
});
// Bind extractors and compilers
$this->app->bind('polyglot.compiler', 'Polyglot\\Localization\\Services\\Compiler');
$this->app->bind('polyglot.extractor', 'Polyglot\\Localization\\Services\\Extractor');
$this->app->bind('polyglot.extract', 'Polyglot\\Localization\\Commands\\ExtractTranslations');
$this->app->bind('polyglot.compile', 'Polyglot\\Localization\\Commands\\CompileTranslations');
$this->commands(['polyglot.extract', 'polyglot.compile']);
}