public function boot()
 {
     if (!file_exists(resource_path('i18n'))) {
         mkdir(resource_path('i18n'), 0755);
     }
     I18n::$dir = resource_path('i18n');
     I18n::$locale = env('I18N');
     \Blade::directive('lang', function ($expression) {
         return "<?php echo __{$expression}; ?>";
     });
 }
Example #2
0
 /**
  * @param string $string      Text to be translated
  * @param string $text_domain Text domain
  * @param array  $vars        Associative array of vars to inject
  *
  * @return string Translated text
  */
 function __($string, $text_domain = 'default', $vars = [])
 {
     return I18n::translate($string, $text_domain, $vars);
 }