diff --git a/app/Http/Controllers/LanguageController.php b/app/Http/Controllers/LanguageController.php new file mode 100644 index 00000000..46ace41f --- /dev/null +++ b/app/Http/Controllers/LanguageController.php @@ -0,0 +1,20 @@ +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..187668f5 --- /dev/null +++ b/resources/lang/en/messages.php @@ -0,0 +1,140 @@ + [ + //navbarMenu + 'dashboard' => 'Dashboard', + + '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.' + ], + ], + + //alterar na view Portfolio + 'portfolio' => [ + 'top_view_part' => [ + 'management_assets' => 'Management assets', + 'portfolio' => 'portfolio', + 'managing_assets' => 'Managing Assets', + ], + 'change_buttons' => [ + 'create_assets' => 'Create assets', + 'asset_table' => 'Asset table', + ], + 'asset_table' => [ + ''=> '', + ], + 'users_table' => [ + 'id' => 'ID', + 'name' => 'Name', + 'email' => 'Email', + 'user_type' => 'User type', + 'actions' => [ + 'actions' => 'Actions', + 'details' => 'Details', + 'edit'=> 'Edit', + 'delete' => 'Delete' + ], + ], + ], + + 'users_listUsers' => [ + //Navbar + 'users' => 'Users', + 'companies' => 'Companies', + 'create_users' => 'Create users', + + 'top_view_part' => [ + 'companies' => 'Companies', + 'administration' => 'Administration', + 'users_table' => 'Users table', + 'companies_table' => 'Companies Table', + ], + ], + + // View : Create Users + 'pendingUsers' => [ + 'create_users' => 'Create Users', + 'administration' => 'Administration', + 'submit_form' => 'Submit Form', + 'pending_users' => 'Pending Users', + 'submit' => 'Submit', + 'table_pending_user' => [ + 'name' => 'Name', + 'email' => 'Email', + 'verify' => 'Verify' + ], + ], + + // View : createProject + 'createProject' => [ + //NavbarMenu + "create_project"=> "Create a project", + + 'project_work_details' => 'Project Work Details', + 'project_identification' => 'Project identification', + 'ispt_project_number' => 'ISPT Project Number', + 'ispt_project_manager' => 'ISPT Project Manager', + 'compan_project_manager' => 'Company Project Manager', + //Selecionar uma empresa. + 'select_company' => [ + 'contracting_company' => 'Contracting Company', + 'select_company' => 'Select a contracting Company', + ], + //Selecionar ou criar uma instalacao + 'select_plant' => [ + 'plant' => 'Select Plant', + 'create_new_plant' => 'Create a new plant', + 'new_plant' => 'New plant', + 'plant_address' => 'Plant address', + 'select_plant' => 'Select Plant', + ], + 'company_project_number' => 'Company Project Number', + 'project_start_date' => 'Project Start Date', + ], + + + 'profile' => [ + 'show_profile' => [ + 'profile' => 'Profile', + 'full_name' => 'Full Name', + 'nif' => 'Nif', + 'email_address' => 'Email address', + 'user_type' => 'User type', + 'mobile_phone' => 'Mobile phone', + 'account_creation_date' => 'account_creation_date' + ], + 'edit_profile' => [ + 'edit_profile'=> 'Edit profile', + 'update_your_logo' => 'Update your logo', + 'image' => 'Image', + 'full_name'=> 'Full name', + 'nif' => 'Nif', + 'email_address' => 'Email address', + 'mobile_phone' => 'mobile_phone', + ], + ], + + //Botoes gerais ISPT4.0 + 'buttons' => [ + 'save' => 'save', + ], + + '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..9e2937b0 --- /dev/null +++ b/resources/lang/pt/messages.php @@ -0,0 +1,136 @@ + [ + //navbarMenu + 'dashboard' => 'Dashboard', + + '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.' + ], + + ], + + 'portfolio' => [ + 'top_view_part' => [ + 'management_assets' => 'Gestão de ativos', + 'portfolio' => 'Portefólio', + 'managing_assets' => 'Gerir ativos', + ], + 'change_buttons' => [ + 'create_assets' => 'Criar ativos', + 'asset_table' => 'Tabela de ativos', + ], + 'users_table' => [ + 'id' => 'ID', + 'name' => 'Nome', + 'email' => 'Email', + 'user_type' => 'Tipo de Utilizador', + 'actions' => [ + 'actions' => 'Ações', + 'details' => 'Detalhes', + 'edit' => 'Editar', + 'delete' => 'Excluir' + ], + + ], + ], + + 'users_listUsers' => [ + //Navbar + 'users' => 'Utilizadores', + 'companies' => 'Clientes', + 'create_users' => 'Criar Utilizadores', + + 'top_view_part' => [ + 'companies' => 'Empresas', + 'administration' => 'Administração', + 'users_table' => 'Tabela Utilizadores', + 'companies_table' => 'Tabela Empresas', + ], + ], + + // View : Create Users + 'pendingUsers' => [ + 'create_users' => 'Criar Utilizadores', + 'administration' => 'Administração', + 'submit_form' => 'Enviar Formulário', + 'pending_users' => 'Utilizadores Pendentes', + 'submit' => 'Enviar', + 'table_pending_user' => [ + 'name' => 'Nome', + 'email' => 'Email', + 'verify' => 'Verificar' + ], + ], + + // View : createProject + 'createProject' => [ + //NavbarMenu + "create_project" => "Criar obra", + + 'project_work_details' => 'Detalhes Técnicos do Projeto', + 'project_identification' => 'Identificação do projecto', + 'ispt_project_number' => 'Número do Projeto ISPT', + 'ispt_project_manager' => 'Gestor de Projeto ISPT', + 'compan_project_manager' => 'Gestor de Projeto da Empresa', + //Selecionar uma empresa. + 'select_company' => [ + 'contracting_company' => 'Empresa Contratante', + 'select_company' => 'Selecionar uma Empresa', + ], + //Selecionar ou criar uma instalacao + 'select_plant' => [ + 'plant' => 'Instalação', + 'create_new_plant' => 'Criar uma nova Instalacao', + 'new_plant' => 'Nova Instalação', + 'plant_address' => 'Morada Instalação', + 'select_plant' => 'Selecione uma Instalação', + ], + 'company_project_number' => 'Número do Projeto da Empresa', + 'project_start_date' => 'Data de Início do Projeto', + ], + + //view: usersProfiles + 'profile' => [ + 'show_profile' => [ + 'profile' => 'Perfil', + 'full_name' => 'Nome e Apelido', + 'nif' => 'Nif', + 'email_address' => 'Email', + 'user_type' => 'Tipo de utilizador', + 'mobile_phone' => 'Telemóvel', + 'account_creation_date' => 'Conta Criada em' + ], + 'edit_profile' => [ + 'update_your_logo' => 'Actualizar o seu logótipo', + 'image' => 'Imagem', + 'full_name'=> 'Nome e Apelido', + 'nif' => 'Nif', + 'email_address' => 'Email', + 'mobile_phone' => 'Telemóvel', + ], + ], + + 'buttons' => [ + 'save' => 'Guardar', + ], + + 'welcome' => 'Bem-vindo à nossa aplicação!', + // outras traduções +]; \ No newline at end of file diff --git a/resources/views/Templates/templateAdmin.blade.php b/resources/views/Templates/templateAdmin.blade.php index 9566d220..a3ddc43d 100755 --- a/resources/views/Templates/templateAdmin.blade.php +++ b/resources/views/Templates/templateAdmin.blade.php @@ -210,8 +210,18 @@ class="fas fa-bars"> + + +