Welcome Guest, Not a member yet? Register   Sign In
i18n library in CI2
#9

[eluser]n0xie[/eluser]
The problem is that in the latest CI2.0 build the get_instance() is a wrapper for CI_Controller::get_instance(), a static call to the (new) CI superobject instance. The i18n library does the call before the instance is created. This wasn't a problem before since get_instance() only existed if the CI_Base object was created, but since CI_Base is gone and 'replaced' by CI_Controller, the call is now done before instantiating the object.

tl;dr: new PHP4 drop screwed up loading order of things for i18n library

You can simply fix it by editing your MY_Config, which is part of the i18n library:
Code:
class MY_Config extends CI_Config {

    function site_url($uri = '')
    {    
        if (is_array($uri))
        {
            $uri = implode('/', $uri);
        }

        // make it compatible with CI 2.0
        if (class_exists('CI_Controller'))
        {
            $uri = get_instance()->lang->localized($uri);
        }
        
        return parent::site_url($uri);
    }
        
}


Messages In This Thread
i18n library in CI2 - by El Forum - 11-12-2010, 03:15 PM
i18n library in CI2 - by El Forum - 11-12-2010, 03:42 PM
i18n library in CI2 - by El Forum - 11-13-2010, 09:53 AM
i18n library in CI2 - by El Forum - 11-13-2010, 12:10 PM
i18n library in CI2 - by El Forum - 11-13-2010, 01:50 PM
i18n library in CI2 - by El Forum - 11-14-2010, 04:03 AM
i18n library in CI2 - by El Forum - 11-16-2010, 11:33 AM
i18n library in CI2 - by El Forum - 11-17-2010, 01:07 PM
i18n library in CI2 - by El Forum - 11-18-2010, 04:17 AM
i18n library in CI2 - by El Forum - 11-18-2010, 10:48 AM
i18n library in CI2 - by El Forum - 11-24-2010, 02:14 AM
i18n library in CI2 - by El Forum - 03-29-2011, 03:20 PM
i18n library in CI2 - by El Forum - 03-30-2011, 08:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB