Language URL parameter is not session persistent

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
MichaT
Registered User
Posts: 15
Joined: Sat Jan 05, 2019 5:44 am
Location: Thailand
Name: Michael

Language URL parameter is not session persistent

Post by MichaT » Tue Jan 08, 2019 8:36 am

phpBB: v3.2.5 with no extension installed

when someone start my board via the URL "index.php?language=es" the main page will show up in spanish language as expected but after he clicked the link to register (or any other link) as a new user the board switches back to the default language.

i not understand why the language provied via the URL is not persistent for the guests session.
it make no sense to show only the start page in a different language and later switch back to the default language.

Is this a bug or is this URL language switch feature not fully implemented?

User avatar
Mick
Support Team Member
Support Team Member
Posts: 21148
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket - definitely

Re: Language URL parameter is not session persistent

Post by Mick » Tue Jan 08, 2019 9:06 am

You need to set the default style for the anonymous (ie: guest) user. ACP> Board settings> Guest style. You may want to select Override user style as well.
"The more connected we get the more alone we become" - Kyle Broflovski

User avatar
warmweer
Registered User
Posts: 2160
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Belt ... well actually Belgium

Re: Language URL parameter is not session persistent

Post by warmweer » Tue Jan 08, 2019 9:13 am

Mick wrote:
Tue Jan 08, 2019 9:06 am
You need to set the default style for the anonymous (ie: guest) user. ACP> Board settings> Guest style.
Do you mean default language?
I can't see how setting the default style would change anything to the language.

Also with default language english, how can index.php?language=es stay after changing page? It's not stored in the guest cookie (or is it?)
My board's not broken, it just went peculiar

User avatar
Mick
Support Team Member
Support Team Member
Posts: 21148
Joined: Fri Aug 29, 2008 9:49 am
Location: Watching cricket - definitely

Re: Language URL parameter is not session persistent

Post by Mick » Tue Jan 08, 2019 9:18 am

Yep, he did say language, apologies, ignore me.
"The more connected we get the more alone we become" - Kyle Broflovski

User avatar
warmweer
Registered User
Posts: 2160
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Belt ... well actually Belgium

Re: Language URL parameter is not session persistent

Post by warmweer » Tue Jan 08, 2019 9:33 am

