Author |
Message |
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: Fri Jun 18, 2010 2:27 pm Post subject: MultipleLangSwitch |
|
|
Here is my first MOD ever!
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!
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).
Description: |
|
Filesize: |
8.18 KB |
Viewed: |
40628 Time(s) |
|
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
|
Posted: 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
|
|
Back to top |
|
|
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: 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
|
Posted: Tue Jun 29, 2010 9:24 am Post subject: Re: MultipleLangSwitch |
|
|
You could have a look in the oldest versions available at sourceforge.
_________________ phpBB2 will never die, I hope! |
|
Back to top |
|
|
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: 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
|
Posted: 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.
|
|
Back to top |
|
|
Dog Cow Board Member
Joined: 18 Nov 2008
Posts: 378
|
Posted: 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 IL • Mac 512K Blog • Mac GUI |
|
Back to top |
|
|
Salvatos Board Member
Joined: 19 Feb 2009
Posts: 449 Location: Québec
|
Posted: 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
|
Posted: 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
|
Posted: 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
|
Posted: 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.
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 IL • Mac 512K Blog • Mac GUI |
|
Back to top |
|
|
StarWolf3000 Board Member
Joined: 10 Jun 2010
Posts: 175 Location: Germany
|
Posted: 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 |
|
|
|