phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

MultipleLangSwitch


 
Search this topic... | Search MOD Development... | Search Box
Register or Login to Post    Index » MOD Development  Previous TopicPrint TopicNext Topic
Author Message
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 449
Location: Québec


flag
PostPosted: Fri Jun 18, 2010 2:27 pm 
Post subject: MultipleLangSwitch

Here is my first MOD ever! icon_smile.gif

Mod Description: This MOD allows you to switch between multiple languages even as a guest, using cookies.
Mod Version: 1.0

Author's notes: This is a modification of Nome's Switch Lang MOD, which was based on Select default language by Niels < ncr[AT]db9.dk > (Niels Chr. Rřd) http://mods.db9.dk. It has not been tested with EasyMOD.


The main difference from the other similar MODs I've seen and referenced is that you can use an unlimited number of languages by just adding them to the drop-down instead of switching from one to another. Of course if you're only using two languages, you can still use this MOD and change the drop-down for a link, as it checks for both POST and GET variables.

I didn't do anything fancy with the drop-down partly because of that, also because I didn't have a clean SubSilver to test on (although the install file assumes that it's what you are using, of course).

Looking forward to reading comments from anyone who would like to use it! icon_smile.gif


Edit: Updated the install file so that the form is submitted with an onChange event instead of a submit button (which I think I had forgotten to write anyway).



demo.png
 Description:
 Filesize:  8.18 KB
 Viewed:  40629 Time(s)

demo.png



MultipleLangSwitch_install.txt
 Description:

Download
 Filename:  MultipleLangSwitch_install.txt
 Filesize:  6.24 KB
 Downloaded:  1782 Time(s)

Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 449
Location: Québec


flag
PostPosted: Fri Jun 18, 2010 7:21 pm 
Post subject: Re: MultipleLangSwitch

I have also successfully tested this MOD on pages outside phpBB that were created using phpBB's Sessions Integration tips

You can create your own language files and/or directories to add all the desired variables and build your website around the same logic as phpBB2. I then simply use this code (which is loosely borrowed from eXtremeStyles) after the session management part:
Code:
//
// Get language files
//
$lang_file = 'language/lang_' . $board_config['default_lang'] . '/lang_main.'.$phpEx;
if( !@file_exists($lang_file) )
{   // Load English version if there is no translation to current language
   $lang_file = 'language/lang_english/lang_main.'.$phpEx;
}
include($lang_file);

Make sure you have the proper file path and your page will be automatically localized using your phpBB language files.

My current homepage is a good example of a phpBB-dependent page set to English as its default language, that is localized using its own language file and remembers language settings based on account preferences or, failing those, cookies. Every segment of text is an echoed variable in the form of $lang['pref_name']. You could also use .tpl files and export the variables in {THIS_FASHION} as usual but that is too much of a hassle for me.
Back to top
Dog Cow
Board Member



Joined: 18 Nov 2008

Posts: 378


flag
PostPosted: Mon Jun 28, 2010 10:01 pm 
Post subject: Re: MultipleLangSwitch

My memory may be wrong, but I seem to recall that there was code in the contrib/ directory of very old phpBB 2 versions that did something similar.
_________________
Moof!
Lincoln's Tomb, Oak Ridge Cemetery, Springfield ILMac 512K BlogMac GUI
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 449
Location: Québec


flag
PostPosted: Tue Jun 29, 2010 8:22 am 
Post subject: Re: MultipleLangSwitch

That I wouldn't know, I've only been keeping the latest install packs. I suppose having it in the form of a MOD is good for posterity, anyway.
Back to top
dogs and things
Board Member



Joined: 18 Nov 2008

Posts: 628
Location: Spain


flag
PostPosted: Tue Jun 29, 2010 9:24 am 
Post subject: Re: MultipleLangSwitch

You could have a look in the oldest versions available at sourceforge. icon_wink.gif
_________________
phpBB2 will never die, I hope!
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 449
Location: Québec


flag
PostPosted: Tue Jun 29, 2010 12:11 pm 
Post subject: Re: MultipleLangSwitch

I checked 2.0.12 and 2.0.15 quickly and the /contrib READMEs seem identical to the one in 2.0.23, with nothing that looks like this MOD.
Back to top
Acaria
Board Member



Joined: 20 Feb 2009

Posts: 238



PostPosted: Wed Jun 30, 2010 5:30 pm 
Post subject: Re: MultipleLangSwitch

Who cares if it's in older ones? It's not in newer ones and seems pretty useful for multilingual boards. icon_smile.gif
Back to top
Dog Cow
Board Member



Joined: 18 Nov 2008

Posts: 378


flag
PostPosted: Fri Jul 02, 2010 5:16 pm 
Post subject: Re: MultipleLangSwitch

Salvatos wrote:
I checked 2.0.12 and 2.0.15 quickly and the /contrib READMEs seem identical to the one in 2.0.23, with nothing that looks like this MOD.

I mean really old versions, like 2.0.6 and earlier.

_________________
Moof!
Lincoln's Tomb, Oak Ridge Cemetery, Springfield ILMac 512K BlogMac GUI
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 449
Location: Québec


flag
PostPosted: Fri Jul 02, 2010 6:03 pm 
Post subject: Re: MultipleLangSwitch

2.0.12 was the oldest on SourceForge.
Back to top
StarWolf3000
Board Member



Joined: 10 Jun 2010

Posts: 175
Location: Germany


flag
PostPosted: Sun Jul 04, 2010 3:31 am 
Post subject: Re: MultipleLangSwitch

You can download phpBB down to v2.0.0 and v1.4.4 at Oldapps.com - Old Version of phpBB.

Therefore you can install 2.0.0 and upgrade step-by-step to 2.0.23 (or 2.0.24 if you checkout the unofficial 2.0.24 source from sourceforge) to see what has changed from the first to the last version and which features have been added/removed.
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 449
Location: Québec


flag
PostPosted: Sun Jul 04, 2010 10:42 am 
Post subject: Re: MultipleLangSwitch

Alright, so I found it in 2.0.0 (not in 2.0.4). It was made by Niels Chr. Denmark, as credited in Nome's Switch Lang and my own MOD. It was originally a default language switch for guests; I think there's just the cookie part that remains similar/identical.
Back to top
Dog Cow
Board Member



Joined: 18 Nov 2008

Posts: 378


flag
PostPosted: Tue Jul 06, 2010 11:38 am 
Post subject: Re: MultipleLangSwitch

Salvatos wrote:
Alright, so I found it in 2.0.0 (not in 2.0.4). It was made by Niels Chr. Denmark, as credited in Nome's Switch Lang and my own MOD. It was originally a default language switch for guests; I think there's just the cookie part that remains similar/identical.

Aha! So I did recall correctly! Thanks for checking. icon_smile.gif

I've got the old versions of phpBB, but they're likely archived on CD-ROM somewhere, so it would have taken me awhile to find them.

StarWolf3000 wrote:

Therefore you can install 2.0.0 and upgrade step-by-step to 2.0.23 (or 2.0.24 if you checkout the unofficial 2.0.24 source from sourceforge) to see what has changed from the first to the last version and which features have been added/removed.

It was never installed in the phpBB code. Instead, the language switcher was provided as a MOD in the contrib/ directory, along with the Blue Card mod, gender MOD, template cache MOD, and an early version of the Attach MOD, IIRC. All of these MODs except for the template caching were removed in later distributions of phpBB, likely due to the fact that they were really coded for the earlier, pre-release versions of phpBB, and that better MODs could be found online in the phpBB MODs database.

_________________
Moof!
Lincoln's Tomb, Oak Ridge Cemetery, Springfield ILMac 512K BlogMac GUI
Back to top
StarWolf3000
Board Member



Joined: 10 Jun 2010

Posts: 175
Location: Germany


flag
PostPosted: Thu Jul 08, 2010 7:03 am 
Post subject: Re: MultipleLangSwitch

Dog wrote:
StarWolf3000 wrote:

Therefore you can install 2.0.0 and upgrade step-by-step to 2.0.23 (or 2.0.24 if you checkout the unofficial 2.0.24 source from sourceforge) to see what has changed from the first to the last version and which features have been added/removed.

It was never installed in the phpBB code. Instead, the language switcher was provided as a MOD in the contrib/ directory, along with the Blue Card mod, gender MOD, template cache MOD, and an early version of the Attach MOD, IIRC. All of these MODs except for the template caching were removed in later distributions of phpBB, likely due to the fact that they were really coded for the earlier, pre-release versions of phpBB, and that better MODs could be found online in the phpBB MODs database.

I didn't say that it was ever pre-installed into phpBB, it was meant to be as a general information for users which want to install (and update) the very first releases of phpBB 2.0.x.
Back to top
Display posts from previous:   
Register or Login to Post    Index » MOD Development  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 4 Hours
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0780 seconds using 19 queries. (SQL 0.0112 Parse 0.0108 Other 0.0560)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo