public static function init(Config $config)
    {
        self::loadAvailableLanguages();

        // Try cookies first:
        if (isset($_COOKIE) && array_key_exists('phpcilang', $_COOKIE) && self::setLanguage($_COOKIE['phpcilang'])) {
            return;
        }

        // Try user language:
        if (isset($_SERVER) && array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)) {
            $langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);

            foreach ($langs as $lang) {
                $parts = explode(';', $lang);
                $language = strtolower($parts[0]);

                if (self::setLanguage($language)) {
                    return;
                }
            }
        }

        // Try the installation default language:
        $language = $config->get('phpci.basic.language', null);
        if (self::setLanguage($language)) {
            return;
        }

        // Fall back to English:
        self::$language = 'en';
        self::$strings = self::loadLanguage();
    }
public static function init(Config $config)
    {
        self::loadAvailableLanguages();

        // Try cookies first:
        if (isset($_COOKIE) && array_key_exists('phpcilang', $_COOKIE) && self::setLanguage($_COOKIE['phpcilang'])) {
            return;
        }

        // Try user language:
        if (isset($_SERVER) && array_key_exists('HTTP_ACCEPT_LANGUAGE', $_SERVER)) {
            $langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);

            foreach ($langs as $lang) {
                $parts = explode(';', $lang);
                $language = strtolower($parts[0]);

                if (self::setLanguage($language)) {
                    return;
                }
            }
        }

        // Try the installation default language:
        $language = $config->get('phpci.basic.language', null);
        if (self::setLanguage($language)) {
            return;
        }

        // Fall back to English:
        self::$language = 'en';
        self::$strings = self::loadLanguage();
    }
public static function init ( Config $ config ) { self :: loadAvailableLanguages ( ) ; // Try cookies first: if ( isset ( $ _COOKIE ) && array_key_exists ( 'phpcilang' , $ _COOKIE ) && self :: setLanguage ( $ _COOKIE [ 'phpcilang' ] ) ) { return ; } // Try user language: if ( isset ( $ _SERVER ) && array_key_exists ( 'HTTP_ACCEPT_LANGUAGE' , $ _SERVER ) ) { $ langs = explode ( ',' , $ _SERVER [ 'HTTP_ACCEPT_LANGUAGE' ] ) ; foreach ( $ langs as $ lang ) { $ parts = explode ( ';' , $ lang ) ; $ language = strtolower ( $ parts [ 0 ] ) ; if ( self :: setLanguage ( $ language ) ) { return ; } } } // Try the installation default language: $ language = $ config -> get ( 'phpci.basic.language' , null ) ; if ( self :: setLanguage ( $ language ) ) { return ; } // Fall back to English: self :: $ language = 'en' ; self :: $ strings = self :: loadLanguage ( ) ; }
Initialise the Language helper, try load the language file for the user's browser or the configured default.

@param Config $config
Initialise the Language helper try load the language file for the user s browser or the configured default .