[SOLVED] Saratoga World Template - doesn't switch to foreign language

Hi all,
I am an happy user of Saratoga template (World Template, 29 Nov 2021 updated), but lastly I am having a trouble with language switch.
It’s in italian by default, when I switch to english, I see value changing in english for half second, then they are restored in italian by theirselves.
I never had this problem in more than 10 years of operation (and installations from scratch or updates) with Saratoga World Template.

here my site where you can see the problem by click on UK flag (only values in Forecast box works stable):
https://quartumeteo.jstarsidea.com/
Any help is really welcome.
I am a developer, no problem for technical suggestions.

I did a view-source:https://quartumeteo.jstarsidea.com/wxnewpage.php?lang=en&debug=y and saw:

<!-- common.php - Version 1.13 - 29-Nov-2021 -->
<!-- input load_langtrans SITE['lang'] = 'it; SESSION['lang'] = 'it; COOKIE['lang'] = 'it; REQUEST['lang'] = 'it;  -->
<!-- lang_input='it' used for $lang -->
<!-- set_lang_cookie setcookie('lang','it'); was successful -->
<!-- result load_langtrans SITE['lang'] = 'it; SESSION['lang'] = 'it; COOKIE['lang'] = 'it; REQUEST['lang'] = 'it;  -->
<!-- langfile 'language-it.txt' loading -->
<!-- using charset 'ISO-8859-1' -->

It appears that PHP is not populating $_GET variables to $_REQUEST variables, so the ?lang=en on the page argument is being ignored.

In your PHP Info Core section, it shows request_order to be nil for both local and global configuration.
I suggest you add a php.ini entry of:

request_order = GP

to have GET, then POST variables inserted into $_REQUEST.

Also… there’s a small PHP8 time-bomb in header.php in the line

$tuom = split('°',$temperature);  // extract units

Change that to

$tuom = explode('°',$temperature);  // extract units

to avoid a fatal error in PHP8 (which omits the ‘split’ function).

Ken, I’ve solved!
I’ve create a php.ini file in my website root, added “request_order = GP”
and it worked like a charm!

Thank you very much!!

But why did it happen? (before I had a free host altervista.org, now I am with Siteground.com)

I’ve applied also your advise about split/explore

I think that your hoster had built a PHP program, and just forgot to configure it to have $_GET and $_POST populate to $_REQUEST global variable. Your local setting overrides their nil default, and so restores the functionality that should have been there from the beginning.

Thank you for reminding me about the PHP 8 ‘gotcha’ with ‘split’ being removed from PHP 8 – I’ve updated the Base-* header.php scripts to fix that too. Some older 3rd party scripts may be using ‘each’ (which is also removed from PHP 8 ) and all the old constructs like

while (list($key,$var) = each($array)) {

need changing to

foreach ($array as $key => $var) {

. I’ve checked all the Saratoga current scripts and think I’ve fixed all those that needed updates.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.