Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Question about event and lang class
  • Hi, is it wise to add a "controller_started" event where I load and set the User's language ? like this:

    ```
    return array(
        'fuelphp' => array(

            // Before controllers before() method called
            'controller_started' => function()
            {
                setlocale(LC_TIME, \Auth::get('locale', 'nl_NL'));
                \Config::set('language', \Auth::get('language', 'nl'));

                \Lang::load('List');
            },

        ),
    );
    ```

    Is this a good way to do this?
  • See https://github.com/fuel/core/issues/1839

    I assume this is your reason for asking here.
  • yeah the fallback stuff is clear now... Is the event a good way to load a user defined language?
  • It doesn't really matter where you do it, I usually do it in the before method of the base controller.

    It was clear that you can pass an array of languages to both language and fallback_language if you want a lets call it a "user defined fallback"?
  • Yeah it's all clear 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