Site settings -> Internationalization -> Determine language from : sitellite_preferences doesn't work
Reported by Peter Hagens | June 30th, 2009 @ 06:42 AM | in 5.0.3 (closed)
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
Comments and changes to this ticket
-
Peter Hagens July 9th, 2009 @ 04:02 AM
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
-
Charles Brunet July 24th, 2009 @ 10:58 AM
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...
-
lux July 24th, 2009 @ 01:36 PM
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?
-
Charles Brunet July 27th, 2009 @ 01:22 PM
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.
-
Charles Brunet August 7th, 2009 @ 09:41 AM
- Milestone set to 5.0.3
[milestone:id#47011 bulk edit command]
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
The Sitellite web content management system.