Disable Browser language detection

Get help with installation and running phpBB 3.2.x here. Please do not post bug reports, feature requests, or extension related questions here.
Post Reply
danny94
Registered User
Posts: 7
Joined: Tue May 10, 2016 2:14 pm

Disable Browser language detection

Post by danny94 » Thu Mar 30, 2017 2:14 pm

Hello im interested in disable the browser language detection of my board.
Because i have 2 different languages and made for that 2 different boards. One german and one italian.
But if someone is joining the italian board with an browser wich language isnt italian or german the board language is english automatically wich i won't.

I tried already to delete the en folder in /language but then i get errors on posting.

I found the file wich contains the browser detection:
user.php
but i don't know how to comment out right.

Code: Select all

			if ($request->header('Accept-Language'))
			{
				$accept_lang_ary = explode(',', $request->header('Accept-Language'));

				foreach ($accept_lang_ary as $accept_lang)
				{
					// Set correct format ... guess full xx_YY form
					$accept_lang = substr($accept_lang, 0, 2) . '_' . strtoupper(substr($accept_lang, 3, 2));
					$accept_lang = basename($accept_lang);

					if (file_exists($this->lang_path . $accept_lang . "/common.$phpEx"))
					{
						$user_lang_name = $config['default_lang'] = $accept_lang;
						break;
					}
					else
					{
						// No match on xx_YY so try xx
						$accept_lang = substr($accept_lang, 0, 2);
						$accept_lang = basename($accept_lang);

						if (file_exists($this->lang_path . $accept_lang . "/common.$phpEx"))
						{
							$user_lang_name = $config['default_lang'] = $accept_lang;
							break;
						}
					}
				}
			}
		}

		$user_data = $this->data;
		$lang_set_ext = array();
If i comment out everything i got errors after.

.m.
Registered User
Posts: 438
Joined: Wed Nov 04, 2009 8:39 pm

Re: Disable Browser language detection

Post by .m. » Thu Mar 30, 2017 2:54 pm

if I am not mistaken, above referred code segment is related to guest users
& it is already commented out ! user.php#L149-L183

Post Reply

Return to “[3.2.x] Support Forum”