コード例 #1
0
ファイル: helpers.php プロジェクト: cichowski/spine
 /**
  * Translate the given message in it's own scope.
  * It is needed for the package itself.
  *
  * @param  string  $id
  * @param  array   $parameters
  * @param  string  $domain
  * @param  string  $locale
  * @return string
  */
 function transpine($id = null, $parameters = [], $domain = 'messages', $locale = null)
 {
     if (is_null($id)) {
         return app('translator');
     }
     return app('translator')->trans(spine_config('spine.namespace') . '::' . $id, $parameters, $domain, $locale);
 }
コード例 #2
0
 /**
  * Bootstrap the application services.
  *
  * @return void
  */
 public function boot()
 {
     $this->loadTranslationsFrom(__DIR__ . '/lang', spine_config('spine.namespace'));
     $this->publishes([__DIR__ . '/config/spine.php' => config_path('cichowski.spine.php')], 'config');
     $this->publishes([__DIR__ . '/publishes/Http/Controllers' => base_path('app/Http/Controllers')], 'controller');
     $this->publishes([__DIR__ . '/publishes/Http/Requests' => base_path('app/Http/Requests')], 'request');
     $this->publishes([__DIR__ . '/publishes/Library' => base_path('app/Library')], 'library');
     $this->publishes([__DIR__ . '/publishes/Models' => base_path('app/Models')], 'model');
 }
コード例 #3
0
ファイル: htmlMacros.php プロジェクト: cichowski/spine
            $setClass = array_key_exists('class', $attributes) ? $attributes['class'] . ' ' : '';
            $attributes['class'] = $setClass . $activeClassName;
        }
    }
    return link_to_route($route, $title, $parameters, $attributes);
});
/**
 * Generate menu element with localized label
 * 
 * @param   string  $elementName
 * @param   array   $parameters
 * @param   array   $attributes* 
 * @return  string
 */
Html::macro('link_menu_translated', function ($elementName, array $parameters = array(), array $attributes = array()) {
    $label = trans(spine_config('spine.link_menu.lang_filename', 'menu') . '.' . $elementName);
    return Html::link_menu($elementName, $label, $parameters, $attributes);
});
/**
 * Get yes|no localized string based on boolean representation of given value
 * 
 * @param   bool $value
 * @return  string
 */
Html::macro('print_bool', function ($value) {
    return (bool) $value ? transpine('helpers.yes') : transpine('helpers.no');
});
/**
 * Get html for iconic (visual) version of boolean value
 * 
 * @param   bool    $value