OK! News about this whole thing.
Two methods two different instances of facts and workarounds. Thank you all for your input, both here and at the
mamboserver forums' thread.
The two methods are:
- Hacking the SMF 1.1 RC2 source/load.php file.
- Hakcing the Mambelfish mod_mambelfish.php file.
Numero 1the source/load file mod that mambo dancer pointed me too at the mamboserver forums seemed to be ok and demos presented there were working. I couldn't for the life of me put it to work what they said the solution to be was:
function loadLanguage($template_name, $lang = '', $fatal = true)
{
global $boarddir, $boardurl, $user_info, $language_dir, $language, $settings, $txt,$lang ;
static $already_loaded = array();
// Default to the user's language.
if ($lang=='En') { $lang='english'; $language=$lang;}
else if ($lang=='De') { $lang='german'; $language=$lang;}
else if ($lang=='Fr') { $lang='french'; $language=$lang;}
else if ($lang=='Nl') { $lang='dutch'; $language=$lang;}
$user_info['language'] = $lang;
// Fallback on the default theme if necessary.
$attempts = array(
array($settings['theme_dir'], $template_name, $lang, $settings['theme_url']),
array($settings['theme_dir'], $template_name, $language, $settings['theme_url']),
array($settings['default_theme_dir'], $template_name, $lang, $settings['default_theme_url']),
array($settings['default_theme_dir'], $template_name, $language, $settings['default_theme_url'])
);and that you should make sure that $db_show_debug was set as global in the function.
SOLUTIONWell if you apply this as is it won't work for a 1.0.7/8 Joomla + SMF 1.1 RC2 installation. The reason is that the functions declarations are a bit different now from what they were when Mambo Dancer started his thread at MS.
First thing you will notice is that in SMF 1.1 RC2 $db_show_debug is already declared so the hack should work straight away. It doesn't because $lang is now (in this new version) local to the function. So you need to make amends and declare it global to.
Second is that in the new version the second part of the code:
// Fallback on the default theme if necessary.
$attempts = array(
array($settings['theme_dir'], $template_name, $lang, $settings['theme_url']),
array($settings['theme_dir'], $template_name, $language, $settings['theme_url']),
array($settings['default_theme_dir'], $template_name, $lang, $settings['default_theme_url']),
array($settings['default_theme_dir'], $template_name, $language, $settings['default_theme_url'])
);is not necessary any more because SMF 1.1 RC2 already resolves these by using the following code:
// Obviously, the current theme is most important to check.
$attempts = array(
array($settings['theme_dir'], $template_name, $lang, $settings['theme_url']),
array($settings['theme_dir'], $template_name, $language, $settings['theme_url']),
);
// Do we have a base theme to worry about?
if (isset($settings['base_theme_dir']))
{
$attempts[] = array($settings['base_theme_dir'], $template_name, $lang, $settings['base_theme_url']);
$attempts[] = array($settings['base_theme_dir'], $template_name, $language, $settings['base_theme_url']);
}
// Fallback on the default theme if necessary.
$attempts[] = array($settings['default_theme_dir'], $template_name, $lang, $settings['default_theme_url']);
$attempts[] = array($settings['default_theme_dir'], $template_name, $language, $settings['default_theme_url']);If you follow these steps and only add the global $lang and the first part of Mambo Dancer's code you're all set.
Oh and you can retain the nifty little flags.
Numero 2This is the mambelfish hack and it bases itself around the interesting fact that if you had your smf forum unwrapped and had more that one language installed you could simply append &language=yourlanguagenamehere to te url in the address bar of your browser and voilá the forum changes language without your having to go into your profile or the forum's default language and change it.
SOLUTIONThat's exactly what cferd's code does for you upon clicking the language of your choice in the mambelfish module. He's got an additional nice functionality in that mambelfish won't show the current language as a choice.
On the other hand you loose 2 things as mentioned before:
- The flags dissapear in mambelfish module and is substituted by the test you define in the $lang_name variable.
- It doesn't work with SEF turned on in the Joomla site configuration SEO TAB.
If you can live with this that's ok! The code works fine.
What you must have in mind though is that the whole mosLoadComponent( 'mambelfish' ) call is bypassed. I still don't see the implications this might have in the long run. If any of you kind readers got an idea, feel free to comment.
CONCLUSIONI must confess that I have lost all my hope with mambo dancer's solution but when I stumbled accross the new version code's differences with the older code the solution is simple and neat.
I prefer the smf hack because the whole problem is that of smf changing its UI. I would rather have mambelfish do its thing and not change anything in it.
Cferd's solution is for those who prefer to have smf upgradeable in the future without remembering about the hack.
Well that's it enjoy and again thanks for all the help guys.
Regards,
Pax