reset_language()

public function reset_language(): void

Description

Resets the language setting to the system default. Removes the language from session and deletes the language cookie.

After calling this method, get_language() will return either the APP_LANG constant (if defined) or the hard‑coded default 'en'.

Parameters

This method accepts no parameters.

Return Value

Type Description
void This method does not return a value.

Example Usage

PHP
// Reset language to default
$this->language->reset_language();

// Reset and redirect to home page
public function logout() {
    $this->language->reset_language();
    redirect('welcome');
}

// Conditional reset based on user action
if (post('reset_lang') === 'true') {
    $this->language->reset_language();
    set_flashdata('Language reset to default.');
    redirect('settings');
}

Notes

  • Clears $_SESSION['app_lang'] if set.
  • Deletes the app_lang cookie by setting its expiration to a past time.
  • Does not affect the APP_LANG constant – that remains as a fallback.