Jump to content


- - - - -

IP.Board 2.3: Allow guests to choose a language


  • Please log in to reply
24 replies to this topic

#1 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 30 January 2008 - 11:16 PM

This is the support topic for the tutorial Allow guests to choose a language.  Please post here if you have any questions or feedback.

#2 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 31 January 2008 - 07:44 AM

signature said:

Oh, you like it?


I like it! Donation sent to norway!

Was so long looking for a working solution! Cheers and 1k Thx for making the language switch available!

#3 Adriano Faria

Adriano Faria

    ...a curious guy...

  • Modders
  • PipPipPipPipPipPipPipPipPipPip
  • 3,268 posts
  • Location:Brazil
  • Real Name:Adriano
  • IPB Version:v3.3.x
Contributor

Posted 31 January 2008 - 10:01 AM

Very nice! ;)

#4 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 31 January 2008 - 10:22 AM

Thanks to both of you! ;)

#5 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 31 January 2008 - 12:19 PM

m4rtin,

with the dropdown box the language selection works very well.
Do you see any chance that it would work also when a user clicks on the country flags in the header?
Currently it chance the language after the second click.

Edited by Tom, 11 March 2009 - 12:56 PM.


#6 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 31 January 2008 - 11:51 PM

Add "&cal_id=0" at the end of the links ;)

#7 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 01 February 2008 - 07:25 AM

View Postm4rtin, on Jan 31 2008, 06:51 PM, said:

Add "&cal_id=0" at the end of the links :)

;)

Thx!

#8 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 08 September 2008 - 08:25 AM

Hi m4rtin, I have set the Default Language to '3' (via Look and Feel => make default). I have checked the conf_global.php and it suits (also '3').

WhatI dont understand is why English is still default when i open the forum page as guest? Could it be that i have to change anything else to make it working?


Tia
Tom

Edited by Tom, 08 September 2008 - 08:26 AM.


#9 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 11 September 2008 - 04:36 PM

Does anyone else have an explanationwhy switching language (ACP functionality) does not work?

Tia
Tom

#10 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 15 September 2008 - 04:11 PM

*bump*

#11 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 15 September 2008 - 08:04 PM

That weird. When new members register, what's their default language?

#12 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 15 September 2008 - 09:01 PM

I've two languages available and want to switch the default language to German.  
Unfortunately the ACP Switch does not have any effect what Language Guests are seeing. That is really odd and I have no reasonable explanation why it doesnt work.

#13 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 15 September 2008 - 09:03 PM

You didn't answer my question. If new members have English as their default language, it's a problem with the default files, or any other modification.
If it's German, it's something wrong with this tutorial.

#14 Schranzer

Schranzer

    Dr Gonzo

  • Banned
  • PipPipPipPipPip
  • 173 posts
  • Location:Germany
  • Real Name:Jerome McLane
  • IPB Version:v2.3.x
Contributor

Posted 07 October 2008 - 07:56 AM

View PostTom, on Sep 15 2008, 05:01 PM, said:

I've two languages available and want to switch the default language to German.  
Unfortunately the ACP Switch does not have any effect what Language Guests are seeing. That is really odd and I have no reasonable explanation why it doesnt work.

Yep, i have exactly the same problem...

My default language is german (lang_cache/3/)

If i want to change it into english, the page is reloading, and in the drop down i read language is english but my board language is german

Sometimes i read German in the drop down box but my forum language is english in iexplorer?!

My Forum default language is german, but if i log out as guest, my forum is in english language...

#15 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 07 October 2008 - 08:41 AM

View Postm4rtin, on Sep 15 2008, 03:04 PM, said:

That weird. When new members register, what's their default language?


View Postm4rtin, on Sep 15 2008, 04:03 PM, said:

You didn't answer my question. If new members have English as their default language, it's a problem with the default files, or any other modification.
If it's German, it's something wrong with this tutorial.

