Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Always load language file
  • Hello. For some reasonse the always_load lang doesn't working. I declarated language file to always load:
    'always_load' => array('language' => array('admin/global'));
    

    When I dump $fallback from the lang class I see admin/global in array, but when I use __(My translation), translation not showing.
  • it doesn't answer your question, but there is a second solution as well, which sometimes is better approach imho. first you extend Controller_Template
    <?php
    // apps/classes/controller/public.php
    
    abstract class Controller_Public extends Controller_Template
    {
        public function before() 
        {    
            parent::before();
            
            // load your language files and do some other stuff
        }
    }
    

    now instead of extending Controller_Template you extend this Controller_Public class and your language files are allways loaded while extending Controller_Public. i suppose you do not need these files to be loaded when working with post values for an example.
  • It is never a good solution to start hacking code to work around something. Instead try to understand what goes wrong, and either fix it if it's a bug in your code, or report it if we need to fix something. What version of Fuel are we talking about, because the lang system has seen some changes recently? Since you load it in the section 'language', __('my translation') is never going to work, it should at least be __('language.my translation').

Howdy, Stranger!

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

In this Discussion