Introduction
Basic Concepts
Understanding Routing
Intercepting Requests
Module Fundamentals
Database Operations
Templates
Helpers
Form Handling
Form Validation
Working With Files
Image Manipulation
Working With Dates & Times
Language Control
Authorization & Authentication
Using the Language Module
The Language module is designed to be used via direct object access.
No need to load services or initialize objects.
Just call the method.
Example: Validation Module
Load language data like this:
$path = 'modules/validation/language/{lang}/validation_errors.php';
$validation_errors = $this->language->load($path);
That's it.
Using the Data
Once loaded, use the array as needed:
$message = $validation_errors['required_error'] ?? 'Fallback message';
Simple array access. No wrappers.
Fallback Behaviour
If the file does not exist:
- An empty array is returned
- Your code continues without interruption
This allows you to implement your own fallback logic if required.
Getting the Current Language
You can retrieve the current language at any time:
$lang = $this->language->get_language();
Decoupled by Design
- Module methods provide access
- Modules contain logic
- Your code remains clean and independent
No tight coupling. No enforced structure.