Lang file from other advanced module
Hi,
I've got two advanced modules: "Blog" and "Assassments"
How to get translations from Assassments module lang file inside Blog module views?
Implementing $this->load->module_language('assassments', 'assassments');
in Blog controller doesn't work
Comments
A couple questions:
Also, advanced modules will automatically load language files so you shouldn't need to call the
$this->load->module_language(...)
.I'm using
echo lang('reference_to_lang_file_in_english_language_folder')
what works fine. But if I want to uselang('reference_to_lang_file_in_english_language_folder_from_other_module')
I should import or load a language translations file, but I don't know how./fuel/modules/blog/language/english/blog_lang.php
Assassments module:
fuel/modules/assessments/language/english/assessments_lang.php
That looks correct to me. I'm having trouble replicating the issue locally. In the
Fuel_advanced_module.php
file line84
is where the language files are getting loaded. I would start by debugging that line and probably line1219
in that file of theload_language()
method.You are absolutely right. In the main fuel application and in the other module views calling
lang('reference_to_any_module_lang_file')
works like a charm.The Blog module is the exception. In the views of Blog module calling
lang('reference_to_blog_module_lang_file')
works fine, butlang('reference_to_other_module_lang_file')
doesn't work.I don't think I changed anything that might happen such behavior.
F.ex. in my site the blog's Posts are available as the main page and with URL as "/news", not the "/blog".
I think I see your issue. Advanced modules are by default lazy loaded. That means that the don't get initialized until they are needed. Calling the following before the
lang(...)
will initialize the advanced module and thus load your language file:Works! Thank you