diff --git a/app/Http/Controllers/LanguageController.php b/app/Http/Controllers/LanguageController.php new file mode 100644 index 00000000..acae3ed8 --- /dev/null +++ b/app/Http/Controllers/LanguageController.php @@ -0,0 +1,21 @@ +input('locale'); + + if (!in_array($locale, ['en', 'pt'])) { + abort(400); + } + + session(['locale' => $locale]); + return redirect()->back(); + } +} diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index a237b67b..a3524b19 100755 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -36,6 +36,7 @@ class Kernel extends HttpKernel \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, + \App\Http\Middleware\Language::class, ], 'api' => [ diff --git a/app/Http/Middleware/Language.php b/app/Http/Middleware/Language.php new file mode 100644 index 00000000..4906e51a --- /dev/null +++ b/app/Http/Middleware/Language.php @@ -0,0 +1,25 @@ +setLocale(session('locale')); + } + + return $next($request); + } +} diff --git a/config/app.php b/config/app.php index 1bbd47cc..0f3e510b 100755 --- a/config/app.php +++ b/config/app.php @@ -83,9 +83,7 @@ | */ - // 'locale' => 'en', - 'locale' => 'pt', - + 'locale' => 'en', /* |-------------------------------------------------------------------------- diff --git a/resources/lang/en/messages.php b/resources/lang/en/messages.php new file mode 100644 index 00000000..9f1f0cef --- /dev/null +++ b/resources/lang/en/messages.php @@ -0,0 +1,28 @@ + [ + 'planning' => [ + 'description' => 'In planning', + 'text' => 'In planning for 2023' + ], + 'prepared' => [ + 'description' => 'Prepared', + 'text' => 'Waiting for the work to start.' + ], + 'on_going' => [ + 'description' => 'On going', + 'text' => 'Work in progress.' + ], + 'finished' => [ + 'description' => 'Finished.', + 'text' => 'Last projects 2023.' + ], + + ], + + 'welcome' => 'Welcome to our application!', +]; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php new file mode 100644 index 00000000..e69de29b diff --git a/resources/lang/pt/messages.php b/resources/lang/pt/messages.php new file mode 100644 index 00000000..c3be677a --- /dev/null +++ b/resources/lang/pt/messages.php @@ -0,0 +1,29 @@ + [ + 'planning' => [ + 'description' => 'Em planeamento', + 'text' => 'Em planeamento de 2023' + ], + 'prepared' => [ + 'description' => 'Preparadas', + 'text' => 'Aguarda o início da obra.' + ], + 'on_going' => [ + 'description' => 'Em execução', + 'text' => 'Obra em curso.' + ], + 'finished' => [ + 'description' => 'Concluídas', + 'text' => 'Últimas obras de 2023.' + ], + + ], + + + 'welcome' => 'Bem-vindo à nossa aplicação!', + // outras traduções +]; \ No newline at end of file diff --git a/resources/views/Admin/index.blade.php b/resources/views/Admin/index.blade.php index aa5eab8b..126859b0 100755 --- a/resources/views/Admin/index.blade.php +++ b/resources/views/Admin/index.blade.php @@ -32,11 +32,11 @@
- Em planeamento + {{__('messages.dashboard.planning.description')}} {{ $CompanyProject->where('order_project', 1)->count() }} - Em planeamento de 2023 + {{__('messages.dashboard.planning.text')}}
@@ -71,12 +71,13 @@ class="btn btn-tool">
- Preparadas + {{__('messages.dashboard.prepared.description')}} {{ $CompanyProject->where('order_project', 2)->count() }} - Aguardam o início da obra. + {{__('messages.dashboard.prepared.text')}} +
@@ -111,11 +112,11 @@ class="btn btn-tool">
- Em execução + {{__('messages.dashboard.on_going.description')}} {{ $CompanyProject->where('order_project', 3)->count() }} - Obras em curso. + {{__('messages.dashboard.on_going.text')}}
@@ -150,11 +151,11 @@ class="btn btn-tool">
- Concluídas + {{__('messages.dashboard.finished.description')}} {{ $CompanyProject->where('order_project', 4)->count() }} - Últimas obras de 2023 + {{__('messages.dashboard.finished.text')}}
diff --git a/resources/views/Templates/templateAdmin.blade.php b/resources/views/Templates/templateAdmin.blade.php index 9566d220..9cba2bde 100755 --- a/resources/views/Templates/templateAdmin.blade.php +++ b/resources/views/Templates/templateAdmin.blade.php @@ -210,6 +210,14 @@ class="fas fa-bars"> +
+ @csrf + +
+
+ + + {{--

{{ __('messages.welcome') }}

--}} +
@csrf @@ -43,15 +47,15 @@
- {{-- --}}
- +
diff --git a/resources/views/projectsClients/articulated_2.blade.php b/resources/views/projectsClients/articulated_2.blade.php index b58182f9..e19b4c0d 100755 --- a/resources/views/projectsClients/articulated_2.blade.php +++ b/resources/views/projectsClients/articulated_2.blade.php @@ -1221,7 +1221,8 @@ class="btn btn-info">Baixar Template {{-- ./table-responsive --}} @foreach ($listEquipmentsProjects as $listEquipmentsProject) -