Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Application translation files are auto loaded or not ?
  • Hi,

    Application translation files are auto loaded or not ? It's dummy question. Maybe i am missing something, being used to work with symfony/zend.

    Just for test, i have a file located in app/lang/en/global.php , containing:

    return array(
        'names' => array(
            'one' => 'One person',
            'two' => 'Two persons'
        )
    );

    In the controller or in twig (using twig as template engine), if i try to do Lang::get('names.one') 
    or lang('names.one') in twig, echoing / var_dump will always return null, UNTIL I MANUALLY LOAD the translation file with Lang::load('global.php'). 

    If this is the normal approach of fuel to play with lang files, ok - i will adapt it to my needs. If it's a bug or something for the future, i would appreciate to know this.

    * If i build a package, and i want to load the translation files, i will have to load the files from bootstrap . Ok. Not a big problem - actually a nice approach in order to avoid loading data that i don't need / use. 

    Thanks for your time ;)
  • HarroHarro
    Accepted Answer
    No, they are not. For exactly the reason you give.

    You have to explicitly load them, or add them to the always_load section in your app config.
  • Ok. Thank you fast reply :)


Howdy, Stranger!

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

In this Discussion