set_language()

public function set_language(string $lang): void

Description

Sets the language for validation error messages. Changes both the session/cookie language (via the Language module) and loads the corresponding validation language file.

This method affects all subsequent validation error messages displayed by validation_errors() or display_errors().

Parameters

Parameter Type Description
$lang string The language code (e.g., 'en', 'fr', 'es', 'de').

Return Value

Type Description
void This method does not return a value.

Example Usage

Notes

  • Calls $this->language->set_language($lang) to update session and cookie.
  • Calls $this->model->load_validation_language($lang) to load the appropriate error‑message file.
  • Language files are located at modules/validation/language/{lang}/validation_errors.php.
  • Use reset_language() to revert to the system default.