Enable Browser Language Detection

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
Locked
Extensions Robot
Extensions Robot
Extensions Robot
Posts: 27361
Joined: Sat Aug 16, 2003 7:36 am

Enable Browser Language Detection

Post by Extensions Robot » Sun Mar 30, 2008 8:22 pm

Modification name: Enable Browser Language Detection
Author: Martin Truckenbrodt
Modification description: This MOD has been replaced by Advanced Multi Language Pack Support MOD: https://www.phpbb.com/customise/db/mod/ ... pport_mod/
So developement and support for Enable Browser Language Detection MOD are closed now. Martin Truckenbrodt 2012-12-11


Browser language detection for better multi language pack support
Features:
  • Enables the browser language detection for guest users not to use the default language of the board.
  • The most usefull installed language pack will be selected for the submitted browser language settings.
Modification version: 1.2.3
Tested on phpBB version: 3.0.10

Download file: EnableBrowserLanguageDetectionMOD_1.2.3.zip
File size: 34.25 KiB

Modification overview page: View

The phpBB Team is not responsible nor required to provide support for this modification. By installing this MOD, you acknowledge that the phpBB Support Team or phpBB Extensions Team may not be able to provide support.

-->Modification support<--
Last edited by Extensions Robot on Mon Mar 27, 2017 3:10 pm, edited 24 times in total.
(this is a non-active account manager for the phpBB Extension Customisations Team)

User avatar
A_Jelly_Doughnut
Former Team Member
Posts: 34448
Joined: Sat Jan 18, 2003 1:26 am
Location: Where the Rivers Run
Contact:

Enable Browser Language Detection

Post by A_Jelly_Doughnut » Sun Mar 30, 2008 8:22 pm

Modification validated/released

Notes:
A Donut's Blog
"Bach's Prelude (Cello Suite No. 1) is driving Indiana country roads in Autumn" - Ann Kish

User avatar
Martin Truckenbrodt
Registered User
Posts: 3045
Joined: Sun Mar 23, 2003 6:22 pm
Location: Franconia
Name: Martin Truckenbrodt
Contact:

Enable Browser Language Detection

Post by Martin Truckenbrodt » Sun Mar 30, 2008 8:22 pm

Hello,
my third validated phpBB3 MOD. 8-)
Thank you very much to the MOD validation team for your time spending with this MOD!

phpBB3 compatibilty: installed and tested with pbpBB 3.0.6 successfully! 8-) :D

Important information:
Please notice that this MOD only effects on guest users (ANONYMOUS) and logged out users! And it makes only sense if you have installed more than one language packs at your board.
If you want to use it for registered and logged-in users you can find a workaround here: http://www.martin-truckenbrodt.com/cgi/ ... f=25&t=232

On my website I have published some more of my experiences with the optimizing of multilanguage phpBB3 boards: http://www.martin-truckenbrodt.com/cgi/ ... m.php?f=24

Bye Martin
Last edited by Martin Truckenbrodt on Thu Dec 03, 2009 11:53 pm, edited 12 times in total.
Free tutorial: Installing MODs in phpBB 3.0
Advanced Block MOD - Prevent spam on your phpBB 3.0 board with Stop Forum Spam, BotScout, Akismet, Project Honey Pot and several IP-RBL and Domain-RBL DNS blacklists!
My MODs
Use the official phpBB Ideas to vote missing core features!!!

jomasaco
Registered User
Posts: 32
Joined: Tue Dec 04, 2007 1:59 pm

Re: Enable Browser Language Detection

Post by jomasaco » Tue Apr 01, 2008 11:37 am

Works fine, thanks Martin Truckenbrodt
Tested on 2 languages board EN,PT

Bramster
Registered User
Posts: 605
Joined: Sun Jul 27, 2003 10:40 am

Re: Enable Browser Language Detection

Post by Bramster » Wed Apr 02, 2008 12:55 pm

Do I need to edit anything in the code to add languages ? Because after changing my sessions file it seems not to work as it should.
Navy & Merchant Marine Forum:
www.DutchFleet.net

User avatar
Martin Truckenbrodt
Registered User
Posts: 3045
Joined: Sun Mar 23, 2003 6:22 pm
Location: Franconia
Name: Martin Truckenbrodt
Contact:

Re: Enable Browser Language Detection

Post by Martin Truckenbrodt » Thu Apr 03, 2008 6:42 am

Hello Bramster,
no. The language only have to be installed in the ACP as usual.

Has the file been changed by an other MOD? E.g. Country Flags?

I noticed on my testings that sometimes you have to set only one language in your browser if you want to try a language different to your operating system language. It seems that the language priority list at the browser settings is not running well.

Bye Martin
Free tutorial: Installing MODs in phpBB 3.0
Advanced Block MOD - Prevent spam on your phpBB 3.0 board with Stop Forum Spam, BotScout, Akismet, Project Honey Pot and several IP-RBL and Domain-RBL DNS blacklists!
My MODs
Use the official phpBB Ideas to vote missing core features!!!

