añadido coger el idioma

This commit is contained in:
2024-09-30 11:06:00 +02:00
parent f09d5aeceb
commit 13e3a69cd6
7 changed files with 43 additions and 3 deletions

View File

@ -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);
}
}