Love Fuel?
Donate
About
Forums
Discussions
Login
FuelPHP Forums
Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
General
Auto load lang files from a module
mgabrielro
March 2014
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
Harro
March 2014
Auto loading from a module is not supported at the moment.
mgabrielro
March 2014
So i have to load the lang file manually, everywhere I need, correct ?
Harro
March 2014
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.
mgabrielro
March 2014
I loaded the module only in the controllers I need it, but I get the point now. Thanks.
Add a Comment
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
5,088
General
↳ General
3,364
↳ Job Board
13
↳ Installation & Setup
214
Packages
↳ Oil
213
↳ Orm
700
↳ Auth
260
Development
↳ Tips and Tutorials
126
↳ Code share
145
↳ Applications
52
In this Discussion
Harro
March 2014
mgabrielro
March 2014