Bramster
Registered User
Posts: 605
Joined: Sun Jul 27, 2003 10:40 am

Re: Enable Browser Language Detection

Post by Bramster » Thu Apr 03, 2008 8:16 am

I fidled around a little and it works ok but changing the brwoser setting does not have a direct effect. I have to click aroun and then suddenly at an unexpected moment the language changes.

I am using about 5 languages (installed in the ACP) The only one that refuses to do its job is ES (Spanisch). I have no idea what is wrong.

Bramster
Navy & Merchant Marine Forum:
www.DutchFleet.net

User avatar
Martin Truckenbrodt
Registered User
Posts: 3045
Joined: Sun Mar 23, 2003 6:22 pm
Location: Franconia
Name: Martin Truckenbrodt
Contact:

Re: Enable Browser Language Detection

Post by Martin Truckenbrodt » Thu Apr 03, 2008 10:37 am

Hello Bramster,
which languages have you installed?
What's the default language?
Are all languages installed at the ACP under ACP->System->Languages Packs?
Which browsers did you try?

You have to test it when you are looged out. If you are logged in always your profile setting is used.

Please try to use all languages with your account to test the installed languages.

I tried you website. I've got german. That's correct.

Are you going to the internet using a proxy?

Bye Martin
Free tutorial: Installing MODs in phpBB 3.0
Advanced Block MOD - Prevent spam on your phpBB 3.0 board with Stop Forum Spam, BotScout, Akismet, Project Honey Pot and several IP-RBL and Domain-RBL DNS blacklists!
My MODs
Use the official phpBB Ideas to vote missing core features!!!

Bramster
Registered User
Posts: 605
Joined: Sun Jul 27, 2003 10:40 am

Re: Enable Browser Language Detection

Post by Bramster » Thu Apr 03, 2008 12:13 pm

Hi Martin, thanks for finding the time to try to help me solve this.
which languages have you installed?
What's the default language?
Are all languages installed at the ACP under ACP->System->Languages Packs?
Image
Which browsers did you try?
IE7. I also use Safari but do not know how to change the laguage settings for that browser.
You have to test it when you are looged out. If you are logged in always your profile setting is used.
Please try to use all languages with your account to test the installed languages.
I tried that. Also deleted all history files and cookies. It seems to work ok for all languages, except ES
I tried you website. I've got german. That's correct.
Can you get it in Spanish when you change your browser settings ?
Are you going to the internet using a proxy?
Nope
Navy & Merchant Marine Forum:
www.DutchFleet.net

Bramster
Registered User
Posts: 605
Joined: Sun Jul 27, 2003 10:40 am

Re: Enable Browser Language Detection

Post by Bramster » Thu Apr 03, 2008 12:39 pm

Seems to work now. No idea what I did ?!?
Navy & Merchant Marine Forum:
www.DutchFleet.net

User avatar
Martin Truckenbrodt
Registered User
Posts: 3045
Joined: Sun Mar 23, 2003 6:22 pm
Location: Franconia
Name: Martin Truckenbrodt
Contact:

Re: Enable Browser Language Detection

Post by Martin Truckenbrodt » Thu Apr 03, 2008 1:46 pm

Hello bamser,
the MOD gives es_ar an higher priority than es. This means:
If the browser submits successfully es_ar than it will be always used insteat of es.

Bye Martin
Free tutorial: Installing MODs in phpBB 3.0
Advanced Block MOD - Prevent spam on your phpBB 3.0 board with Stop Forum Spam, BotScout, Akismet, Project Honey Pot and several IP-RBL and Domain-RBL DNS blacklists!
My MODs
Use the official phpBB Ideas to vote missing core features!!!

User avatar
Martin Truckenbrodt
Registered User
Posts: 3045
Joined: Sun Mar 23, 2003 6:22 pm
Location: Franconia
Name: Martin Truckenbrodt
Contact:

Re: Enable Browser Language Detection

Post by Martin Truckenbrodt » Thu Apr 03, 2008 2:44 pm

Hello bamster,
I've tried it with IE7. It seems that there is no es selectable at the Internet Options. So I used es-es . It's running.
But I noticed that's different whether I have selected one or more languages at the Internet Options of the browser.
IMO this is not problem of the MOD.

Bye Martin
Free tutorial: Installing MODs in phpBB 3.0
Advanced Block MOD - Prevent spam on your phpBB 3.0 board with Stop Forum Spam, BotScout, Akismet, Project Honey Pot and several IP-RBL and Domain-RBL DNS blacklists!
My MODs
Use the official phpBB Ideas to vote missing core features!!!

Bramster
Registered User
Posts: 605
Joined: Sun Jul 27, 2003 10:40 am

Re: Enable Browser Language Detection

Post by Bramster » Thu Apr 03, 2008 4:30 pm

