Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Auto load lang files from a module
  • Hi guys,

    I use a module in my project, and i have a specific lang file for this module.

    How should I wrote in the config.php of the project in the section 'always_load' -> 'languages', in order to always load this lang file.

    I've tried like this in config.php :

    ....
    ....
    'always_load' => array(
       ....
       ....
       'language' => array(

              'lang'      //this one is the lang file of the main project

             'events::main' => 'events',       //this is the one i want to load from my 'events' module
       ),
    ),

    Is it possible, or i have to manually load the module, where I need to use the language.....Or what you suggest me as a good practice.

    Thanks

  • Auto loading from a module is not supported at the moment.
  • So i have to load the lang file manually, everywhere I need, correct ?
  • HarroHarro
    Accepted Answer
    No, it works, but you need to load the module first.

    If the module is not loaded, the Finder doesn't know the path to the module (as you can define multiple module locations, or even per-module locations).

    So use:

    'modules'  => array(
        'events',
    ),
    'language'  => array(
        'events::main' => 'events',
    ),

    Loading a module is not very expensive, and a module will not become part of the search path, so it's not really an issue to autoload a module.
  • I loaded the module only in the controllers I need it, but I get the point now. Thanks.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion