Lang file from other advanced module

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


  • A couple questions:

    1. How are you referencing it in your view file?
    2. What is the path to the lang file?

    Also, advanced modules will automatically load language files so you shouldn't need to call the $this->load->module_language(...).

  • edited October 2020
    1. I'm not sure if I understand your quesiton.
      I'm using echo lang('reference_to_lang_file_in_english_language_folder') what works fine. But if I want to use lang('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.
    2. Blog module: /fuel/modules/blog/language/english/blog_lang.php
      Assassments module: fuel/modules/assessments/language/english/assessments_lang.php
  • edited October 2020

    That looks correct to me. I'm having trouble replicating the issue locally. In the Fuel_advanced_module.php file line 84 is where the language files are getting loaded. I would start by debugging that line and probably line 1219 in that file of the load_language() method.

  • edited October 2020

    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, but lang('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:

    echo lang('reference_to_assessments_module_lang_file');
  • Works! Thank you :)

Sign In or Register to comment.