I think too that the problem is funny IE behaviour.

Normally when the browser is set at a ES setting that is not excactly installed in the phpbb3 forum then the mod will offer an other ES-** setting, right ?

E.g.: Browser is set at ES-CO but the forum only has the language ES-CR installed. Then the mod wil use forum language ES-CR. Correct ?
Navy & Merchant Marine Forum:
www.DutchFleet.net

Dastardley
Registered User
Posts: 231
Joined: Wed Apr 12, 2006 10:51 pm
Location: UK

Re: Enable Browser Language Detection

Post by Dastardley » Thu Apr 03, 2008 6:54 pm

I am getting this error message, can someone please help me......???
Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/board1/public_html/forum/includes/session.php on line 1952
{
extract($lang_iso);
foreach ($accept_lang_ary as $accept_lang)
{
// Set correct format ... guess full xx_YY form
$accept_lang_xx_yy = basename(substr($accept_lang, 0, 2) . '_' . strtolower(substr($accept_lang, 3, 2)));
// Set correct format ... guess only xx form
$accept_lang_xx = basename(substr($accept_lang, 0, 2));

if (file_exists($phpbb_root_path . 'language/' . $accept_lang_xx_yy . "/common.$phpEx") && $lang_iso == $accept_lang_xx_yy)
{
$this->lang_name = $config['default_lang'] = $lang_iso;
$this->lang_path = $phpbb_root_path . 'language/' . $lang_iso . '/';
break 2;
}
else if (file_exists($phpbb_root_path . 'language/' . $accept_lang_xx . "/common.$phpEx") && $lang_iso == $accept_lang_xx)
{
$this->lang_name = $config['default_lang'] = $lang_iso;
$this->lang_path = $phpbb_root_path . 'language/' . $lang_iso . '/';
break;
}
}
}
$this->data['user_lang'] = $this->lang_name;
}
/*
*/
}

// We include common language file here to not load it every time a custom language file is included
$lang = &$this->lang;
I made changes to the code above but think i put something in the wrong place and don't know what :?

Please help My forum cannot be accessed.

Dastardley
Last edited by Dastardley on Mon Apr 21, 2008 9:32 pm, edited 2 times in total.

User avatar
Martin Truckenbrodt
Registered User
Posts: 3045
Joined: Sun Mar 23, 2003 6:22 pm
Location: Franconia
Name: Martin Truckenbrodt
Contact:

Re: Enable Browser Language Detection

Post by Martin Truckenbrodt » Thu Apr 03, 2008 7:10 pm

Hello,
please compare the code:

Code: Select all

			/**
			* If a guest user is surfing, we try to guess his/her language first by obtaining the browser language
			* If re-enabled we need to make sure only those languages installed are checked
			* Commented out so we do not loose the code.
			* installed language checking added 2007-12-30 by Martin Truckenbrodt
			**/
			if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && request_var('lang', '') == '')
			{
				$accept_lang_ary = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);

				$sql = 'SELECT lang_iso FROM ' . LANG_TABLE;
				$result = $db->sql_query($sql, 3600);

				while ($lang_iso = $db->sql_fetchrow($result))
				{
					extract($lang_iso);
					foreach ($accept_lang_ary as $accept_lang)
					{
						// Set correct format ... guess full xx_YY form
						$accept_lang_xx_yy = basename(substr($accept_lang, 0, 2) . '_' . strtolower(substr($accept_lang, 3, 2)));
						// Set correct format ... guess only xx form
						$accept_lang_xx = basename(substr($accept_lang, 0, 2));

						if (file_exists($phpbb_root_path . 'language/' . $accept_lang_xx_yy . "/common.$phpEx") && $lang_iso == $accept_lang_xx_yy)
						{
							$this->lang_name = $config['default_lang'] = $lang_iso;
							$this->lang_path = $phpbb_root_path . 'language/' . $lang_iso . '/';
							break 2;
						}
						else if (file_exists($phpbb_root_path . 'language/' . $accept_lang_xx . "/common.$phpEx") && $lang_iso == $accept_lang_xx)
						{
							$this->lang_name = $config['default_lang'] = $lang_iso;
							$this->lang_path = $phpbb_root_path . 'language/' . $lang_iso . '/';
							break;
						}
					}
				}
				$this->data['user_lang'] = $this->lang_name;
			}
			/*
			*/
		}

		// We include common language file here to not load it every time a custom language file is included
Bye Martin
Free tutorial: Installing MODs in phpBB 3.0
Advanced Block MOD - Prevent spam on your phpBB 3.0 board with Stop Forum Spam, BotScout, Akismet, Project Honey Pot and several IP-RBL and Domain-RBL DNS blacklists!
My MODs
Use the official phpBB Ideas to vote missing core features!!!

Locked

Return to “[3.0.x] MOD Database Releases”

Who is online

Users browsing this forum: No registered users and 10 guests

cron