I would extend the core class CI_Lang
with my own.
class MY_Lang extends CI_Lang {
var $defaultLanguage = array();
function __construct()
{
parent::__construct();
}
function line($line = '')
{
// Get the value from the current language.
$value = parent::line($line);
// Fallback on default language if not found.
if ($value === FALSE) {
$value = $this->defaultLanguage[$line];
}
return $value;
}
function loadDefault($langfile = '', $idiom = '') {
$this->defaultLanguage = array_merge($this->defaultLanguage, (array)$this->load($langfile, $idiom, TRUE));
}
}
Then load the default language files I want in my controller.
$this->lang->load('error', 'french'); // Standard way
$this->lang->loadDefault('error', 'english'); // New way for defaults
That way, if you query for something that is not in the french translation, it will default to the english one.