E.g. I will load the languages like (btw. I think only the first of these two, English will be loaded other ignored):
$this->lang->load('module_messages', 'english');
$this->lang->load('module_messages', 'czech');
But I can use only something like this:
echo $this->lang->line('language_key');
THis is not working:
echo $this->lang->line('language_key', 'english');
Any idea how to echo both language translations at the same time in the same view like:
echo $this->lang->line('language_key', 'english');
echo $this->lang->line('language_key', 'czech');
How to achieve such thing?
Unfortunately there is currently no way to do such a thing as the keys are loaded for one language file. It's just not typical to load multiple files.
However, there is a way around it and that is to use a prefix like so:
$this->lang->load('en_module_messages', 'english');
$this->lang->load('cs_module_messages', 'czech');
echo $this->lang->line('en_language_key');
echo $this->lang->line('cs_language_key');
If you name the language files and keys the same they will course conflict. So we add an ISO language prefix to the language files and to the line keys. So that both languages are kept separated allowing you to use them both at the same time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With