diff --git a/ci4/app/Config/Routes.php b/ci4/app/Config/Routes.php index 6c4d93ea..46de2b2a 100644 --- a/ci4/app/Config/Routes.php +++ b/ci4/app/Config/Routes.php @@ -776,6 +776,15 @@ $routes->group('api', ['filter' => 'jwt'], static function ($routes) { // ... }); +/* + * -------------------------------------------------------------------- + * Translation + * -------------------------------------------------------------------- + */ +$routes->group('translate', ['namespace' => 'App\Controllers'], function ($routes) { + $routes->post('getTranslation', 'Language::getTranslation', ['as' => 'getKeys']); +}); +$routes->resource('translate', ['namespace' => 'App\Controllers', 'controller' => 'Language', 'except' => '']); /* diff --git a/ci4/app/Controllers/Language.php b/ci4/app/Controllers/Language.php index cd2b062e..437f18eb 100755 --- a/ci4/app/Controllers/Language.php +++ b/ci4/app/Controllers/Language.php @@ -15,4 +15,15 @@ class Language extends BaseController $url = previous_url(); return redirect()->to($url); } + + + // Function to get the translation of the language file from a AJAX request + public function getTranslation() + { + $translationFile = $this->request->getPost('translationFile'); + $locale = $this->request->getPost('locale'); + $path = "Language/{$locale}/$translationFile.php"; + $lang = require APPPATH.$path; + return json_encode($lang); + } } diff --git a/ci4/app/Language/en/Presupuestos.php b/ci4/app/Language/en/Presupuestos.php index 4d514cfa..cce0c828 100755 --- a/ci4/app/Language/en/Presupuestos.php +++ b/ci4/app/Language/en/Presupuestos.php @@ -31,12 +31,12 @@ return [ 'presupuestoEstadoAceptado' => 'Acepted', 'incidencia' => 'Incident', 'reimpresion' => 'Reprint', - 'reimpresion' => 'Free of charge', 'autor' => 'Author', 'coleccion' => 'Collection', 'numeroEdicion' => 'Edition number', 'isbn' => 'ISBN', 'referenciaCliente' => 'Customer reference', + 'formatoLibro' => "Book format", 'papelFormatoId' => "Size", 'papelFormatoPersonalizado' => 'Custom size', 'papelFormatoAncho' => 'Width', diff --git a/ci4/app/Language/es/Presupuestos.php b/ci4/app/Language/es/Presupuestos.php index d14be329..bb163449 100755 --- a/ci4/app/Language/es/Presupuestos.php +++ b/ci4/app/Language/es/Presupuestos.php @@ -63,6 +63,7 @@ return [ 'isbn' => 'ISBN', 'referenciaCliente' => 'Referencia del cliente', 'referenciaCliente2' => 'Referencia', + 'formatoLibro' => "Formato libro", 'papelFormatoId' => "Tamaño", 'papelFormatoPersonalizado' => 'Tamaño personalizado', 'papelFormatoAncho' => 'Ancho', diff --git a/ci4/app/Views/themes/vuexy/main/defaultlayout.php b/ci4/app/Views/themes/vuexy/main/defaultlayout.php index cb651dea..12cef7af 100644 --- a/ci4/app/Views/themes/vuexy/main/defaultlayout.php +++ b/ci4/app/Views/themes/vuexy/main/defaultlayout.php @@ -20,6 +20,8 @@ $picture = "/assets/img/default-user.png"; name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" /> + "> +