public function boot()
 {
     $this->package('nicolasbeauvais/lari18n');
     include __DIR__ . '/../../routes.php';
     $this->app->bindShared('translator', function ($app) {
         // Instantiate Translator
         $loader = $app['translation.loader'];
         $locale = $app['config']['app.locale'];
         $trans = new Translator($loader, $locale, $this->app['lari18n']);
         $trans->setFallback($app['config']['app.fallback_locale']);
         return $trans;
     });
     Lari18n::getInstance()->setTranslator($this->app['translator']);
     // Provide commands
     $this->app->bind('lari18n::command.new.translation', function ($app) {
         return new NewTranslation();
     });
     $this->app->bind('lari18n::command.update.translation', function ($app) {
         return new UpdateTranslation();
     });
     $this->commands(array('lari18n::command.new.translation', 'lari18n::command.update.translation'));
     parent::boot();
 }
Exemplo n.º 2
0
 /**
  * Put the new choice type translation value in the corresponding localisation file.
  *
  * @param $fallback_locale
  * @param $locale
  * @param $key
  * @param $value
  * @param $number
  * @param $replace
  *
  * @return string
  */
 public function translateChoice($fallback_locale, $locale, $key, $value, $number, $replace)
 {
     $this->translate($fallback_locale, $locale, $key, $value);
     $replace = $replace ?: [];
     echo $this->translator->choice($key, $number, $replace, $locale, false);
 }