Some users registering using the english page, some of them are switch to german before the apply for a membership.
(and that the problem: I want to make German as default, but this is not possible - In ACP it tells me default, but browsing as guest to the forum english is still the standard)

#16 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 09 October 2008 - 08:36 PM

Alrighty!
I finally managed to find a solution to this!

Open index.php
Find:
//--------------------------------
// Did we choose a language?
//--------------------------------

if ( (isset($ipsclass->input['setlanguage']) AND $ipsclass->input['setlanguage']) AND (isset($ipsclass->input['langid']) AND $ipsclass->input['langid']) )
{
	if ( is_array( $ipsclass->cache['languages'] ) and count( $ipsclass->cache['languages'] ) )
	{
		foreach( $ipsclass->cache['languages'] as $data )
		{
			if ( $data['ldir'] == $ipsclass->input['langid'] )
			{
				if( $ipsclass->member['id'] == 0 )
				{

					$ipsclass->my_setcookie( 'language', $data['ldir'] );
				}
				else
				{
					$ipsclass->DB->do_update( 'members', array( 'language' => $data['ldir'] ), 'id='.$ipsclass->member['id'] );
				}
				
				$ipsclass->member['language'] = $data['ldir'];
			}
		}
	}
}
Replace with:
//--------------------------------
// Did we choose a language?
//--------------------------------

if ( (isset($ipsclass->input['setlanguage']) AND $ipsclass->input['setlanguage']) AND (isset($ipsclass->input['langid']) AND $ipsclass->input['langid']) )
{
	if ( is_array( $ipsclass->cache['languages'] ) and count( $ipsclass->cache['languages'] ) )
	{
		foreach( $ipsclass->cache['languages'] as $data )
		{
			if ( $data['ldir'] == $ipsclass->input['langid'] )
			{
				if( $ipsclass->member['id'] == 0 )
				{

					$ipsclass->my_setcookie( 'language', $data['ldir'] );
				}
				else
				{
					$ipsclass->DB->do_update( 'members', array( 'language' => $data['ldir'] ), 'id='.$ipsclass->member['id'] );
				}
				
				$ipsclass->member['language'] = $data['ldir'];
			}
		}
	}
}
else
{
	if( $ipsclass->member['id'] == 0 )
	{
		if( $ipsclass->my_getcookie( 'language' ) == 0 )
		{
			$ipsclass->my_setcookie( 'language', $ipsclass->vars['default_language'] );
		}
	}
}
Save and upload

#17 Tom

Tom

    Posting God

  • IM Supporters
  • PipPipPipPipPipPipPipPipPip
  • 1,541 posts
  • IPB Version:v2.3.x

Posted 10 October 2008 - 02:26 PM

Thank you very much for re-viewing the code m4rtin.
It works now, we have checked this from various sources.

Cheers!

#18 Martin

Martin

    But but, it's not only only!

  • Management
  • PipPipPipPipPipPipPipPipPipPip
  • 7,081 posts
  • Location:Hammerfest, Norway
  • Real Name:Martin Aronsen
  • IPB Version:v3.2.x
Contributor

Posted 10 October 2008 - 05:50 PM

Great to have it out of my head ;)

#19 Schranzer

Schranzer

    Dr Gonzo

  • Banned
  • PipPipPipPipPip
  • 173 posts
  • Location:Germany
  • Real Name:Jerome McLane
  • IPB Version:v2.3.x
Contributor

Posted 14 October 2008 - 05:50 AM

View Postm4rtin, on Oct 10 2008, 01:50 PM, said:

Great to have it out of my head :)

heheheeh  ;)
THANK YOU MAN!!!

#20 v0rtex

v0rtex

    :)

  • Members
  • PipPipPipPipPip
  • 157 posts
  • Location:Germany
  • IPB Version:v2.3.x
Contributor

Posted 14 October 2008 - 05:54 PM

Nice one and working as intended ;) BTW: I have always wondered why IPS never though about adding an option like this at least for the regristration process, where choosing a language is so valuable for boards with more than one language installed.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users