diff --git a/app/Console/Commands/stubs/controller.stub b/app/Console/Commands/stubs/controller.stub index a39e631e5427..d557b844278f 100755 --- a/app/Console/Commands/stubs/controller.stub +++ b/app/Console/Commands/stubs/controller.stub @@ -32,7 +32,7 @@ class $CLASS$ extends BaseController return view('list_wrapper', [ 'entityType' => '$LOWER_NAME$', 'datatable' => new $STUDLY_NAME$Datatable(), - 'title' => trans('texts.$LOWER_NAME$'), + 'title' => mtrans('$LOWER_NAME$', '$LOWER_NAME$_list'), ]); } @@ -57,7 +57,7 @@ class $CLASS$ extends BaseController '$LOWER_NAME$' => null, 'method' => 'POST', 'url' => '$LOWER_NAME$', - 'title' => trans('texts.new_$LOWER_NAME$'), + 'title' => mtrans('$LOWER_NAME$', 'new_$LOWER_NAME$'), ]; return view('$LOWER_NAME$::edit', $data); @@ -73,7 +73,7 @@ class $CLASS$ extends BaseController $$LOWER_NAME$ = $this->$LOWER_NAME$Repo->save($request->input()); return redirect()->to($$LOWER_NAME$->present()->editUrl) - ->with('message', trans('texts.created_$LOWER_NAME$')); + ->with('message', mtrans('$LOWER_NAME$', 'created_$LOWER_NAME$')); } /** @@ -88,7 +88,7 @@ class $CLASS$ extends BaseController '$LOWER_NAME$' => $$LOWER_NAME$, 'method' => 'PUT', 'url' => '$LOWER_NAME$/' . $$LOWER_NAME$->public_id, - 'title' => trans('texts.edit_$LOWER_NAME$'), + 'title' => mtrans('$LOWER_NAME$', 'edit_$LOWER_NAME$'), ]; return view('$LOWER_NAME$::edit', $data); @@ -113,7 +113,7 @@ class $CLASS$ extends BaseController $$LOWER_NAME$ = $this->$LOWER_NAME$Repo->save($request->input(), $request->entity()); return redirect()->to($$LOWER_NAME$->present()->editUrl) - ->with('message', trans('texts.updated_$LOWER_NAME$')); + ->with('message', mtrans('$LOWER_NAME$', 'updated_$LOWER_NAME$')); } /** @@ -126,6 +126,6 @@ class $CLASS$ extends BaseController $count = $this->$LOWER_NAME$Repo->bulk($ids, $action); return redirect()->to('$LOWER_NAME$') - ->with('message', trans('texts.' . $action . '_$LOWER_NAME$_complete')); + ->with('message', mtrans('$LOWER_NAME$', $action . '_$LOWER_NAME$_complete')); } } diff --git a/app/Console/Commands/stubs/datatable.stub b/app/Console/Commands/stubs/datatable.stub index 81496911598f..f88f4c21f7e6 100644 --- a/app/Console/Commands/stubs/datatable.stub +++ b/app/Console/Commands/stubs/datatable.stub @@ -29,7 +29,7 @@ class $CLASS$Datatable extends EntityDatatable { return [ [ - trans('texts.edit_$LOWER_NAME$'), + mtrans('$LOWER_NAME$', 'edit_$LOWER_NAME$'), function ($model) { return URL::to("$LOWER_NAME$/{$model->public_id}/edit"); }, diff --git a/app/Console/Commands/stubs/lang.stub b/app/Console/Commands/stubs/lang.stub index a31749e36762..def3fcf8d114 100644 --- a/app/Console/Commands/stubs/lang.stub +++ b/app/Console/Commands/stubs/lang.stub @@ -3,6 +3,15 @@ $LANG = array( '$LOWER_NAME$' => '$STUDLY_NAME$', + '$LOWER_NAME$_list' => '$STUDLY_NAME$ List', + 'archive_$LOWER_NAME$' => 'Archive $STUDLY_NAME$', + 'delete_$LOWER_NAME$' => 'Delete $STUDLY_NAME$', + 'edit_$LOWER_NAME$' => 'Edit $STUDLY_NAME$', + 'restore_$LOWER_NAME$' => 'Restore $STUDLY_NAME$', + 'new_$LOWER_NAME$' => 'New $STUDLY_NAME$', + 'created_$LOWER_NAME$' => 'Successfully created $LOWER_NAME$', + 'updated_$LOWER_NAME$' => 'Successfully updated $LOWER_NAME$', + ); return $LANG; diff --git a/app/Http/routes.php b/app/Http/routes.php index 86c6f54b785e..aaf79179398a 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -909,9 +909,13 @@ if (!defined('CONTACT_EMAIL')) { } } - // include modules in translations - function mtrans($entityType, $text) + // include modules in translations + function mtrans($entityType, $text = false) { + if ( ! $text) { + $text = $entityType; + } + if ( ! Utils::isNinjaProd() && $module = Module::find($entityType)) { return trans("{$module->getLowerName()}::texts.{$text}"); } else { diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index c0c3492a95d5..259ee3c171d1 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -108,7 +108,13 @@ class AppServiceProvider extends ServiceProvider if ($crumb == 'company') { return ''; } - $name = trans("texts.$crumb"); + + if ( ! Utils::isNinjaProd() && $module = \Module::find($crumb)) { + $name = mtrans($crumb); + } else { + $name = trans("texts.$crumb"); + } + if ($i==count($crumbs)-1) { $str .= "