There are options (I haven't tried them yet though).

[3.2][BETA] Guest Language Selector
[3.2]Google Translator


edit:
hmm? Isn't the first one your extension?
Yes, yesterday's topic viewtopic.php?f=496&t=2498261&p=15172736#p15172736
My board's not broken, it just went peculiar

User avatar
david63
Registered User
Posts: 16181
Joined: Thu Dec 19, 2002 8:08 am
Location: Lancashire, UK
Name: David Wood
Contact:

Re: Language URL parameter is not session persistent

Post by david63 » Tue Jan 08, 2019 10:01 am

If the issue relates to that extension then the question should be being asked in the Extension Writers forum
David
Remember: You only know what you know and - you don't know what you don't know!
My CDB Contributions | How to install an extension
I will not be accepting translations for any of my extensions in Github - please post any translations in the appropriate topic.
No support requests via PM or email as they will be ignored

MichaT
Registered User
Posts: 15
Joined: Sat Jan 05, 2019 5:44 am
Location: Thailand
Name: Michael

Re: Language URL parameter is not session persistent

Post by MichaT » Wed Jan 09, 2019 1:27 am

david63 wrote:
Tue Jan 08, 2019 10:01 am
If the issue relates to that extension then the question should be being asked in the Extension Writers forum
my inital post:
phpBB: v3.2.5 with no extension installed
the language parameter works fine in combination with my guest extension.
im just wondering why this parameter not work correctly as expected using the standard phpbb configuration (no extension).
i dont know which developer has implemented this feature so i decided to post it here at the support forum.

User avatar
Lumpy Burgertushie
Registered User
Posts: 66328
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Language URL parameter is not session persistent

Post by Lumpy Burgertushie » Wed Jan 09, 2019 2:31 am

I never heard of that parameter being available for use in phpbb.

robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

User avatar
warmweer
Registered User
Posts: 2160
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Belt ... well actually Belgium

Re: Language URL parameter is not session persistent

Post by warmweer » Wed Jan 09, 2019 7:36 am

MichaT wrote:
Wed Jan 09, 2019 1:27 am
im just wondering why this parameter not work correctly as expected using the standard phpbb configuration (no extension).
i dont know which developer has implemented this feature so i decided to post it here at the support forum.
Probably because when you click a link in phpbb (or anywhere else), the standard behaviour is go the webaddress stipulated by the link (which does not include the language parameter). That's logical behaviour but it can be changed using custom coding or an extension.
My board's not broken, it just went peculiar

MichaT
Registered User
Posts: 15
Joined: Sat Jan 05, 2019 5:44 am
Location: Thailand
Name: Michael

Re: Language URL parameter is not session persistent

Post by MichaT » Wed Jan 09, 2019 9:58 am

Lumpy Burgertushie wrote:
Wed Jan 09, 2019 2:31 am
I never heard of that parameter being available for use in phpbb.
Check the line 125 at the file /phpbb/user.php

MichaT
Registered User
Posts: 15
Joined: Sat Jan 05, 2019 5:44 am
Location: Thailand
Name: Michael

Re: Language URL parameter is not session persistent

Post by MichaT » Wed Jan 09, 2019 12:58 pm

Im not sure but i guess the problem is that the devs save the language var inside a cookie with the name "lang" but later they want to read this value from a cookie with another name! :roll:

the code start at line 125 of the file /phpbb/user.php

Code: Select all

			
$lang_override = $request->variable('language', '');
if ($lang_override)
{
  $this->set_cookie('lang', $lang_override, 0, false);
}
else
{
  $lang_override = $request->variable($config['cookie_name'] . '_lang', '', true, \phpbb\request\request_interface::COOKIE);
}
any comments?

User avatar
EA117
Registered User
Posts: 641
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: Language URL parameter is not session persistent

Post by EA117 » Wed Jan 09, 2019 1:41 pm

They are appending "_lang" to cookie_name there, and not using "lang" versus "_lang". i.e. The premise is that "setcookie( 'lang' )" is going to create a cookie value named "mycookie_lang", and later at the $request->variable level they would need to read that back as "mycookie_lang". See a close-together example of that in how "track" is handled in function markread (/includes/functions.php line 668).

Clearly this is still the right question (was the language override intended to be maintained as a cookie value, or through any different mechanism like $_EXTRA_URL), but I don't think the "lang" vs. "_lang" in the lines we're pointing to is the answer.

I'm wondering if the issue could be one of the cookie save being opted-out when it's a guest session? Do you end up with a cookiename_lang value saved in the cookie while anonymous? I have no knowledge of the intention or the expectations; just thinking about the nature of the current behavior.

edit: I logged out of my 3.2.5 site, passed "?language=en" to index.php, and then invoked my "register" link. The LAN trace (which is where I happened to be looking) confirmed that a "EA117_lang=en" cookie value was being sent for the ucp.php?mode=register request. (I presume F12 or simply viewing cookies would show you the same thing.) I don't actually have multiple languages on my site currently to confirm "did it actually use it." But just wanted to confirm I do actually see the cookie value being persisted.

MichaT
Registered User
Posts: 15
Joined: Sat Jan 05, 2019 5:44 am
Location: Thailand
Name: Michael

Re: Language URL parameter is not session persistent

Post by MichaT » Thu Jan 10, 2019 3:55 am

EA117 wrote:
Wed Jan 09, 2019 1:41 pm
I'm wondering if the issue could be one of the cookie save being opted-out when it's a guest session? Do you end up with a cookiename_lang value saved in the cookie while anonymous?
i started the board via index.php?language=es using FF & Chrome and guess what...no cookies are saved!
The storage inspector of FF & Chrome doesnt show any cookies saved for this site...

User avatar
EA117
Registered User
Posts: 641
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: Language URL parameter is not session persistent

Post by EA117 » Thu Jan 10, 2019 3:52 pm

MichaT wrote:
Thu Jan 10, 2019 3:55 am
i started the board via index.php?language=es using FF & Chrome and guess what...no cookies are saved!
The storage inspector of FF & Chrome doesnt show any cookies saved for this site...
That's probably the whole problem, and probably of no fault for phpBB, either.

I went ahead and added Spanish (Formal) to the same 3.2.5 board I tested against earlier. Logged out, deleted all cookies. Using index.php without parameters presented English as expected & default for the board. Using index.php?language=es caused Spanish to be used, and caused the cookiename_lang=es cookie to be saved. Navigating to the ucp.php?mode=register page continued to use Spanish and showed Spanish as the selected language for reading the registration agreement. This was all on Chrome Version 71.0.3578.98 (Official Build) (64-bit), for what it's worth.

Meaning for me, the code in phpBB is working exactly as we would expect it should be working, from the behavior implied by the user.php lines we were looking at.

So it sounds like maybe the one and only thing going wrong in the case you're observing is that the cookies aren't being saved by the browser. Meaning phpBB wants to save them, even in the anonymous/guest case, but security or other settings at the web browser itself aren't retaining the cookies. Can you make a second opinion from another browser, another machine, after confirming cookies aren't intentionally blocked or disabled, etc.

Or post/pm a link to the board where you're testing, and I'll make a second opinion from here. The board I tested against is http://ea117.com/index.php?language=es if you wanted to compare any behavior against that one yourself.

Because if you're seeing "no cookies at all", it seems less like you're in a "the language cookie and functionality isn't working" situation and more like you're in a "there aren't any cookies being saved at all." And the language override behavior just happened to be the first way you noticed the absence. Are you seeing cookies successfully saved for the site when you're actually logged in, instead of anonymous/guest?

MichaT
Registered User
Posts: 15
Joined: Sat Jan 05, 2019 5:44 am
Location: Thailand
Name: Michael

Re: Language URL parameter is not session persistent

Post by MichaT » Thu Jan 10, 2019 11:37 pm

i tried my board with IE too and no cookies are saved using index.php?language=es. so it doesnt matter if i use FF, chrome of IE. no cookies everywhere.

after that i tried your board with FF and i see 6 cookies created from your board incl. the cookie from using index.php?language=es!

and i tried another test: i activated my extension "Guest Language Selector" using FF with index.php?language=es. i can see the cookie i use to save the selected language but still no other cookies...

after i login at my board i dont see any new cookies. i only see the cookie from my extension...

maybe the default configuration of phpBB3.2.5 saves no cookies? is there somewhere a option to enable this?

Post Reply

Return to “[3.2.x] Support Forum”