Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Site settings -> Internationalization -> Determine language from : sitellite_preferences doesn't work

#140

Hi Lux,

If I go to my site settings (useradm-settings-form), and change the option "Determine language from" (under Internationalization) to "Sitellite preferences" (i.e. "session"), my whole site and control panel give a white screen.
I'm using sitelite 5.0.2 Prof. edition.

Regards,

Peter Hagens
Semias

Reported by Peter Hagens · June 30th, 2009 @ 06:42 AM

State: resolved
Milestone: 5.0.3
Assigned to: lux lux

Activity

  1. Peter Hagens
    Peter Hagens

    Error message:

    Fatal error: Call to undefined function session_pref() in /home/sites/semias/public_html/opensource.sitellite.nl/saf/lib/I18n/I18n.php on line 678

    July 9th, 2009 @ 04:02 AM

  2. Charles Brunet
    Charles Brunet

    The problem is that I18n constructor calls negotiate member function, which calls session_pref function. But in the main index file, I18n intl global object is build before session global object. session_pref is defined in Session.Acl, which is included by Session.Session. John, can you check that? I don't want to mess up the main index file...

    July 24th, 2009 @ 10:58 AM

  3. lux
    lux

    It's actually not as simple as changing the order of things loading in the index file. The more I've tried that, new issues come up in the loading order and I don't want to preload everything for one setting since that would slow things like the page cache down.

    The i18n package is used by the cache, but I don't want to require the session packages as well as a database connection when the cache is just reading from disk and in order to use this method there needs to be a database connection to retrieve the preferences from the sitellite_prefs table.

    The best way to rewrite this would probably be to check if the $_POST['username'] value exists and set a cookie with the language preference once, so the database query only runs when they first log in and the value is available to each subsequent request. Something like this:

    if (isset ($_POST['username'])) {
        $lang = db_shift ('select value from sitellite_prefs where username = ? and pref = "lang"', $_POST['username']);
        if (isset ($this->languages[$lang])) {
            global $cookie;
            $cookie->set ('sitellite_lang_pref', $lang, '', '/');
            return $lang;
        }
    } elseif (isset ($cookie->sitellite_lang_pref)) {
        return $cookie->sitellite_lang_pref;
    }
    

    But this doesn't work because there's no database connection yet. I'm leaning towards just removing that option from the site settings, since there are already 3 other methods for determining the language anyway. What do you guys think?

    July 24th, 2009 @ 01:36 PM

  4. Charles Brunet
    Charles Brunet

    Yes, I think you could remove this option. It doesn't make sense have this as a user preference. Preferences are related to logged users, but what do you do if there are no users logged? And there is already the 'default language' setting in Multilingual-app to manually specify the language to use.

    July 27th, 2009 @ 01:22 PM

  5. lux
    lux
    • State changed from new to resolved

    I've removed the option now.

    July 27th, 2009 @ 04:52 PM

  6. Charles Brunet
    Charles Brunet
    • Milestone set to 5.0.3

    [milestone:id#47011 bulk edit command]

    August 7th, 2009 @ 09:41 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.