Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Matthew K. on January 02, 2007, 11:41:04 PM

Title: Language Drop Down
Post by: Matthew K. on January 02, 2007, 11:41:04 PM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=598)
Rate this Mod (http://custom.simplemachines.org/mods/index.php?action=review;sa=add;mod=598)

                 
Language Drop Down 1.5.3
                       
Author:
                   
SleePy
                       
Developer:
                   
Masterd

This Mod allows you to have a Language Drop down menu on your Site.
Language checking courtesy of JayBachatero aka Jay the Code Monkey

Version 1.5.2 (Not Released)
! Updated for SMF 1.1.13 and SMF 2.0 RC5

Version 1.5.2 (Not Released)
! Updated for SMF 2.0 RC4

Version 1.5.1
! Updated for SMF 2.0 RC3

Version 1.5
! Many changes to work with 2.0 RC2

Version 1.4.4
! We where not stripping slashes after we got it from the database.
! Added a Function check to prevent duplicate functions. (SMF 2.0 Only)
! Updated Support for of only SMF 2.0 Beta 4
! Use the default SMF Caching system for caching languages (SMF 2.0 Only)

Version 1.4.3
! Added Support for 2.0 Beta 3 Public
! Dropped Support for older 2.0 Betas

Version 1.4.2
! Added 2.0 Beta 2.1 Support

Version 1.4.1
! Added 2.0 Beta 2 Support

Version 1.4
! Sort the unique languages out
! Reworked for 2.0 Beta 1.1 to handle caching correctly.
! Actually read from cache.

Version 1.3.0
! Removed String from action. Blank action means refreshing on any page.
! Works with SMF 2.0 Beta 1
! (SMF 2.0 Beta 1) Fixed Possible reoccurring database updates.
- (SMF 2.0 Beta 1) Removed Cache Checks. We use modSettings that already has Cache work done.

Version 1.2.1
! Missed $scripturl in template

Version 1.2
! Don't use Empty Requests.
+ Non-Existing Directories prevention
! Don't Update If your MEMBER ID is 0
! Fixed possible bad languages Directory
+ Sorting of Languages
! Fixed Cache Problems
+ New Template for mod for easy addition.
! Follows Mod Guideline better
+ Other Minor Typos and changes

Version 1.0.1
! Globalize txt
! Removed Testing Install code.

Version 1.0
! Release
Title: Re: Language Drop Down
Post by: husmen73 (Gulhin) on January 03, 2007, 07:41:25 AM
Thanks Sleepy and Jay the Code Monkey ;)
Title: Re: Language Drop Down
Post by: sawz on January 04, 2007, 05:35:20 PM
its about time someone made this mod. nice work outa you. :)
Title: Re: Language Drop Down
Post by: edi67 on January 10, 2007, 03:59:44 AM
i have always this error:

8: Undefined variable: txt
File: /home2/crazyzonews/www/Sources/Load.php
Linea: 2376


Line 2376 this:
</select>&nbsp;<noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';

so i must add in modifications variable $TXT ???
Title: Re: Language Drop Down
Post by: SleePy on January 10, 2007, 10:22:46 PM
No,

Go ahead and either Upload the new package and upgrade it or uninstall the old one and install this one. I uploaded 1.0.1 which fixed this.
The changes for 1.0.1 include:

! Globalize txt
! Removed Testing Install code.
Title: Re: Language Drop Down
Post by: edi67 on January 12, 2007, 01:01:49 AM
perfectly work now thx  ;)
Title: Re: Language Drop Down
Post by: billchopher on January 12, 2007, 03:07:08 AM
Hi, this would be great for my ESL site if I could get it to work for me! I am new to SMF and site building so this could be a simple question.
I have managed to upload the mod through the admin panel and have "aplied" it. Everything says "success" but there is no dropdown showing on the site?

I have the funtion for users to change their language in the profile area but I what a dropdown like the one on this forum. Can you tell me how?

Title: Re: Language Drop Down
Post by: chrishead168 on January 12, 2007, 10:58:14 AM
i have a problem with installing the new version.

Fatal error: Cannot redeclare languagedrop() (previously declared in /home/acodersp/public_html/smf/Sources/Load.php:2233) in /home/acodersp/public_html/smf/Sources/Load.php on line 2321

althought i should be able 2 fix that why did it happen?
Title: Re: Language Drop Down
Post by: japanlinked on January 12, 2007, 12:32:07 PM
I really want this mod. I installed it on the newest version 1.1.1 with the theme levithan. But I do not see the modification anywhere? Will it work with the theme do I need to activate it in one of the admin options?  forum is here http://www.japanlinked.com/forum

Your help will be awsome I run a Japan information site. www.japanlinked.com
Title: Re: Language Drop Down
Post by: Xarcell on January 12, 2007, 12:38:25 PM
Quote from: japanlinked on January 12, 2007, 12:32:07 PM
I really want this mod. I installed it on the newest version 1.1.1 with the theme levithan. But I do not see the modification anywhere? Will it work with the theme do I need to activate it in one of the admin options?  forum is here http://www.japanlinked.com/forum

Your help will be awsome I run a Japan information site. www.japanlinked.com

I'm guessing you need to insert the code manually for your custom themes.
Title: Re: Language Drop Down
Post by: japanlinked on January 12, 2007, 12:41:00 PM
Would you happen to have a sample of where to insert the code
Title: Re: Language Drop Down
Post by: edi67 on January 13, 2007, 12:45:51 AM
Quote from: chrishead168 on January 12, 2007, 10:58:14 AM
i have a problem with installing the new version.

Fatal error: Cannot redeclare languagedrop() (previously declared in /home/acodersp/public_html/smf/Sources/Load.php:2233) in /home/acodersp/public_html/smf/Sources/Load.php on line 2321

althought i should be able 2 fix that why did it happen?


in load.php you have for 2 time double code installed, open that file with client FTP edit it go near line 2321 check and delete the double part of code, all will work correctly
Title: Re: Language Drop Down
Post by: SleePy on January 13, 2007, 01:01:16 AM
Quote from: chrishead168 on January 12, 2007, 10:58:14 AM
i have a problem with installing the new version.

Fatal error: Cannot redeclare languagedrop() (previously declared in /home/acodersp/public_html/smf/Sources/Load.php:2233) in /home/acodersp/public_html/smf/Sources/Load.php on line 2321

althought i should be able 2 fix that why did it happen?


The mod for some reason duplicated itself when installing. This may mean code is in there twice.

You can send me your Load.php and I can fix it or you can try it youself by looking for this set of code twice and removing one of them


// Do the languageDrop...
function languageDrop($check = 0, $languagecheck = null)
{
global $modSettings, $func, $context, $scripturl, $settings, $txt;

// Jay didn't think of it already being set.. bad monkey...
if(empty($context['languages']))
{
// Do this the old fashion way if cache is old or not set
if (empty($modSettings['cache_enable']) && empty($modSettings['selectLanguage']) || (isset($modSettings['selectLanguageTime']) && time() - $modSettings['selectLanguageTime'] < 86400))
{
// Are languages user selectable?  If so, get a list.
$context['languages'] = array();

$language_directories = array(
$settings['default_theme_dir'] . '/languages',
$settings['actual_theme_dir'] . '/languages',
);
if (!empty($settings['base_theme_dir']))
$language_directories[] = $settings['base_theme_dir'] . '/languages';
$language_directories = array_unique($language_directories);

foreach ($language_directories as $language_dir)
{
if (!file_exists($language_dir))
continue;

$dir = dir($language_dir);
while ($entry = $dir->read())
{
// Each language file must *at least* have a 'index.LANGUAGENAME.php' file.
if (preg_match('~^index\.(.+)\.php$~', $entry, $matches) == 0)
continue;

$context['languages'][$matches[1]] = array(
'name' => $func['ucwords'](strtr($matches[1], array('_' => ' ', '-utf8' => ''))),
'filename' => $matches[1],
);
}
$dir->close();
}

$selectLanguage = serialize($context['languages']);
}

if (($modSettings['selectLanguage'] = cache_get_data('selectLanguage', 86400)) == null)
{
if (!empty($modSettings['cache_enable']))
cache_put_data('selectLanguage', $modSettings['selectLanguage'], 86400);
elseif (empty($modSettings['selectLanguage']) || (isset($modSettings['selectLanguageTime']) && time() - $modSettings['selectLanguageTime'] < 86400))
updateSettings(array(
'selectLanguage' => addslashes($selectLanguage),
'selectLanguageTime' => time(),
));
}
}

// hmm.. If this is true we are validating the language selection..
if($check == 1 && $languagecheck != null)
{
$context['languagescheck'] = array();
$i = 0;
foreach($context['languages'] as $language)
$context['languagescheck'][$i++] = $language['filename'];

// Not a valid Language? Forget it...
if(!in_array($languagecheck, $context['languagescheck']))
return $languagecheck;

return $languagecheck;
}


// No Reason to Show it if nothing exists..
elseif(!empty($context['languages']))
{
echo '
<form action="', $scripturl , !empty($_REQUEST['action']) ? '?action=' . $_REQUEST['action'] . (!empty($_REQUEST['sa']) ? ';sa=' . $_REQUEST['sa'] : '' ) : '', '" method="post" class="smalltext" style="float: right;">
<select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';
foreach($context['languages'] as $language)
echo '
<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';
echo '
</select>&nbsp;<noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';
}

}




Quote from: japanlinked on January 12, 2007, 12:32:07 PM
I really want this mod. I installed it on the newest version 1.1.1 with the theme levithan. But I do not see the modification anywhere? Will it work with the theme do I need to activate it in one of the admin options?  forum is here http://www.japanlinked.com/forum

Your help will be awsome I run a Japan information site. www.japanlinked.com

This mod will work with your custom theme. Just put this where ever you want it to appear
languageDrop();

If you are in a echo such as
echo '
<td class="titlebg2" align="right" nowrap="nowrap" valign="top"></td>

And want to insert it use , around it and don't use the ;
So it will look like:

echo '
<td class="titlebg2" align="right" nowrap="nowrap" valign="top">', languageDrop(), '</td>';


Quote from: billchopher on January 12, 2007, 03:07:08 AM
Hi, this would be great for my ESL site if I could get it to work for me! I am new to SMF and site building so this could be a simple question.
I have managed to upload the mod through the admin panel and have "aplied" it. Everything says "success" but there is no dropdown showing on the site?

I have the funtion for users to change their language in the profile area but I what a dropdown like the one on this forum. Can you tell me how?



billchopher, Read my above reply to japanlinked's problem. This should help you.
If you find a good play for it on the forum feel free to send me what you changed so I can include it in future updates of my mod.
Title: Re: Language Drop Down
Post by: billchopher on January 16, 2007, 01:56:43 AM
Hi I got it working fine now!

Here's what I did:

1. I went into my cpanal and deleted all files accociated with prevoius intallations.

2. Starting with a clean sheet, I then made sure I had permisions set to 777, in: themes/default/index.template.php--- sources/load.php ---- and of course packages/......

3. I then made a new folder called "temp" in the packages directory.

4. then I installed it through the forum interface no problems.

5. then deleated all the temp files (themes/default/index.template.php~ and sources/load.php~ and the temp folder, so now it all works fine.

Also  When I was first intalling and unistalling over and over I also got the error about "can't call in line.... already called etc...   I simply opened the file concerned in dreamweaver to find the error on the line mentioned and removed it because it was just a duplicate.

I hope this helps someone because this thread has helped me heaps :D
Title: Re: Language Drop Down
Post by: babjusi on January 16, 2007, 02:06:14 AM
I have installed this mod recently in my forum, and gotta say, it''s very useful and handy. Thank u SleePy and JayBachatero for creating and sharing this mod with us
Title: Re: Language Drop Down
Post by: Elegant John on January 17, 2007, 11:45:13 AM
I would love to use this on my forum but I am stuck!

The mod installed perfectly without problems, now the question is, How do I get the drop down to appear?

Is there supposed to be some function in the ACP to enable this?

I tried moding the display template index resulting in a pare error.

I am using the default theme with colors modified.

http://www.ladiesofnuevolaredo.com

Thanks in advance
Title: Re: Language Drop Down
Post by: babjusi on January 17, 2007, 11:53:33 AM
Quote from: Elegant John on January 17, 2007, 11:45:13 AM
I would love to use this on my forum but I am stuck!

The mod installed perfectly without problems, now the question is, How do I get the drop down to appear?

Is there supposed to be some function in the ACP to enable this?

I tried moding the display template index resulting in a pare error.

I am using the default theme with colors modified.

http://www.ladiesofnuevolaredo.com

Thanks in advance

Which SMF version r u running? Cause the mod is compatible With: 1.1, 1.1.1.
Title: Re: Language Drop Down
Post by: Elegant John on January 17, 2007, 11:57:42 AM
Sorry, Always the newest....1.1.1 with TP .97
Title: Re: Language Drop Down
Post by: SleePy on January 18, 2007, 12:43:47 AM
This mod only installs for the Default theme at the moment.
If you use another theme you will have to manually add in the appropriate code into the theme.

This is very simple if you follow the Edits I did to the default theme and apply those to your custom theme.
If you would like to submit your changes to your custom theme so it appears in future updates of this mod you can feel free to do so by sending them to me.
Title: Re: Language Drop Down
Post by: Elegant John on January 18, 2007, 05:24:24 AM
Actually, this is the default theme. The only thing different is the color.  Where can I find these edits you refer to?
Title: Re: Language Drop Down
Post by: SleePy on January 18, 2007, 07:19:53 PM
did any of the tests fail in the pre-install screen?

Are you absolutely sure its the default theme? And not a copy of the default theme?
Title: Re: Language Drop Down
Post by: Elegant John on January 18, 2007, 07:26:58 PM
It installed perfectly. The theme uses is called DL-Green but the only files in the theme folder are style.css  and style2.css..

All the calls are made from within the default theme folder.
Title: Re: Language Drop Down
Post by: SleePy on January 18, 2007, 09:08:09 PM
can I see a link to your site?
Title: Re: Language Drop Down
Post by: Elegant John on January 19, 2007, 07:37:44 AM
http://www.ladiesofnuevolaredo.com
Title: Re: Language Drop Down
Post by: SleePy on January 20, 2007, 12:26:34 AM
Well the problem I see is that you modified the header area of the Default theme.
You will have to manually install it as it installs into the header/user info part on top (next to search on here).

Title: Re: Language Drop Down
Post by: Elegant John on January 20, 2007, 03:55:46 PM
Ups!!!
Then at this point I am lost.  Which file would I need to modify manually with the code and approximately where would the code need to go to make it appear, perhaps to the right of the Google ads (which can be removed) justification to the right under the menu buttons...

I tried adding and all I came out with was parse errors..
Title: Re: Language Drop Down
Post by: SleePy on January 20, 2007, 04:19:08 PM
index.template.php the template you modified and now use are your default.
Title: Re: Language Drop Down
Post by: srbija on January 26, 2007, 07:19:05 PM
How can I move this drop down menu to right side, like in this forum? Now, this menu is centered on my page. Sorry for bad english
Title: Re: Language Drop Down
Post by: SleePy on January 27, 2007, 02:27:17 PM
the menu could is placed in the index.template.php though you can use it in other places.
You would need to edit the index.template.php to move it
When moving it make sure to follow the php syntax. If you need help with that just post the area of code you want it in with a little know exactly where and I can show you how it should look.
Title: Re: Language Drop Down
Post by: affbld on February 17, 2007, 09:16:01 PM
I just installed the language dropdown box on my forum, and it said it was installed succesffuly, but when i tested it on Spanish, only some of the text is translated, not all of it. Can someone see what is wrong?
Title: Re: Language Drop Down
Post by: SleePy on February 17, 2007, 10:21:30 PM
Does all the language change when you change it in your profile?
Profile -> Look and Layout

My mod doesn't affect what is occurring. My only thought on this is that a mod or something added is english but labeled as a spanish file. More or less it similarly acts like like doing it through url http://yoursite.com/forum/index.php?language=spanish
Title: Re: Language Drop Down
Post by: St@rm on February 20, 2007, 08:50:10 AM
Quote from: SleePy on January 18, 2007, 12:43:47 AM
This mod only installs for the Default theme at the moment.
If you use another theme you will have to manually add in the appropriate code into the theme.

This is very simple if you follow the Edits I did to the default theme and apply those to your custom theme.
If you would like to submit your changes to your custom theme so it appears in future updates of this mod you can feel free to do so by sending them to me.

Can you please tell me where I have to do the changes to make this mod working in my custom theme,thanks.
Title: Re: Language Drop Down
Post by: SleePy on February 20, 2007, 05:13:20 PM
The whole mod runs off languageDrop();

So insert that in your theme. if it is in the middle of a echo like
echo '<tr>
           <td>This is my code</td>';

You need to put ',,' around it and drop the ;

so it would look like this:
echo '<tr>
           <td>This is my ', languageDrop(), ' code</td>';


If that is hard to follow just post the section of your theme you want it and make a note where exactly you want it.  
Title: Re: Language Drop Down
Post by: ChaosEnergy on April 03, 2007, 09:06:08 PM
I only see the drop down, when going to my profile, and there in account settings, then the dropdown gets visible, all the other time...it disappears

any idea?
Title: Re: Language Drop Down
Post by: SleePy on April 04, 2007, 12:18:29 PM
Did the mod install with no errors?
Title: Re: Language Drop Down
Post by: ChaosEnergy on April 04, 2007, 12:20:08 PM
installed complety successfull, as far as messages told me...
Title: Re: Language Drop Down
Post by: SleePy on April 04, 2007, 12:25:09 PM
Do you have any other mods installed?
Can I have a link to your forum?
Title: Re: Language Drop Down
Post by: ChaosEnergy on April 04, 2007, 12:28:55 PM
http://chaosempire.eu/forum

yes, some mods :) ~40
Title: Re: Language Drop Down
Post by: SleePy on April 04, 2007, 01:09:13 PM
Which version do did you download?
I believe their was a bug in the older version that I thought I fixed.. Maybe it was only in my Sources ::)
Title: Re: Language Drop Down
Post by: ChaosEnergy on April 04, 2007, 01:36:31 PM
Downloaded yesterday: LanguageDropV1.0.1.tar.gz
Title: Re: Language Drop Down
Post by: SleePy on April 04, 2007, 01:59:33 PM
Try this one and see if it works.
I made some changes to many to remember to make a upgrade file so you will need to uninstall the old one.
Title: Re: Language Drop Down
Post by: ChaosEnergy on April 04, 2007, 02:17:58 PM
QuoteInstallations actions for "Language Drop":
The package you are trying to download or install is either corrupt or not compatible with this version of SMF.

seems that there might be something in the package wrong???


ok...changed the first "un"install into install :)

now i was able to install, but same result

only dropdown in profile/account related setup, or in register dialog


ohh, one thing i didnt have written...
all the sites, which dont contains the dropdown, have a "broken" frame in this area...

so instead of the line _____________________ it is like ___________  __________ at this part

you will see it on my forum page

hmm, seems that it is only for non moderators a broken "line"
with 1.01 i remember it was for all, but not 100% sure
Title: Re: Language Drop Down
Post by: SleePy on April 04, 2007, 07:15:49 PM
Well if it isn't showing it then $context['languages'] is blank.
But My mod sets it if its blank.

Which means it isn't able to do any of the work it needs to do to setup the $context['languages']

The cause of that could be that your language directory isn't defined correctly or your site doesn't allow php to read files/directories.
Title: Re: Language Drop Down
Post by: ChaosEnergy on April 05, 2007, 02:02:13 AM
i should have read the forum log..sorry...
Quote2: sort() expects parameter 1 to be array, null given line 2334

// Sort Them out.. [Thanks to mwmconsulting for the suggestion]
        sort($context['languages']);


all folders/files have same permission.
on the "account related settings" page in profile, it works without issue, also on the register page for guest

so i m little bit confused

any idea where i need to look, or what to set?


adding another index.languagename.php into language folder results in additional language shown in the dropdown menu (when clicking the acc.related pages link)

also the list will get sorted correctly

so the question is, why is this working on the register and the account related settings page, but not on the other ones
Title: Re: Language Drop Down
Post by: SleePy on April 05, 2007, 11:39:25 AM
It seems that My mod isn't able to detect the language directories to find out what languages your forum has available for it.

Try this one.
Open Load.php.
Go to bottom

You should see my
// Do the languageDrop...
function languageDrop()

Replace the whole function with this.


// Do the languageDrop...
function languageDrop()
{
global $modSettings, $func, $context, $scripturl, $settings, $txt, $boarddir, $ID_MEMBER;

// Find something if its null
if(empty($languagecheck) && isset($_REQUEST['language']))
$languagecheck = $_REQUEST['language'];

// Valid Markup only..
if(isset($_POST['changelang']))
$_POST['changelang'] = (int) $_POST['changelang'];

// Jay didn't think of it already being set.. bad monkey...
if(empty($context['languages']))
{
// Do this the old fashion way if cache is old or not set
if (empty($modSettings['cache_enable']) && empty($modSettings['selectLanguage']) || (isset($modSettings['selectLanguageTime']) && time() - $modSettings['selectLanguageTime'] < 86400))
{

// Are languages user selectable?  If so, get a list.
$context['languages'] = array();

$language_directories = array(
$settings['default_theme_dir'] . '/languages',
$settings['actual_theme_dir'] . '/languages',
);

if (!empty($settings['base_theme_dir']))
$language_directories[] = $settings['base_theme_dir'] . '/languages';


// Only one per person
$language_directories = array_unique($language_directories);

// For each we find stuff
foreach ($language_directories as $language_dir)
{
// Can't look in here... doesn't exist!
if (!file_exists($language_dir))
continue;


// No bugs..
if ($language_dir == '/languages')
continue;

$dir = dir($language_dir);
while ($entry = $dir->read())
{
// Look for the index language file....
if (preg_match('~^index\.(.+)\.php$~', $entry, $matches) == 0)
continue;

$context['languages'][] = array(
'name' => $func['ucwords'](strtr($matches[1], array('_' => ' ', '-utf8' => ''))),
'selected' => $selectedLanguage == $matches[1],
'filename' => $matches[1],
);
}
$dir->close();
}


$selectLanguage = serialize($context['languages']);
}

if (($modSettings['selectLanguage'] = cache_get_data('selectLanguage', 86400)) == null)
{
if (!empty($modSettings['cache_enable']))
cache_put_data('selectLanguage', $modSettings['selectLanguage'], 86400);
elseif (empty($modSettings['selectLanguage']) || (isset($modSettings['selectLanguageTime']) && time() - $modSettings['selectLanguageTime'] < 86400))
updateSettings(array(
'selectLanguage' => addslashes($selectLanguage),
'selectLanguageTime' => time(),
));
}
}

// Sort Them out.. [Thanks to mwmconsulting for the suggestion]
sort($context['languages']);

// hmm.. If this is true we are validating the language selection..
if(!empty($languagecheck) && !empty($_POST['changelang']))
{
// How ever this happens it does.
if(empty($context['languages']))
return false;

// Clean it up. it comes through with filename
foreach($context['languages'] as $temp)
$FindLanguage[] = $temp['filename'];

// Not a valid Language? Forget it...
if(!in_array($languagecheck, $FindLanguage))
return false;

// Finally!!! Update this sucker.
if($languagecheck != false && !empty($ID_MEMBER))
updateMemberData($ID_MEMBER, array('lngfile' => '\'' . $languagecheck . '\''));

}

// No Reason to Show it if nothing exists..
if(!empty($context['languages']))
{
echo '
<form action="', $scripturl , !empty($_REQUEST['action']) ? '?action=' . $_REQUEST['action'] . (!empty($_REQUEST['sa']) ? ';sa=' . $_REQUEST['sa'] : '' ) : '', '" method="post" class="smalltext" style="float: right;">
<select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';
foreach($context['languages'] as $language)
echo '
<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';
echo '
</select><input type="hidden" name="changelang" value="1" />&nbsp;<noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';
}
}


I borrowed some code from the Registration page on how it is getting the languages. See if that actually works.
Title: Re: Language Drop Down
Post by: ChaosEnergy on April 05, 2007, 01:08:50 PM
same as before

it is visible in the account related settings page, but on the other page, it isnt
Title: Re: Language Drop Down
Post by: SleePy on April 05, 2007, 01:19:19 PM
Try this one..

It should be outputing some numbers and letters. Will let me know where it is stopping as some reason it isn't wanting to load the possible languages.

// Do the languageDrop...
function languageDrop()
{
global $modSettings, $func, $context, $scripturl, $settings, $txt, $boarddir, $ID_MEMBER;

echo '->';

// Find something if its null
if(empty($languagecheck) && isset($_REQUEST['language']))
$languagecheck = $_REQUEST['language'];

echo '1:';
// Valid Markup only..
if(isset($_POST['changelang']))
$_POST['changelang'] = (int) $_POST['changelang'];

echo '2:';
// Jay didn't think of it already being set.. bad monkey...
if(empty($context['languages']))
{
echo '3:';
// Do this the old fashion way if cache is old or not set
if (empty($modSettings['cache_enable']) && empty($modSettings['selectLanguage']) || (isset($modSettings['selectLanguageTime']) && time() - $modSettings['selectLanguageTime'] < 86400))
{
echo '4:';
// Are languages user selectable?  If so, get a list.
$context['languages'] = array();

echo '5:';
$language_directories = array(
$settings['default_theme_dir'] . '/languages',
$settings['actual_theme_dir'] . '/languages',
);
echo '6:';

if (!empty($settings['base_theme_dir']))
$language_directories[] = $settings['base_theme_dir'] . '/languages';

echo '7:';
// Only one per person
$language_directories = array_unique($language_directories);
echo '8::';
// For each we find stuff
foreach ($language_directories as $language_dir)
{
echo 'A( ' . $language_dir . '):';

// Can't look in here... doesn't exist!
if (!file_exists($language_dir))
continue;

echo 'B:';
// No bugs..
if ($language_dir == '/languages')
continue;


echo 'C:';
$dir = dir($language_dir);
while ($entry = $dir->read())
{
echo 'D:';
// Look for the index language file....
if (preg_match('~^index\.(.+)\.php$~', $entry, $matches) == 0)
continue;
echo 'E:';
$context['languages'][] = array(
'name' => $func['ucwords'](strtr($matches[1], array('_' => ' ', '-utf8' => ''))),
'selected' => $selectedLanguage == $matches[1],
'filename' => $matches[1],
);
echo 'F:';
}
$dir->close();
echo 'G:';
}


$selectLanguage = serialize($context['languages']);
echo '9:';

}
echo '10:';

if (($modSettings['selectLanguage'] = cache_get_data('selectLanguage', 86400)) == null)
{
echo '11:';

if (!empty($modSettings['cache_enable']))
cache_put_data('selectLanguage', $modSettings['selectLanguage'], 86400);
elseif (empty($modSettings['selectLanguage']) || (isset($modSettings['selectLanguageTime']) && time() - $modSettings['selectLanguageTime'] < 86400))
updateSettings(array(
'selectLanguage' => addslashes($selectLanguage),
'selectLanguageTime' => time(),
));
echo '12:';

}
}

echo '13:';


// Sort Them out.. [Thanks to mwmconsulting for the suggestion]
sort($context['languages']);

echo '14:';


// hmm.. If this is true we are validating the language selection..
if(!empty($languagecheck) && !empty($_POST['changelang']))
{
echo '!!!!!!!!!!:';

// How ever this happens it does.
if(empty($context['languages']))
return false;

// Clean it up. it comes through with filename
foreach($context['languages'] as $temp)
$FindLanguage[] = $temp['filename'];

// Not a valid Language? Forget it...
if(!in_array($languagecheck, $FindLanguage))
return false;

// Finally!!! Update this sucker.
if($languagecheck != false && !empty($ID_MEMBER))
updateMemberData($ID_MEMBER, array('lngfile' => '\'' . $languagecheck . '\''));

}

echo '::' . $context['languages'] . '-::<br />';

// No Reason to Show it if nothing exists..
if(!empty($context['languages']))
{
echo '
<form action="', $scripturl , !empty($_REQUEST['action']) ? '?action=' . $_REQUEST['action'] . (!empty($_REQUEST['sa']) ? ';sa=' . $_REQUEST['sa'] : '' ) : '', '" method="post" class="smalltext" style="float: right;">
<select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';
foreach($context['languages'] as $language)
echo '
<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';
echo '
</select><input type="hidden" name="changelang" value="1" />&nbsp;<noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';
}
}
Title: Re: Language Drop Down
Post by: ChaosEnergy on April 05, 2007, 01:27:50 PM
on main site i got:

Quote->1:2:3:10:11:12:13:14:::-::
   

and this on the site, where it works
Quote->1:2:13:14:::Array-::

btw
forum default language is set to english and Enable user-selectable language support is checked



when disabling the cache_ing in server settings, it seems to work...

i use apc cache on level1
Title: Re: Language Drop Down
Post by: SleePy on April 05, 2007, 01:39:53 PM
Is your site using a accelerator? If what was posted is correct then it is cutting out just before the cache. But no cache is actually being found..
Title: Re: Language Drop Down
Post by: ChaosEnergy on April 05, 2007, 01:40:46 PM
lol :)


same time posting

as edited just before
i use APC as cache on level1
disabling will show the language drop on other pages ..

Quote
SMF has detected that your server has APC installed.



After disabling cache, and re-enabling, it seems to work always...
restarted apache, still works
Title: Re: Language Drop Down
Post by: SleePy on April 05, 2007, 01:50:18 PM
Ok. Well its working. Now just got to find out why It wasn't caching it properly or detecting it.
Which wasn't my code, It was Jays  :P 

Which BTW you can just use the one I posted before the last one. It was the same code just one had a whole bunch of echos in it to echo stuff :P
Title: Re: Language Drop Down
Post by: ChaosEnergy on April 05, 2007, 01:52:01 PM
the stupid question is, why is disabling, and re-enabling solving the issue...
cause now it works all the time WITH cache enabled
Title: Re: Language Drop Down
Post by: SleePy on April 05, 2007, 02:01:14 PM
Restarting your accelerator it most likely deleted all things cached. So my mod was able to do its work and made the cache. So now its caching what it has right now.
I already asked jay as the if statement that is failing to detect caching correctly was his code and I can't see anything wrong with it.
Title: Re: Language Drop Down
Post by: ChaosEnergy on April 05, 2007, 02:02:58 PM
so, if i will run again into trouble, i will restart caching in smf...
Title: Re: Language Drop Down
Post by: SleePy on April 05, 2007, 02:05:25 PM
Shouldn't have to keep restarting the accelerator hopefully. Nothing should require you to do that.
But you could just change the whole if statement to always be true so it will not cache and just keep reworking.
Title: Re: Language Drop Down
Post by: ChaosEnergy on April 05, 2007, 02:07:07 PM
ok, when it next time will fail, i will change the if statement

thanks for support!!!
Title: Re: Language Drop Down
Post by: SleePy on April 05, 2007, 03:05:02 PM
You are welcome.

Though when jay gets back to me I will post the fix so hopefully the caching works correctly.
Never tested the cache out myself. I assumed it worked since jay coded it :P

5,000th post.. lol..
Title: Re: Language Drop Down
Post by: SleePy on April 05, 2007, 11:57:49 PM
ChaosEnergy,

To Fix it Change This in the function from Load.php

if (empty($modSettings['cache_enable']) && empty($modSettings['selectLanguage']) || (isset($modSettings['selectLanguageTime']) && time() - $modSettings['selectLanguageTime'] < 86400))

To this:
if ((!empty($modSettings['cache_enable']) && (($modSettings['selectLanguage'] = cache_get_data('selectLanguage', 86400)) == null)) || (empty($modSettings['cache_enable']) && (empty($modSettings['selectLanguage']) || (isset($modSettings['selectLanguageTime']) && time() - $modSettings['selectLanguageTime'] < 86400))))


Some bad checks.
I will update the mod soon with the new changes

edit.. Slight Typo

Edit.. Actually. May have a better way I will release in a update.

Committed changes to the mod Site. 1.2 Is now released with some major changes. I didn't create a upgrade file because I made to many changes and tweaks to remember them all. As well a lot of rewriting was done to make it follow the mod guidelines and other stuff the mod team is now putting out.
Title: Re: Language Drop Down
Post by: ChaosEnergy on April 06, 2007, 05:14:41 AM
With 1.2 I get a huge amount of errors, in different php pages, but always the same message at the end:

8: Undefined variable: scripturl
File: /var/www/forum/Themes/default/Themes.template.php (main_above sub template - eval?)
Line: 723
Title: Re: Language Drop Down
Post by: sami_sama on April 12, 2007, 03:48:56 PM
Hello, i installed the language drop down and its working fine with my default theme, but on my other theme , its not working. i tried to edit the code but i couldnt. i attacked below the load.php file and the index.template.php file so u can take a look at them. my site is www.uosforum.com/smf (http://www.uosforum.com/smf)
thnx alot ^_^
Title: Re: Language Drop Down
Post by: sami_sama on April 16, 2007, 03:38:09 PM
can anyone help me plz? i really need this language dropdown to work in my other template
Title: Re: Language Drop Down
Post by: pomak on April 22, 2007, 08:04:32 AM
Hello,  i have got international members and i installed language drop to my portal. it works pretty good but i need to use this mod for my classic theme. How can i do that? Default language of my forum is bulgarian. 
Regards
Title: Re: Language Drop Down
Post by: sawz on April 22, 2007, 08:35:55 AM
Quote from: pomak on April 22, 2007, 08:04:32 AM
Hello,&nbsp; i have got international members and i installed language drop to my portal. it works pretty good but i need to use this mod for my classic theme. How can i do that? Default language of my forum is bulgarian.&nbsp;
Regards
you'll have to edit the whatever files need editing for this to work on the classic theme. the mod has an xml file i believe that will tell you what goes where.
Title: Re: Language Drop Down
Post by: SleePy on April 22, 2007, 12:29:51 PM
Sorry for the lack or repling. I lost my notifications on this for some reason.
The mod is very easy to add into your theme.

With 1.2 Their is a template for it called template_language_select() that I add to the index.template.php

Add that template function to your custom theme and then just like the menu do a call for it where you want it.
template_language_select();
or
echo template_language_select();
or
echo 'Junk here ', template_language_select(), ' Junk there';

It is very simple.
In the 2 versions before that it was languageDrop() you just needed to add where you wanted it.
This was changed because I was doing templating in the sources and that is against the coding guidelines so I fixed it.

The error about the scripturl
8: Undefined variable: scripturl
I just fixed. I missed a global in the template. I updated the mod as 1.2.1
Title: Re: Language Drop Down
Post by: pomak on April 22, 2007, 01:47:29 PM
Blagodarq- Thank you very much. it works  :)
Regards
Title: Re: Language Drop Down
Post by: ChaosEnergy on April 22, 2007, 03:53:00 PM
thanks, the fix for the global works
Title: Re: Language Drop Down
Post by: sami_sama on April 22, 2007, 05:10:09 PM
thnx alot, it works on my other teme now ^_^
Title: Don't know where to integrate ...
Post by: webfritz on May 11, 2007, 07:40:37 PM
Hi, i am stuck in confusion. Some things I understand, but i am not able to integrate the coding in my template at http://www.c-work.de/sql5_tx/index.php (http://www.c-work.de/sql5_tx/index.php) 

My questions are:

What is the exact code and in which line I have to integrate?
What's the file to put it in? (according to my template circumstances)

Please help if you can :'( Thanks a lot!
Title: Re: Language Drop Down
Post by: SleePy on May 12, 2007, 12:29:02 AM
The mod makes its own function called template_language_select() in the index.template.php
Add this to your index.template.php and then where you want it to appear in your index.template.php just do template_language_select();
Kinda follows how the template_menu and template_linktree works.
Title: Re: Language Drop Down
Post by: webfritz on May 12, 2007, 06:42:14 AM
Hi SleePy,

thanks for your response. I hope, together we will get it workin' .. ;D

I guess to have found the snippet in my index.template.php but I am not a sophisticated programmer and need some adds to cope with that:

// Show the menu here, according to the menu sub template.
template_menu();
echo '
</td>
</tr>';

// Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']))
echo '
<tr class="windowbg2">
<td colspan="2" height="24" class="tborder" style="border-width: 1px 0 0 0; padding-left: 1ex;">
<b>', $txt[102], ':</b> ', $context['random_news_line'], '
</td>
</tr>';

echo '
</table>


I want to have it here in my site (check out here (http://www.c-work.de/sql5_tx/index.php)) and have a look at the picture and I have added the file index.template.php
Title: Re: Language Drop Down
Post by: SleePy on May 12, 2007, 11:44:23 PM
hmm. just a guess here but try:

// Show the menu here, according to the menu sub template.
template_menu();
echo '
</td>
</tr>';

to:


// Show the menu here, according to the menu sub template.
template_menu();
echo '
</td>
<td>', template_language_select(), '
</td>
</tr>';
Title: Re: Language Drop Down
Post by: webfritz on May 13, 2007, 03:17:28 AM
Oops, seems to be a problem in the problem:

QuoteCall to undefined function template_language_select() in /home/www/web531/html/sql5_tx/Sources/Load.php(1726) : eval()'d code on line 158

But, it works with fine with the DMF Default template.  :(

Please, if you get stuck in the snippets above, remember to have the full index.template.pho too.  :)

Added information:
Caches are actually set to OFF !! 8)
Title: Re: Language Drop Down
Post by: SleePy on May 13, 2007, 12:28:38 PM
You need to also add the function to the end of that file just before the ?>

// Generate the Language Drop Down..
function template_language_select()
{
global $context, $txt, $scripturl;

// Do the Function...
languageDrop();

// Hopefully We always have something to show for ourselves.
if (!empty ($context['languages']))
{
echo '
<form action="', $scripturl , !empty($_REQUEST['action']) ? '?action=' . $_REQUEST['action'] . (!empty($_REQUEST['sa']) ? ';sa=' . $_REQUEST['sa'] : '' ) : '', '" method="post" class="smalltext" style="float: right;">
<select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';
foreach ($context['languages'] as $language)
echo '
<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';
echo '
</select><input type="hidden" name="changelang" value="1" />&nbsp;<noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';
}
// No languages we can find!
elseif (empty ($context['languages']))
echo 'LanguageDrop: ' . $txt[398];
// If this occurs we are in trouble.
else
echo 'LanguageDrop: ' . $txt[106];
}

Title: Re: Language Drop Down
Post by: webfritz on May 13, 2007, 01:13:09 PM
Thanks SleePy, that was a Full Pull ! :) I am really happy because it's working perfectly and I can integrate english native speakers! Thanks a lot ! :-* :-*
Title: Re: Language Drop Down
Post by: teff on May 30, 2007, 02:22:49 AM
hey, i have got a problem with the code in my index.template from my theme babylon. can you take a look and say me what is wrong???

www.laxboard.de/smf

the mod works with the standard theme.

Title: Re: Language Drop Down
Post by: SleePy on May 30, 2007, 06:14:27 PM
teff it appears to be working what is the problem?
Title: Re: Language Drop Down
Post by: teff on May 31, 2007, 01:58:44 AM
yes, now it ist working, i solved the problem last night
Title: Re: Language Drop Down
Post by: joseph21 on June 16, 2007, 11:49:19 PM
Hello, could somebody please help make it work for ig-oh blue default theme? I'm trying to place the language drop on the upper right corner beside the SMF Logo.

EDIT: May I know why is it not working for me even in Babylon theme or YaBB theme? I place this codes below on the index.template.php but doesn't show up other than the default.

echo template_language_select(); or
echo languageDrop();

I even place this codes just after the <body> of the index.template.php of babylon
<body>';
echo 'Junk here ', template_language_select(), ' Junk there';

but it gave me this error:
QuoteJunk here
Fatal error: Call to undefined function: template_language_select() in /home/xxx/public_html/forum/Sources/Load.php(1726) : eval()'d code on line 147

Thanks.
Title: Re: Language Drop Down
Post by: SleePy on June 18, 2007, 12:38:51 PM
There is also a function you need to add to the index.template.php

// Generate the Language Drop Down..
function template_language_select()
{
global $context, $txt, $scripturl;

// Do the Function...
languageDrop();

// Hopefully We always have something to show for ourselves.
if (!empty ($context['languages']))
{
echo '
<form action="', $scripturl , !empty($_REQUEST['action']) ? '?action=' . $_REQUEST['action'] . (!empty($_REQUEST['sa']) ? ';sa=' . $_REQUEST['sa'] : '' ) : '', '" method="post" class="smalltext" style="float: right;">
<select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';
foreach ($context['languages'] as $language)
echo '
<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';
echo '
</select><input type="hidden" name="changelang" value="1" />&nbsp;<noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';
}
// No languages we can find!
elseif (empty ($context['languages']))
echo 'LanguageDrop: ' . $txt[398];
// If this occurs we are in trouble.
else
echo 'LanguageDrop: ' . $txt[106];
}
Title: Re: Language Drop Down
Post by: joseph21 on June 21, 2007, 09:38:54 AM
Thanks sleepy, it works now.  :)
Title: Re: Language Drop Down
Post by: st1905 on June 24, 2007, 11:03:33 AM
I`ve installed it at my forum but when i want to change the language nothing happens.I`m using mirage theme with smf+tinyportal latest.

Here it is www.dijitaldunyaforum.info/Forum
Title: Re: Language Drop Down
Post by: SleePy on June 25, 2007, 02:37:23 PM
It appears to be working for me.
It only changes the language strings in SMF.
It wont change posts and such into other languages. It is the equivalent of going to your profile and changing your language.
Title: Re: Language Drop Down
Post by: lonrot on June 27, 2007, 05:51:52 PM
I neeed the index.template code to edit my custom theme.
Pretty please!
Title: Re: Language Drop Down
Post by: SleePy on June 27, 2007, 09:25:19 PM
It is simple

Add this function before the end of the script (before ?>)

// Generate the Language Drop Down..
function template_language_select()
{
global $context, $txt, $scripturl;

// Do the Function...
languageDrop();

// Hopefully We always have something to show for ourselves.
if (!empty ($context['languages']))
{
echo '
<form action="', $scripturl , !empty($_REQUEST['action']) ? '?action=' . $_REQUEST['action'] . (!empty($_REQUEST['sa']) ? ';sa=' . $_REQUEST['sa'] : '' ) : '', '" method="post" class="smalltext" style="float: right;">
<select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';
foreach ($context['languages'] as $language)
echo '
<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';
echo '
</select><input type="hidden" name="changelang" value="1" />&nbsp;<noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';
}
// No languages we can find!
elseif (empty ($context['languages']))
echo 'LanguageDrop: ' . $txt[398];
// If this occurs we are in trouble.
else
echo 'LanguageDrop: ' . $txt[106];
}


Now where you want it to appear use template_language_select();

like
echo template_language_select();
or
echo 'HTML', template_language_select(), 'More HTML';

If you post the snippet of code of where you want it added (with a clear marker of exactly where I can help you get it into there.
Title: Re: Language Drop Down
Post by: bodygraber on July 09, 2007, 01:43:49 AM
I installed and everything seems to work but.... it displays language name funny like it needs to be bigger? see attachments
Title: Re: Language Drop Down
Post by: SleePy on July 09, 2007, 10:41:41 AM
It is displaying them fine.
I don't remember the cause of that but I think it is a bug with the files name itself.
Title: Re: Language Drop Down
Post by: bodygraber on July 10, 2007, 05:57:06 AM
Yes it displays the selection fine. what I meant was you can choose English or fpanish (not an f really but closest i could get). where would I look?
Title: Re: Language Drop Down
Post by: SleePy on July 10, 2007, 11:42:55 AM
The name is gathered from the file names.
look in /Themes/default/languages
the language files there is where it gathers its name from based on the format index.<language>.php.
Title: Re: Language Drop Down
Post by: ahmadovetch on August 03, 2007, 06:23:27 AM
SleePy, thanks for the efforts ... I wonder why dont you put the function body in a separate file and just include it in the php pages. I think this is better than copying the code for every theme. wont upgrades be easier ? im originally a java developer so i dont know much about php, execuse my ignorance :)
Title: Re: Language Drop Down
Post by: SleePy on August 03, 2007, 12:04:31 PM
besides the index.template.php there is no theme file that is included on every page. but I am thinking of new ways to do it. Hopefully can figure it out.
Title: Re: Language Drop Down
Post by: FreeSporePrints on August 11, 2007, 02:13:02 AM
Hello SleePy,
i haven' installed any language except the default in English, however i've installed your mod because i think that in future i'll add Italian on "my" SMF but appareantly doesn't appear nothing..is normal?

Thanks :)
Fabio
Title: Re: Language Drop Down
Post by: SleePy on August 12, 2007, 05:19:45 PM
Are you using a non default theme?
Title: Re: Language Drop Down
Post by: kissboy on September 30, 2007, 11:48:31 AM
Very good;Thank you! :D
Title: Re: Language Drop Down
Post by: mhf on November 17, 2007, 01:15:27 PM
Can anyone help me add Language Drop Down to the Oxygen theme?
I put the code in and it really messed up the theme - didn't look much like Oxygen anymore - even though the drop-down box was there - so that worked !
I would like the drop-down box to be on the same line as the search box...
Thanks.
Title: Re: Language Drop Down
Post by: SleePy on November 17, 2007, 09:47:28 PM
Can you tell me what changes you made?
Title: Re: Language Drop Down
Post by: mhf on November 18, 2007, 06:23:31 AM
Thanks Sleepy,
I added the code as in your message of the 28th June at the end of the page as instructed but don't understand the bit about where to place it.
Thanks again !
Title: Re: Language Drop Down
Post by: SleePy on November 18, 2007, 07:14:48 PM
Which part of the code?
The one I used in code tags goes near the end just before the ?> part. It is another function.

Then the second part is the part that calls the function, which you place where you want it to appear.
Title: Re: Language Drop Down
Post by: mhf on November 19, 2007, 02:15:11 PM
I'm talking about :
Quote from: SleePy on November 18, 2007, 07:14:48 PM
Which part of the code?
The one I used in code tags goes near the end just before the ?> part. It is another function.

Again : Sorry about my ignorance (I can hear everyone here laughing) but are we talking about adding the two bits of code to the default theme index.template.php or the Oxygen theme boardindex.template.php ? Or both ?
Thanks again.
Title: Re: Language Drop Down
Post by: L'AltroWeb on November 20, 2007, 09:28:39 AM
Hi thank'you for this nice mod!
I have babylon theme on smf 1.1.4.
And i have put code here:
find:
// If the user is logged in, display stuff like their name, new messages, etc.
Replace with:
echo template_language_select();

// If the user is logged in, display stuff like their name, new messages, etc.
and all work fine but i have two small questions:
1) How i can enlarge form Language (like this forum)?
2) How i can insert text "Select language:" (like this forum)?
Thanks in advance, DarkWolf
PS sorry for my bad english  :-[
Title: Re: Language Drop Down
Post by: SleePy on November 20, 2007, 11:03:51 AM
To add some text simply just add it to the echo

echo 'Select Language:', template_language_select();

As for the size, this is a bit tricker.

I don't know the code off the top of my head, but this would require you adding some css to your style.css file that designs the select box.
Not all browsers will accept changes though.
Title: Re: Language Drop Down
Post by: L'AltroWeb on November 20, 2007, 04:38:29 PM
I have test another solution IMHO more efficiently  ;)
For babylon theme:
Find:
</div>
<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">
<div style="margin-top: 7px;">

Replace With:
</div>
', template_language_select(), '
<form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">
<div style="margin-top: 7px;">

Now Find:
echo '
<form action="" method="post" class="smalltext" style="float: right;">
<select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';
And Replace With:
echo '
<form action="" method="post" class="smalltext" style="float: right;">
<label for="language_select" class="smalltext">Select Language:</label>
<select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';

See final result (tested with firefox, opera and IExplorer - guest and also registered user - valid W3C)
http://darkwolf.altervista.org/forum/index.php (http://darkwolf.altervista.org/forum/index.php)  8)
Title: Re: Language Drop Down
Post by: dxyy on December 08, 2007, 02:34:03 PM
Quote from: mhf on November 17, 2007, 01:15:27 PM
Can anyone help me add Language Drop Down to the Oxygen theme?
I put the code in and it really messed up the theme - didn't look much like Oxygen anymore - even though the drop-down box was there - so that worked !
I would like the drop-down box to be on the same line as the search box...
Thanks.
I would also like the language drop down box to be on the same line as the search box.

Is there an easy way to do this?

Thanks in advance. :)

EDIT: Oh, and after adding some text such as "Select Language:" the drop down box goes on a new line aligned to the right in IE. It looks fine in Firefox though. ;)
Title: Re: Language Drop Down
Post by: SleePy on December 08, 2007, 06:33:28 PM
We do have a handy doc here on how to install mods on other themes.
http://docs.simplemachines.org/index.php?topic=402.0

If you still need help after reading and trying that I do this :)
Title: Re: Language Drop Down
Post by: dxyy on December 08, 2007, 09:23:27 PM
Hmm, well I am on the default theme.

I had no problem installing the mod, it's just that I don't like the way it looked, because it added an extra 'line' to my forum. I don't know much anything about PHP, so I asked for help to get the language drop down box on the same line as the search box.

The other thing I wanted to do was add some text such as "Select language:" I managed to do that after reading this thread, but in IE it adds another line to my forum, and aesthetically it bothers me. :P

So basically there are two things I don't know how to do. :(
Title: Re: Language Drop Down
Post by: SleePy on December 08, 2007, 10:36:45 PM
It hopefully shouldn't add another line. I attempted to not make it do this. What browser size are you using (Different than actual monitor size)?

Can you show me a screenshot or a live forum with this?
Title: Re: Language Drop Down
Post by: dxyy on December 08, 2007, 10:40:08 PM
Quote from: SleePy on December 08, 2007, 10:36:45 PM
It hopefully shouldn't add another line. I attempted to not make it do this. What browser size are you using (Different than actual monitor size)?

Can you show me a screenshot or a live forum with this?
Here's a link to my test forum: http://www.daxueyingyu.com/finalforumtest/index.php

EDIT: Oh, and how do I determine my browser size?
Title: Re: Language Drop Down
Post by: SleePy on December 09, 2007, 11:40:00 PM
If you have firefox it has a web dev toolbar addon that tells you.
But for the most part your browser size is only slightly smaller than your monitor size due to the scrollbar, status bar, etc.

Did you remove the news line?
Does it look right on my test forum?
http://sleepycode.com/Forum/?
Title: Re: Language Drop Down
Post by: dxyy on December 09, 2007, 11:44:14 PM
SleePy, on your test forum it looks perfect! Well, I would also like to have the text: "Select language," but the positioning is great.

Can you show me how to implement those changes on my forum?

Thanks. :)
Title: Re: Language Drop Down
Post by: SleePy on December 10, 2007, 01:06:38 AM
Try this.

Open Load.php
Find:
<form action="', $scripturl , !empty($_REQUEST['action']) ? '?action=' . $_REQUEST['action'] . (!empty($_REQUEST['sa']) ? ';sa=' . $_REQUEST['sa'] : '' ) : '', '" method="post" class="smalltext" style="float: right;">

Add before
', $txt['select_language'], '</td><td class="titlebg2">

Open Modifications.english.php and before the end add this
$txt['select_anguage'] = 'Select Language:';
Title: Re: Language Drop Down
Post by: dxyy on December 10, 2007, 03:34:35 AM
Hmm, I can't find the code you specified in the load.php file.

Sorry, I forgot to mention that I am using SMF 1.1.3. ;)
Don't know if that makes a difference or not.
Title: Re: Language Drop Down
Post by: SleePy on December 10, 2007, 01:54:00 PM
Sorry, that was 2.0, I haven't fixed it the way I had to fix the 1.1 files yet.

It is in index.template.php.
Title: Re: Language Drop Down
Post by: dxyy on December 10, 2007, 02:03:35 PM
Gosh, I hate to be such a pain, but when I switch from English to simplified Chinese, the text gets larger for some strange reason. :(

Switching back to English reverts the text to it's regular size though.

EDIT: Sorry that only happens in IE.
Title: Re: Language Drop Down
Post by: FragaCampos on December 10, 2007, 03:54:19 PM
Hi there, and thanks for the mod ;)
Where can i edit the $txt[106] string?
I have only two languages in my forum, english and portuguese, and i would like to know how to change the string "portuguese" to "português".

Thanks.
Title: Re: Language Drop Down
Post by: SleePy on December 10, 2007, 05:14:50 PM
Does changing the language via your profile change the size?
My mod shouldn't touch anything like that so it would be either some styling or computer font setup.
Title: Re: Language Drop Down
Post by: dxyy on December 11, 2007, 01:28:57 PM
Quote from: SleePy on December 10, 2007, 05:14:50 PM
Does changing the language via your profile change the size?
My mod shouldn't touch anything like that so it would be either some styling or computer font setup.
Yes, if I change it via the profile it still changes the font size.

Anyway, you are correct, this has nothing to do with your mod as after I uninstalled it I still had the problem. I guess another mod is causing the problem, possibly the felblog mod (http://www.simplemachines.org/community/index.php?topic=209767.0) as it is the only one I remember installing on my test forum recently. :(

Ok, well thanks for your help, I'm going to add your mod to my real forum now. Haha, this is a really helpful mod given the nature of my forum. Thank you! :)
Title: Re: Language Drop Down
Post by: dxyy on December 11, 2007, 01:44:03 PM
Quote from: SleePy on December 10, 2007, 01:06:38 AM
Try this.

Open Load.php
Find:
<form action="', $scripturl , !empty($_REQUEST['action']) ? '?action=' . $_REQUEST['action'] . (!empty($_REQUEST['sa']) ? ';sa=' . $_REQUEST['sa'] : '' ) : '', '" method="post" class="smalltext" style="float: right;">

Add before
', $txt['select_language'], '</td><td class="titlebg2">

Open Modifications.english.php and before the end add this
$txt['select_[color=blue][b]l[/b][/color]anguage'] = 'Select Language:';
Ok, I hope this is the last thing I need to bug you about - hopefully you're not tired of me as yet. ::)

Anyway, I tried to implement those changes as you suggested. There was a slight problem since in my index.template.php file, the code is not
<form action="', $scripturl , !empty($_REQUEST['action']) ? '?action=' . $_REQUEST['action'] . (!empty($_REQUEST['sa']) ? ';sa=' . $_REQUEST['sa'] : '' ) : '', '" method="post" class="smalltext" style="float: right;">
but rather it was
<form action="" method="post" class="smalltext" style="float: right;">

So now the drop down is on the same line with the search box, but for some reason the text "Select language:" is on a line above that, which once again adds an additional like to my forum.
Title: Re: Language Drop Down
Post by: SleePy on December 11, 2007, 02:19:24 PM
Quote from: hugodiaz on December 11, 2007, 01:28:57 PM
Yes, if I change it via the profile it still changes the font size.

Anyway, you are correct, this has nothing to do with your mod as after I uninstalled it I still had the problem. I guess another mod is causing the problem, possibly the felblog mod (http://www.simplemachines.org/community/index.php?topic=209767.0) as it is the only one I remember installing on my test forum recently. :(

Ok, well thanks for your help, I'm going to add your mod to my real forum now. Haha, this is a really helpful mod given the nature of my forum. Thank you! :)

It may be just how things are done. If I remember right those are using specail symbols like 枆摖. So they may be blown up a little to be better seen.

Edit,
Quote from: hugodiaz on December 11, 2007, 01:44:03 PM
Ok, I hope this is the last thing I need to bug you about - hopefully you're not tired of me as yet. ::)

Anyway, I tried to implement those changes as you suggested. There was a slight problem since in my index.template.php file, the code is not
<form action="', $scripturl , !empty($_REQUEST['action']) ? '?action=' . $_REQUEST['action'] . (!empty($_REQUEST['sa']) ? ';sa=' . $_REQUEST['sa'] : '' ) : '', '" method="post" class="smalltext" style="float: right;">
but rather it was
<form action="" method="post" class="smalltext" style="float: right;">

So now the drop down is on the same line with the search box, but for some reason the text "Select language:" is on a line above that, which once again adds an additional like to my forum.

Sorry about the language string error I will correct that.
<form action="" method="post" class="smalltext" style="float: right;">

That is correct and would do just fine :)

Did you get rid of the <td> before that code you inserted? It should of been there.

My mode does this:
<td class="titlebg2" nowrap="nowrap" valign="top">';
template_language_select();
echo '
</td>


So adding that code should of just ended a table row and added another for the text.
Does your code look like this?

Title: Re: Language Drop Down
Post by: dxyy on December 11, 2007, 02:30:09 PM
Quote from: SleePy on December 11, 2007, 02:19:24 PM
It may be just how things are done. If I remember right those are using specail symbols like 枆摖. So they may be blown up a little to be better seen.
Well, I'm confident that something I changed - either through a mod or otherwise is responsible, because on my real forum there is no change in font size when members change their language.

Anyway, do you have any idea why the text: "Select language:" is being displayed on the additional line above the language and search windows?

I believe I followed your instructions as best as I could, but it didn't quite do the trick. The language drop down window's location is fine, but the text "Select language" is not. :(
Title: Re: Language Drop Down
Post by: SleePy on December 11, 2007, 06:00:17 PM
Did you look at my edit? I forgot to post that in :P
Title: Re: Language Drop Down
Post by: FragaCampos on December 12, 2007, 02:31:03 PM
Quote from: FragaCampos on December 10, 2007, 03:54:19 PM
Hi there, and thanks for the mod ;)
Where can i edit the $txt[106] string?
I have only two languages in my forum, english and portuguese, and i would like to know how to change the string "portuguese" to "português".

Thanks.

Herr... bump? :P

Edit: I realized that $txt[106] as nothing to do with that... still, is it possible to change the names of languages?
Title: Re: Language Drop Down
Post by: SleePy on December 12, 2007, 02:50:37 PM
Sorry, $txt[106] would be in the language files :P
I am giving a guess but try index.<language>.php

As for changing the name there isn't. It is generated off of index.<language>.php and given a capital and any junk removed.
Title: Re: Language Drop Down
Post by: dxyy on December 15, 2007, 10:09:27 AM
Does anyone know if this mod is xhtml valid?

After I installed it I got some errors from here - http://validator.w3.org/ :(
Title: Re: Language Drop Down
Post by: SleePy on December 15, 2007, 11:13:47 PM
It should be. What errors are you getting? Can you link to one?
Title: Re: Language Drop Down
Post by: dxyy on December 16, 2007, 03:17:13 AM
Quote from: SleePy on December 15, 2007, 11:13:47 PM
It should be. What errors are you getting? Can you link to one?
Well I uninstalled it after noticing the errors, I will reinstall it and let you know. ;)
Title: Re: Language Drop Down
Post by: dxyy on December 16, 2007, 04:43:56 AM
Ok after installing I get 8 errors:

Quote
document type does not allow element "form" here; missing one of "th", "td" start-tag.

...post" class="smalltext" style="float: right;">



The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").


end tag for element "td" which is not open.

            </td>



The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

If this error occurred in a script section of your document, you should probably read this FAQ entry.


# Line 131, Column 9: XML Parsing Error: Opening and ending tag mismatch: tr line 125 and td.

            </td>


# Error Line 140, Column 8: XML Parsing Error: Opening and ending tag mismatch: table line 124 and tr.

         </tr>


# Error Line 141, Column 10: XML Parsing Error: Opening and ending tag mismatch: div line 80 and table.

      </table>


# Error Line 142, Column 7: XML Parsing Error: Opening and ending tag mismatch: body line 54 and div.

   </div>


# Error Line 824, Column 7: XML Parsing Error: Opening and ending tag mismatch: html line 2 and body.

</body></html>


# Error Line 824, Column 7: XML Parsing Error: Extra content at the end of the document.

</body></html>


Before installing the language drop down my forum was XHTML compliant.
Hope that helps, but if there is something else you need from me, please let me know. ;)
Title: Re: Language Drop Down
Post by: SleePy on December 16, 2007, 12:39:56 PM
Is that your site you have linked in your profile?
It is showing valid html when I view it and when I use w3c on it. The coding looks correct as well :|
Title: Re: Language Drop Down
Post by: dxyy on December 16, 2007, 12:59:52 PM
Quote from: SleePy on December 16, 2007, 12:39:56 PM
Is that your site you have linked in your profile?
It is showing valid html when I view it and when I use w3c on it. The coding looks correct as well :|
Yes, well those errors were only there when I originally installed the mod without making any manual changes. After I made some changes based on your recommendations to get the language bar on the same line with the search window everything was fine.

I think if you take the mod as it is and install it on a clean version of 1.1.4 you might be able to reproduce the XHTML errors I posted above though.
Title: Re: Language Drop Down
Post by: SleePy on December 16, 2007, 11:06:17 PM
I don't know what could be wrong. My edits leave the coding in place and just adds another column. All tags are closed or self-closed.. :|
Title: Re: Language Drop Down
Post by: dxyy on December 17, 2007, 02:42:02 AM
Hmm, I guess forget about it. Haha, in my experience 90% of the time when there is a problem, the problem has been me. ::) Well, that's with software and not other things. :P
Title: Re: Language Drop Down
Post by: falguni1 on December 23, 2007, 02:40:15 AM
it is showing two times english in drop down.

also it doesnot translate the language in post.
how to translate language in post.
Title: Re: Language Drop Down
Post by: dxyy on December 23, 2007, 07:05:09 AM
It's not meant to translate the actual content of the posts! It's just meant to change the forum's language, so for example "home help profile... etc." :P
Title: Native languages in dropdown list
Post by: mariolone on December 23, 2007, 09:46:29 AM
Hello,

I would like to translate the name of each selectable language from the dropdown list of this mod.

E.g. I would like to change "French" with "Français", "Italian" with "Italiano", "Spanish" with "Espanol" etc.: where I have to change in SMF? Which files?

Thank you in advance
Title: Re: Native languages in dropdown list
Post by: SleePy on December 24, 2007, 03:40:04 PM
Quote from: mariolone on December 23, 2007, 09:46:29 AM
Hello,

I would like to translate the name of each selectable language from the dropdown list of this mod.

E.g. I would like to change "French" with "Français", "Italian" with "Italiano", "Spanish" with "Espanol" etc.: where I have to change in SMF? Which files?

Thank you in advance

If your server supports it just go to your language files and find all instances of *.<language>.php and replace it with *.<new language>.php. * is a wildcard remember ;)
Not all servers support non english file names so this may not work for all languages, which is why we don't do this.

Quote from: falguni1 on December 23, 2007, 02:40:15 AM
it is showing two times english in drop down.

also it doesnot translate the language in post.
how to translate language in post.
This mod does not translate posts, it only changes the forum language. Actually the same as to going to your profile -> account related settings and changing your forum language.

If its showing english twice then You are using English and english-utf8. I swear I had this fixed though.
You can fix this right now by opening Load.php
Finding:
sort($context['languages']);
Replace:
sort(array_unique($context['languages']));

I will update it in my sources but not going to update the packages on the mod site for a while.
Title: Re: Language Drop Down
Post by: edi67 on January 09, 2008, 08:18:22 AM
Installed on SMF 1.1.1 and everything work perfectly ;) thx

crazyzone.ws
Title: Re: Language Drop Down
Post by: lonrot on March 03, 2008, 01:45:41 AM
Guys in softmc blue, all the edits in the index are not compatible.
I cannot get together how to make the box appear like it does in the default theme.
Title: Re: Language Drop Down
Post by: SleePy on March 03, 2008, 09:03:03 PM
can you link to the theme you are  using
Title: Re: Language Drop Down
Post by: lonrot on March 06, 2008, 11:06:06 AM
Quote from: SleePy on March 03, 2008, 09:03:03 PM
can you link to the theme you are  using

http://www.tinyportal.net/index.php?topic=11033.msg90971#msg90971
Title: Re: Language Drop Down
Post by: SleePy on March 07, 2008, 12:18:05 AM
Before the end of the file add:


// Generate the Language Drop Down..
function template_language_select()
{
    global $context, $txt, $scripturl;

    // Do the Function...
    languageDrop();

    // Hopefully We always have something to show for ourselves.
    if (!empty ($context['languages']))
    {
        echo '
            <form action="" method="post" class="smalltext" style="float: right;">
                <select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';
        foreach ($context['languages'] as $language)
            echo '
                    <option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';
        echo '
                </select><input type="hidden" name="changelang" value="1" />&nbsp;<noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';
    }
    // No languages we can find!
    elseif (empty ($context['languages']))
        echo 'LanguageDrop: ' . $txt[398];
    // If this occurs we are in trouble.
    else
        echo 'LanguageDrop: ' . $txt[106];
}


Find:
    echo '
        </td></tr></table>
    </div><br />';


Replace:
    echo template_language_select(), '
        </td></tr></table>
    </div><br />';


Also,
You may want to do this, but it isn't needed.
Find:
            echo '
                                ', $txt['totalTimeLogged1'], '<br />';


Replace:
            echo '
                                ', $txt['totalTimeLogged1'];


Title: Re: Language Drop Down
Post by: lonrot on March 07, 2008, 12:38:50 AM
Absolutely outstanding! it works perfectly fine!
Thanks for the solution!!
Title: Re: Language Drop Down
Post by: FreeSporePrints on March 14, 2008, 02:53:43 PM
I've installed LanguageDrop v.1.4 on SMF 1.1.4, with a custom them (basically it's the Stylized Theme), installation went okay but cannot find any drop menu. Have i to activate something?!?

Thanks,
F.
Title: Re: Language Drop Down
Post by: SleePy on March 14, 2008, 04:06:04 PM
You will have to apply to edits to your custom theme.
If you use the Package parser or simply look at the code, The very few edits are done right there.
If you attach your index.template.php, I could make those changes.
Title: Re: Language Drop Down
Post by: LiamTheDuck on March 14, 2008, 04:22:35 PM
any chance of upgrading to SMF 2.0?
Title: Re: Language Drop Down
Post by: SleePy on March 14, 2008, 05:14:09 PM
The Modification should install for 2.0. Only the latest (Currently 2.0 Beta 2.1) though as I don't support older betas ;)
Title: Re: Language Drop Down
Post by: LiamTheDuck on March 14, 2008, 05:37:04 PM
Ill try, thanks ;)


An Error Has Occurred!
The package you are trying to download or install is either corrupt or not compatible with this version of SMF. 


:(
Title: Re: Language Drop Down
Post by: FreeSporePrints on March 14, 2008, 05:44:51 PM
Quote from: SleePy on March 14, 2008, 04:06:04 PM
You will have to apply to edits to your custom theme.
If you use the Package parser or simply look at the code, The very few edits are done right there.
If you attach your index.template.php, I could make those changes.

Hello Sleepy,
i've seen now in the Themes/default/index.template.php but don't know what to change in my Themes/custom/index.template.php

If is possible and not a problem for you, here you are the file.

Thanks :)
F.
Title: Re: Language Drop Down
Post by: SleePy on March 14, 2008, 06:44:29 PM
FreeSporePrints,

Give the attached one a try. You removed the search. So I just split the user text box one more time to show this. We can move it around if you want. The main function is in the index.template.php. So you just need to move the template_language_select() call anywhere in your code that you would like it.

[●ριмρєя12●],

Have you tried a different browser or another upload method?
I am sure this works with 2.0. I just checked the mod site which has version 1.4.2 and it supports all releases of 2.0 so far
Title: Re: Language Drop Down
Post by: LiamTheDuck on March 14, 2008, 07:09:52 PM
Aha, thanks ;)
Title: Re: Language Drop Down
Post by: FreeSporePrints on March 16, 2008, 04:10:14 AM
Quote from: SleePy on March 14, 2008, 06:44:29 PM
FreeSporePrints,

Give the attached one a try. You removed the search. So I just split the user text box one more time to show this. We can move it around if you want. The main function is in the index.template.php. So you just need to move the template_language_select() call anywhere in your code that you would like it.

Hello SleePy,
sorry for the delay. As i know i haven't removed anything!! The search function is disabled i imagine for the Stylized theme. I've tried to add the function to the bottom of the index.template.php but doesn't work..i imagine i must call this function..but how?! I don't know a word of PHP :\

Thanks,
F.
Title: Re: Language Drop Down
Post by: SleePy on March 16, 2008, 11:25:48 AM
If you added the function to the bottom, you just need to call it with template_language_select().

If you point out hte area, I can show you how to make these changes correctly. PHP is not hard to learn, if you have learned any programing language, you will be able to pick up PHP.
Title: Re: Language Drop Down
Post by: FreeSporePrints on March 16, 2008, 01:54:52 PM
Quote from: SleePy on March 16, 2008, 11:25:48 AM
If you point out the area, I can show you how to make these changes correctly.

What do you mean with point out the area?

Thanks for yor help,
F.
Title: Re: Language Drop Down
Post by: SleePy on March 16, 2008, 09:17:41 PM
I mean, either in the code or by a picture. Either one will work and I can show you how to correctly put the function in the code :)
Title: Re: Language Drop Down
Post by: FreeSporePrints on March 17, 2008, 04:08:59 AM
Oh thanks :)

I'd like to add it Simplu at the end of the main menu (id="menu")

Thanks.
F.
Title: Re: Language Drop Down
Post by: SleePy on March 17, 2008, 02:21:22 PM
If this one a try.
Title: Re: Language Drop Down
Post by: FreeSporePrints on March 17, 2008, 04:02:15 PM
"Unable to load the 'main_above' template."

Thanks,
F.
Title: Re: Language Drop Down
Post by: SleePy on March 17, 2008, 08:28:49 PM
Are you sure the file was uploaded and replaced?

That error says that the template is missing.
Title: Re: Language Drop Down
Post by: FreeSporePrints on March 18, 2008, 04:57:32 AM
Yes SleePy, i'm sure, i've also reuploaded it into Themes/custom_folder but it gives to me always the same error.

Any ideas?


Thanks,
F.
Title: Re: Language Drop Down
Post by: FreeSporePrints on March 18, 2008, 05:04:25 AM
Now the page works but there isn't the LanguageDrop!

F.
Title: Re: Language Drop Down
Post by: SleePy on March 18, 2008, 12:39:32 PM
Do you mind if you send me a pm of some url, ftp and admin login details if I can look at this? I can take a look at this tonight and see what is going on here.
Title: Lang DrpDwn: Kelo_Theme_Padexx
Post by: l_nix on March 26, 2008, 11:24:57 AM
SleePy,

Hope you have a few min to give me a hand... i've read every post in this thread and attempted all fixes.  The mod works on the default and i have it exactly where i want it, (beside the search field) but with the Padexx theme i am using i can't get it to appear. 

I've attached the index.template.php for you to take a look at... your additional code is in there, less the code that i need to make this work. 

I set up a temp admin account if it is necessary, but PM me if we can't figure it out via the template.index.php file attached.

Thanks for the help... the mod works and look great, good work... it should be a base feature for SMF.

Best,
l_nix
Title: Re: Language Drop Down
Post by: SleePy on March 26, 2008, 11:44:54 AM
try this one.
Title: Re: Language Drop Down
Post by: l_nix on March 26, 2008, 06:27:21 PM
I just uploaded it directly...

here is the error...

Fatal error: Cannot redeclare template_language_select() (previously declared in /home/ftma6384/public_html/forum/php2ftm/Sources/Load.php(1726) : eval()'d code:522) in /home/ftma6384/public_html/forum/php2ftm/Sources/Load.php(1726) : eval()'d code on line 393

I've never opened Load.php... only the index.template.php.

do i only need to move a file or is it something that was changed in the index.template.php you just sent me?

Kindest regards,
Title: Re: Language Drop Down
Post by: SleePy on March 26, 2008, 08:50:24 PM
Some reason it was already in the code like somebody tried to add it  :o

Removed the duplicate function.
Title: Re: Language Drop Down
Post by: l_nix on March 26, 2008, 11:53:09 PM
Great work... thanks Sleepy!

That works great... one last thing.

<form action="" method="post" class="smalltext" style="float: right;">

What can i do to move it down a couple pixels and over to the right more.... as of now it's in the middle of the page.

Can i add something to that form action...

Best,

:)
Title: Re: Language Drop Down
Post by: SleePy on March 27, 2008, 12:28:36 AM
In the code template_language_select() is called (Not the one with function before it)
You can move that anywhere you want in the code or edit code around it.
Title: Re: Language Drop Down
Post by: Croco on March 30, 2008, 01:35:55 PM
in smf2 it was running for a couple of days and then stopped with a note: 'sorry, no matches were found'  (it happened twice on 2 separate copies of smf2 after couple of days it stops finding any languages)

i checked the code and even reinstall the mod nothing changed same problem (so it is not related to any modification on mod's code (though i didn't change anything) )

i suspect it is related to dir::read() but i am not sure
any opinion about this ?


Title: Re: Language Drop Down
Post by: SleePy on March 30, 2008, 06:36:57 PM
Well this mod saves in the cache. So clear your file cache and see if it fixes it. It may be possible sometimes when it reads the files that either none are returned.
If this happens still after this, I might have to look into having it not save the cache or clearing the cache if its empty.
Title: Re: Language Drop Down
Post by: Croco on March 31, 2008, 12:30:48 AM
Quote from: SleePy on March 30, 2008, 06:36:57 PM
Well this mod saves in the cache. So clear your file cache and see if it fixes it. It may be possible sometimes when it reads the files that either none are returned.
If this happens still after this, I might have to look into having it not save the cache or clearing the cache if its empty.

if you mean my browser cache this happens for all my browsers and all my users
Title: Re: Language Drop Down
Post by: Croco on March 31, 2008, 03:27:03 AM
about this line

updateMemberData($user_info['id'], array('lngfile' => '\'' . $language . '\''));


i think it should be like this

updateMemberData($user_info['id'], array('lngfile' =>  $language ));


because $language contains a string already and when you use the first line it is saved in DB as ('English')
when it should be only (English)

so you are adding ( ' ) for the string name

when updating the language in same session it works but in next login it cause a problem because 'English' doesn't exist thats when it takes its value from DB

this post is not related to the previous problem i mentioned
SMF version: 2.0 Beta 3 Public
Title: Re: Language Drop Down
Post by: SleePy on March 31, 2008, 08:35:32 PM
No this is SMF file cache that was added in SMF 2.0 (as well as regular caching in SMF 1.1).

Yea, I think I copied part of that code from the Profile in some version of SMF..
Hmm, looking at things I think I see a few bugs.. I need to check this out and edit some things to get it working properly now..
Title: Re: Language Drop Down
Post by: Croco on April 07, 2008, 11:31:00 AM
new error in SMF2.0 beta 3 public

this line

$context['languages'] = unserialize($modSettings['selectLanguage']);


give me this error:
Quote
8: unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Error at offset 5 of 171 bytes

i didn't investigate it yet but i will soon if anyone knows a solution for this i will appreciate that

thanks in advance
Title: Re: Language Drop Down
Post by: Croco on April 07, 2008, 11:33:04 AM
about cache file it is disable on my site
Title: Re: Language Drop Down
Post by: SleePy on April 07, 2008, 09:25:38 PM
The cache has to be enabled as that is only used when the cache exists and is valid.

Edit. Though try this line as a replacement:

$context['languages'] = unserialize(stripslashes($modSettings['selectLanguage']));
Title: Re: Language Drop Down
Post by: Croco on April 08, 2008, 12:31:01 AM
yea that solved the problem thank you
Title: Re: Language Drop Down
Post by: SleePy on April 08, 2008, 12:37:49 AM
Ahh then thats it :P

In the 2.0 version I kinda forced a cache with my own method (This is something that due to its nature I wanted to force caching of). When I added it to the database I added slashes.. But I forgot to remove them :P

Will see it in the next update of the mod (most likely on the next 2.0 update).
Title: Re: Language Drop Down
Post by: Mike_R on April 21, 2008, 08:19:52 PM
Hi SleePy,

I'm sorry to bother you but I read the posts here and I can't figure it out. It works with the default theme no problems. I just can't figure out where to insert the code into my DilberMC theme. I would like it to be in the same position as the default, but I don't have any of the code in my index.template.php. I kinda makes it worse as I have the Ads mod also which seems to be in the same area.  Can you help me please? I am running SMF 1.1.4 I am very new but try my best to do it myself.  Thank-you
Title: Re: Language Drop Down
Post by: SleePy on April 21, 2008, 10:47:25 PM
Try this one.
Title: Re: Language Drop Down
Post by: Mike_R on April 21, 2008, 10:54:00 PM
Thank you for the quick reply! I did try it and the site would not come up... it gave me this error:

Unable to load the 'main_above' template.

Any ideas?

Thanks again, Mike

Quote from: SleePy on April 21, 2008, 10:47:25 PM
Try this one.
Title: Re: Language Drop Down
Post by: SleePy on April 21, 2008, 11:26:30 PM
Did the file complete uploading?
Did you try another browser/ftp program to download it?
Title: Re: Language Drop Down
Post by: Mike_R on April 22, 2008, 06:53:02 AM
Yes I did, I downloaded it again and then FTP'd and have the same error still. I reloaded the original so everything is OK. I tried moving the code you gave me around and unfortunatley I was getting worse errors (fatal). I don't know much about PHP so I guess I should know better  :)  Hope you can help me through this I really like this Mod.
Title: Re: Language Drop Down
Post by: SleePy on April 22, 2008, 04:04:19 PM
Can you pm me your ftp and site details? I an make the change.

Title: Re: Language Drop Down
Post by: Mike_R on April 22, 2008, 05:13:23 PM
I PM'd you, hope you have all the info you need and thanks!  Not sure if I said it is the DilberMC theme I am trying to use this on.


Quote from: SleePy on April 22, 2008, 04:04:19 PM
Can you pm me your ftp and site details? I an make the change.


Title: Re: Language Drop Down
Post by: SleePy on April 22, 2008, 07:13:15 PM
Hows that :)
I think I found the best location as well?
Title: Re: Language Drop Down
Post by: Mike_R on April 22, 2008, 07:20:57 PM
That looks awsome!!!  Thanks sooo much! I really appreciate it and our Quebec friends will love it! 

Does this also change the language of the posts as well?  I noticed it changes the menus etc.. is it supposed to change the language of the posts? If it doesn't- no worries, just asking :)

I know I said it already... but thanks again!!!  :)
Title: Re: Language Drop Down
Post by: SleePy on April 22, 2008, 07:43:37 PM
No it doesn't.

This is just a simple version of the language chooser in your profile or on the admin panel (for default language).
Title: Re: Language Drop Down
Post by: Mike_R on April 22, 2008, 07:51:39 PM
Looks good!! Much Appreciated :)
Title: Re: Language Drop Down
Post by: Nathaniel on May 27, 2008, 03:42:41 AM
Any chance of an upgrade so that this Mod supports SMF 2 beta 3.1? I figure that it would work anyway if I install it manually because the changes weren't huge from Beta 3.0 to 3.1, but it would be nice if the package did it itself.  ;)

Also I was wondering, I have used this Mod before and I noticed that the languages in the dropdown menu are always in English because it takes the smf language names which are in English, maybe this Mod could be expanded to allow for languages to be put in the list in their own languages? So Francais instead of French , Espanol instead of Spanish and etc. This would be useful for non-english forums and for forums which support other languages because if their non-english users cannot see their languages name in their own language then they may not recognize it.

I managed to achieve this with a nasty hack to the languageDrop() function which changed the language that the names are in, but it would be nice if this was a part of the Mod somehow.

2 possible methods of implementation:
1. Include a large list of language name translations and then allow admin to pick whether they want to use English names or language specific names.
2. Allow admin to customize the names of each language which is being listed.

Just a suggestion, it may not be feasible but it could work. :)
Title: Re: Language Drop Down
Post by: FragaCampos on May 27, 2008, 08:25:15 AM
That is something i think would be much appreciated by everyone.
Can you share that hack of yours? :D
Title: Re: Language Drop Down
Post by: SleePy on May 27, 2008, 05:32:39 PM
Quote from: LHVWB on May 27, 2008, 03:42:41 AM
Any chance of an upgrade so that this Mod supports SMF 2 beta 3.1? I figure that it would work anyway if I install it manually because the changes weren't huge from Beta 3.0 to 3.1, but it would be nice if the package did it itself.  ;)

Also I was wondering, I have used this Mod before and I noticed that the languages in the dropdown menu are always in English because it takes the smf language names which are in English, maybe this Mod could be expanded to allow for languages to be put in the list in their own languages? So Francais instead of French , Espanol instead of Spanish and etc. This would be useful for non-english forums and for forums which support other languages because if their non-english users cannot see their languages name in their own language then they may not recognize it.

I managed to achieve this with a nasty hack to the languageDrop() function which changed the language that the names are in, but it would be nice if this was a part of the Mod somehow.

2 possible methods of implementation:
1. Include a large list of language name translations and then allow admin to pick whether they want to use English names or language specific names.
2. Allow admin to customize the names of each language which is being listed.

Just a suggestion, it may not be feasible but it could work. :)

I am not planning on upgrading my mods until 2.0 Beta 4 is released. You can simply use version emulate to have it install.
The reason they are in english is because how the rest of the SMF handles languages is the same. I am sure it wouldn't be to hard to do a $txt['language' . $language_name] = 'Language';
But that again would require all those text strings to be in each language file.
Title: Re: Language Drop Down
Post by: Nathaniel on May 27, 2008, 08:14:36 PM
Quote from: FragaCampos on May 27, 2008, 08:25:15 AM
That is something i think would be much appreciated by everyone.
Can you share that hack of yours? :D

Here are some better instructions then the nasty hack which I was using, please note that I have only tried this with SMF 2 Beta 3.1.

1. Install the Mod normally.
2. Find the template_language_select() function in the index.template.php file for each of the templates that you want to change, add this code to the begginning of the function.

loadlanguage('Modifications');

Find the line in that function which displays the actual option for each language.
<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $txt['languagename_'.$language['name']], '</option>';

Replace the code near the end of the line which says "$language['name']" with "isset($txt['languagename_'.$language['name']]) ? $txt['languagename_'.$language['name']] : $language['name']".

3. Edit your language files for each template: Find the "Modifications.(language).php" files for each language and then add the language name strings that you want, to the beginning of each of these files in the following format.

$txt['languagename_language in english'] = 'languagename';

For example
$txt['languagename_French'] = 'Francais';
$txt['languagename_Spanish'] = 'Espanol';
$txt['languagename_English'] = 'English';

Please note that if you do not define these names in every Modifications.(language).php then because of the edit to the language function, it will show the english name anyway.
Title: Re: Language Drop Down
Post by: edi67 on June 18, 2008, 10:59:02 AM
why after install mod i see only this in my index.page:

LanguageDrop: but nothing else not menu to scroll

look:
http://ediboard.altervista.org/index.php
Title: Re: Language Drop Down
Post by: SleePy on June 18, 2008, 03:42:12 PM
I don't see it at all.
Did you uninstall it?

Do you have more than 1 language pack installed?
Title: Re: Language Drop Down
Post by: edi67 on June 18, 2008, 04:36:14 PM
Quote from: SleePy on June 18, 2008, 03:42:12 PM
I don't see it at all.
Did you uninstall it?

Do you have more than 1 language pack installed?

i have 2 language english and italian, yes installed
Title: Re: Language Drop Down
Post by: SleePy on June 18, 2008, 04:45:18 PM
Do you get an error in the error log?

Do you have caching enabled?

Title: Re: Language Drop Down
Post by: edi67 on June 19, 2008, 04:31:30 AM
Level 1 of caching

such errors i have:

Apply Filter: Only show the errors with the same message
8: unserialize() [<a href='function.unserialize'>function.unserialize</a>]: Error at offset 5 of 174 bytes
Apply Filter: Only show the errors from this file
File: /membri/ediboard/Sources/Load.php
Riga: 2614
Title: Re: Language Drop Down
Post by: SleePy on June 19, 2008, 06:20:34 PM
Hmm, well its saying the array of languages is empty..

Does it go away after some time? It should be going away after a bit when the cache gets old.
If its not, then its still not finding the languages :|
Title: Re: Language Drop Down
Post by: edi67 on June 20, 2008, 02:58:44 AM
i get this error immediately after installation of mod
Title: Re: Language Drop Down
Post by: SleePy on June 20, 2008, 06:45:41 PM
I wonder if its because of the bad cache it has :|

Uninstall it and try this one. Its a early push of 1.4.4 I was working on. But it uses proper SMF caching system and I changed how things work. Hopefully this one gets all the bugs out of the 2.0 version.
Title: Re: Language Drop Down
Post by: edi67 on June 21, 2008, 10:15:43 AM
GREATT i changed something but now work perfectly thx

take a look
Title: Re: Language Drop Down
Post by: m107 on July 19, 2008, 02:04:51 PM
hi
now i want to install a mode and after i click on "install" it says me that want to edit "./Themes/default/index.template.php" but i want to install this mode on another theme in this path "./Themes/bluBlur/index.template.php" .

how can i solve this problem?

thanks in advance
Title: Re: Language Drop Down
Post by: m107 on July 20, 2008, 12:13:50 PM
?!!!
why this forum is son inactive?!
how can i solve my problem with installing mods on non-default forum?

sorry for any inconvenience
Title: Re: Language Drop Down
Post by: bran8464 on July 27, 2008, 02:21:09 PM
I got this working on my site:

Freedpm Island]http://www.noodiebooties.com/69/]Freedpm Island (http://www.noodiebooties.com/69/)

Running the default theme on 1.1.5 I find I get a load of text above the header after a while:

$txt['no_click'] = 'Sorry , but the right click is disable for guest'; $txt['arrange_nrcg'] = 'Disable the right click for guest'; $txt['colorize_color'] = 'Color'; $txt['pmi_title'] = 'You have %s message(s) unread!'; $txt['pmi_view_all'] = '[View All]';$txt['changeposterid'] = 'Change Poster/Starter'; $txt['changeposteridno'] = 'Poster ID'; $txt['aeiou'] = 'AEIOU'; $txt['aeiou_title'] = 'Auto Email Inactive Ordinary Users'; $txt['aeiou_enable'] = 'Enable Automatic Emailing Of Inactive Users'; $txt['aeiou_email_desc1'] = 'Text-Only (No html, no bbcode)'; $txt

That's just a small sample. Any ideas? BTW it changes the language  in server settings.
Title: Re: Language Drop Down
Post by: Nathaniel on July 27, 2008, 05:13:08 PM
@bran8464,
Thats a simple error which means there has been an issue with the package manager.

You need to open up your '/themes/default/languages/modifications.{language}.php' files and then move the closing php tag " ?> " from before that php code, to after it.
Title: Re: Language Drop Down
Post by: bran8464 on July 27, 2008, 06:21:09 PM
Do you mean this code:

<?php
// Version: 1.1; Modifications
?>

If so I tried as you said and it didn't work. Exactly how should it look?

BTW when the original error occurs it changes in server settings English Utf8 to English. Changing back to Utf8 corrects it until the next time. We have forum members from all over the world so it would be good to get this right.
Title: Re: Language Drop Down
Post by: Nathaniel on July 28, 2008, 02:06:13 AM
Am I right in saying that the code from that file looks something like this:


<?php
// Version: 1.1; Modifications
?>

$txt['no_click'] = 'Sorry , but the right click is disable for guest';
$txt['arrange_nrcg'] = 'Disable the right click for guest';
$txt['colorize_color'] = 'Color';
$txt['pmi_title'] = 'You have %s message(s) unread!';
$txt['pmi_view_all'] = '[View All]';
$txt['changeposterid'] = 'Change Poster/Starter';
$txt['changeposteridno'] = 'Poster ID';
$txt['aeiou'] = 'AEIOU';
$txt['aeiou_title'] = 'Auto Email Inactive Ordinary Users';
$txt['aeiou_enable'] = 'Enable Automatic Emailing Of Inactive Users';
$txt['aeiou_email_desc1'] = 'Text-Only (No html, no bbcode)';


It should really be something like this:

<?php
// Version: 1.1; Modifications

$txt['no_click'] = 'Sorry , but the right click is disable for guest';
$txt['arrange_nrcg'] = 'Disable the right click for guest'
$txt['colorize_color'] = 'Color'
$txt['pmi_title'] = 'You have %s message(s) unread!'
$txt['pmi_view_all'] = '[View All]';
$txt['changeposterid'] = 'Change Poster/Starter'
$txt['changeposteridno'] = 'Poster ID'
$txt['aeiou'] = 'AEIOU'
$txt['aeiou_title'] = 'Auto Email Inactive Ordinary Users'
$txt['aeiou_enable'] = 'Enable Automatic Emailing Of Inactive Users'
$txt['aeiou_email_desc1'] = 'Text-Only (No html, no bbcode)';
?>



Its an issue caused by your package manager, not installing the mod correctly. I think that there is no real reason why it happends, it just happens sometimes.

If you can't find that issue in the 'Modifications.{language}.php' files then try the other language files that the mod edits such as 'Index.{language}.php' files.
Title: Re: Language Drop Down
Post by: bran8464 on July 28, 2008, 06:23:42 AM
The modificationslanguage.php files only contain this code:

<?php
// Version: 1.1; Modifications
?>

nothing else, at least the one's I checked. And the 'Index.{language}.php' files seem ok with ?> at the end.
Title: Re: Language Drop Down
Post by: bran8464 on July 29, 2008, 05:12:49 AM
bump
Title: Re: Language Drop Down
Post by: FreeSporePrints on September 06, 2008, 05:59:41 AM
Dear SleePy,
from when i've upgraded SMF 1.1.4 to SMF 2.0 the laguage drop mod does not work anymore(and neither the entire forum).

It gives the error:

Quote
Fatal error: Call to undefined function languageDrop() in /home/freesee1/public_html/raclando/smf/Sources/Load.php(1857)

you can see with your eyes here: www.raclando.com

Thanks,
F.
Title: Re: Language Drop Down
Post by: Smoky "Rider" Blue on September 22, 2008, 11:33:16 PM
did you add:

// Generate the Language Drop Down..
function template_language_select()
{
global $context, $txt, $scripturl;

// Do the Function...
languageDrop();

// Hopefully We always have something to show for ourselves.
if (!empty ($context['languages']))
{
echo '
<form action="" method="post" class="smalltext" style="float: right;">
<select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';
foreach ($context['languages'] as $language)
echo '
<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';
echo '
</select><input type="hidden" name="changelang" value="1" />&nbsp;<noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';
}
// No languages we can find!
elseif (empty ($context['languages']))
echo 'LanguageDrop: ' . $txt[398];
// If this occurs we are in trouble.
else
echo 'LanguageDrop: ' . $txt[106];
}


right after:


if (empty($button_strip))
return '<td>&nbsp;</td>';

echo '
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_' , $context['right_to_left'] ? 'last' : 'first' , '">&nbsp;</td>
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_back">', implode(' &nbsp;|&nbsp; ', $button_strip) , '</td>
<td class="', $direction == 'top' ? 'main' : 'mirror', 'tab_' , $context['right_to_left'] ? 'first' : 'last' , '">&nbsp;</td>';
}


Title: Re: Language Drop Down
Post by: lobo777 on November 22, 2008, 10:32:25 PM
I love this mod but just changed my theme - and I do typically know a little about adding to the index.template.php file, and have also read your early suggestions on adding the code where you would like it, but honestly I have no clue where to insert it!  Would you be opposed to me PMing you on here and sending you my link and location of where I want it, as well as my index.template file?  If you want you can just copy and paste and explain where I would put it once you've seen my forum.  It would be MUCH appreciated, as my website is travel and backpacking related (multi-languages are handy!).  No worries if not!
Title: Re: Language Drop Down
Post by: SleePy on November 23, 2008, 10:38:53 AM
Which theme are you using?
Title: Re: Language Drop Down
Post by: lobo777 on November 23, 2008, 10:58:20 AM
I'm using Anecdota theme (by crip)... I would like to have it down in the bar with the buttons (but over to the right side of the page where there aren't any menu buttons).

Thanks for any help you can give!
Title: Re: Language Drop Down
Post by: SleePy on November 23, 2008, 03:41:10 PM
Alright.
If you open the Themes index.template.php

Find:
  </div>

  <div id="mainarea">


Add Before:
', template_language_select(), '

Make sure you add the other edit to the index.template.php as well. This one works on all themes :)
Title: Re: Language Drop Down
Post by: lobo777 on November 23, 2008, 04:03:56 PM
Thanks Sleepy!!  Much appreciated... awesome mod!
Title: Re: Language Drop Down
Post by: yosssi on December 03, 2008, 09:54:58 AM
Hello i install it and works ok in the default theme but i used other theme and dont look nother what you need for works in other theme?
Title: Re: Language Drop Down
Post by: SleePy on December 05, 2008, 09:05:22 PM
If you know a little on editing code it should be easy to do this.
You basically just need to have it output the code where you want it.
You do this by adding the required function to index.template.php. Then where you want it to display, you add a call to this function you added :)
Title: Re: Language Drop Down
Post by: Mraza on January 18, 2009, 09:01:34 AM
hello guys and thanks for this great language choices.. i am developing a forum with 1.7.7 version of smf and i just installed the Greek spanish and french languages , well i have the language drop down mod and i can choose the language which i want. the one thing i can't figure out i have installed an invite mod but when i will choose other language then english it will not be visible any more in the menu, only i can see the picture before to it but the word INVITE will gone. and the other thing is it possible that if i will select other language then english so the posts on my board will also convert to the other language?
thanks for any help
Title: Re: Language Drop Down
Post by: SleePy on January 20, 2009, 06:30:19 PM
This will not convert posts. This is simply the same language chooser that is in your profile. But at quick access for you and guests :)

If the words are disappearing after changing a language, then the mod you installed doesn't have language strings for that language. You need to ask the author of that mod what language strings you need to copy and to what language files. Most likely they are using the Modifications language file. So if you open the Modifications.english.php file and copy all the text strings into the Modifications.xxx.php (where xxx is the other languages) and add them into the other files, then this would fix it.
Title: Re: Language Drop Down
Post by: Cheese Head on February 15, 2009, 10:36:39 PM
Thanks for the Mod very useful, installed fine on SMF 2.0 RC1 using Default Theme.

Only question, why is the drop down menu soo tiny in the upper right corner of forum pages, hard to find and hard to read the drop down language names.

Thanks again!
Title: Re: Language Drop Down
Post by: SleePy on February 19, 2009, 05:34:53 PM
I did not add any css to style the size of the text. The location was the best one I could think of. You can choose your own and use css to change it up even more.
Title: Re: Language Drop Down
Post by: Cheese Head on February 28, 2009, 08:34:21 AM
Thanks SleePy, sadly I don't know where in the default css file to do that.
Title: Re: Language Drop Down
Post by: SleePy on March 02, 2009, 10:16:30 PM
You would add it to the style.css. You need to add your own.
Something such as this may work:

.smalltext #language_select
{
    font-size: x-large;
}
Title: Re: Language Drop Down
Post by: Cheese Head on March 08, 2009, 12:56:52 PM
SleePy, thanks, worked perfect!

I switched mine to small as X-large was way too big for me.

Thanks again!
Title: Re: Language Drop Down
Post by: tidus93 on April 10, 2009, 04:33:40 PM
Hello,

First thanks for this mod very useful  ;).
Then I just want to say (if that hadn't be said) that we must set up a default language to the forum before using this mod (Settings.php). If not, there is a lot of problem for user who come for the first time (who hasn't set up his language).
Title: Re: Language Drop Down
Post by: Privacy Blocked on April 25, 2009, 09:02:41 AM
Quote from: SleePy on November 23, 2008, 03:41:10 PM
Alright.
If you open the Themes index.template.php

Find:
  </div>

  <div id="mainarea">


Add Before:
', template_language_select(), '

Make sure you add the other edit to the index.template.php as well. This one works on all themes :)

hiii sleepy i got error in smf 1.1.8 in PSBlack Themes liker his

(http://i42.tinypic.com/2gsjpy1.jpg)

this iam attach my index.template.php and load.php

thanks
Title: Re: Language Drop Down
Post by: SleePy on April 25, 2009, 04:35:15 PM
Quote<b>Fatal error</b>:  Call to undefined function template_language_select() in <b>/home2/abghotco/public_html/smf/Sources/Load.php(1726) : eval()'d code</b> on line <b>213</b><br />

The index.template.php dosn't have the template function. Manually edit the index.template.php for your theme, and add in this function.
Title: Re: Language Drop Down
Post by: Privacy Blocked on April 25, 2009, 07:13:48 PM
Quote from: SleePy on April 25, 2009, 04:35:15 PM
Quote<b>Fatal error</b>:  Call to undefined function template_language_select() in <b>/home2/abghotco/public_html/smf/Sources/Load.php(1726) : eval()'d code</b> on line <b>213</b><br />

The index.template.php dosn't have the template function. Manually edit the index.template.php for your theme, and add in this function.

i don't know what u mean the code. can  u explain master ? sory i'm newbiez
Title: Re: Language Drop Down
Post by: SleePy on April 25, 2009, 09:43:00 PM
Add this the end of your custom themes index.template.php, just before the "?>".


// Generate the Language Drop Down..
function template_language_select()
{
    global $context, $txt, $scripturl;

    // Do the Function...
    languageDrop();

    // Hopefully We always have something to show for ourselves.
    if (!empty ($context['languages']))
    {
        echo '
            <form action="" method="post" class="smalltext" style="float: right;">
                <select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';
        foreach ($context['languages'] as $language)
            echo '
                    <option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';
        echo '
                </select><input type="hidden" name="changelang" value="1" />&nbsp;<noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';
    }
    // No languages we can find!
    elseif (empty ($context['languages']))
        echo 'LanguageDrop: ' . $txt[398];
    // If this occurs we are in trouble.
    else
        echo 'LanguageDrop: ' . $txt[106];
}

Title: Re: Language Drop Down
Post by: Privacy Blocked on April 25, 2009, 10:43:49 PM
Quote from: SleePy on April 25, 2009, 09:43:00 PM
Add this the end of your custom themes index.template.php, just before the "?>".


// Generate the Language Drop Down..
function template_language_select()
{
    global $context, $txt, $scripturl;

    // Do the Function...
    languageDrop();

    // Hopefully We always have something to show for ourselves.
    if (!empty ($context['languages']))
    {
        echo '
            <form action="" method="post" class="smalltext" style="float: right;">
                <select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';
        foreach ($context['languages'] as $language)
            echo '
                    <option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';
        echo '
                </select><input type="hidden" name="changelang" value="1" />&nbsp;<noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';
    }
    // No languages we can find!
    elseif (empty ($context['languages']))
        echo 'LanguageDrop: ' . $txt[398];
    // If this occurs we are in trouble.
    else
        echo 'LanguageDrop: ' . $txt[106];
}


./Themes/default/index.template.php

Find:

</td>';
echo '
<td class="titlebg2" align="right" nowrap="nowrap" valign="top">


Replace With:


</td>
<td class="titlebg2" nowrap="nowrap" valign="top">';
template_language_select();
echo '
</td>
<td class="titlebg2" align="right" nowrap="nowrap" valign="top">


in the top code i don't find the

</td>';
echo '
<td class="titlebg2" align="right" nowrap="nowrap" valign="top">



and i finish add the code

// Generate the Language Drop Down..
function template_language_select()
{
    global $context, $txt, $scripturl;

    // Do the Function...
    languageDrop();

    // Hopefully We always have something to show for ourselves.
    if (!empty ($context['languages']))
    {
        echo '
            <form action="" method="post" class="smalltext" style="float: right;">
                <select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';
        foreach ($context['languages'] as $language)
            echo '
                    <option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';
        echo '
                </select><input type="hidden" name="changelang" value="1" />&nbsp;<noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';
    }
    // No languages we can find!
    elseif (empty ($context['languages']))
        echo 'LanguageDrop: ' . $txt[398];
    // If this occurs we are in trouble.
    else
        echo 'LanguageDrop: ' . $txt[106];
}


but the same image like this

(http://i39.tinypic.com/33usryg.jpg)

please help and check my attachment

Title: Re: Language Drop Down
Post by: SleePy on April 26, 2009, 09:19:52 AM
Alright, you added it to the template and got rid of the error :)

Now you just need to pick the place in your theme and add in the call to the template.

Most likely you will just need to use:
', template_language_select(), '

That and add it in where you want it in your theme :)
Title: Re: Language Drop Down
Post by: MissyNL on June 23, 2009, 08:24:17 AM
I want to ask.. i am now installing a forum ... and i want to install youre  mod... :)

But... when it's uploaded, i get the text : There are no install actions defined..

it's for SMF 2... so i used version 3
Title: Re: Language Drop Down
Post by: KensonPlays on June 24, 2009, 01:21:38 AM
Quote from: billchopher on January 12, 2007, 03:07:08 AM
Hi, this would be great for my ESL site if I could get it to work for me! I am new to SMF and site building so this could be a simple question.
I have managed to upload the mod through the admin panel and have "aplied" it. Everything says "success" but there is no dropdown showing on the site?

I have the funtion for users to change their language in the profile area but I what a dropdown like the one on this forum. Can you tell me how?

I am having same problem, I have a different theme than default, do you have YOUR OWN DIFFERENT theme than default?
Hey, mod owner, what is coding for Efsane theme?
Title: Re: Language Drop Down
Post by: Daveyo on June 30, 2009, 08:04:59 AM
Sleepy

I installed your mod on version 1.1.9 and all I have is English showing up and none of the other languages.  sigh

No errors show up and it shows green as installed on my packages.

Why only English show up??  Am I missing something here.??

I downloaded it, to my computer, then uploaded on the package manager, and it was installed.  I see it on my default theme of which I also want my other members to use instead of using different themes.  So what did I do wrong or do I have to edict this mod.  If so where to find this file in the Cpanel and where to edict it properly.

Just covering all the basics here because I have no idea why only English work.  I uploaded as a tar zip file in the package manager.

Hope you can respond as this mod is much needed for others world wide to read my forum etc.

I am a newbie in all this so hopefully you can be gentle with me on questions and answers here as I cannot understand chinese!!!!  hehehehehehe.

Thanks

Daveyo
Title: Language Drop Down for 2.0 RC1-1
Post by: tkoenings on July 08, 2009, 07:57:43 AM
This could be very helpful for what I need, would like to try it, but have the drop down appear in the same div as the search box (aligned left) since I have removed the other section of the header where the drop down would normally be placed.

I tried to parse the newest version on the mod site to get the code but this throws an error (other versions parse).

I also tried to upload the package to my test forum but applying it throws an error as well, but could be because it can't find the section in index.template.php.

Would it be difficult to enable this inserting the code, and what are the instructions for manually enabling this? Here is my index.template.php:


</head>
<body>';
}

function template_body_above()
{
   global $context, $settings, $options, $scripturl, $txt, $modSettings;

   echo '

      
      <div id="news_section" class="titlebg2 clearfix"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
         <form class="floatright" id="search_form" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
            <a href="', $scripturl, '?action=search;advanced" title="', $txt['search_advanced'], '"><img id="advsearch" src="'.$settings['images_url'].'/filter.gif" align="middle" alt="', $txt['search_advanced'], '" /></a>
            <input type="text" name="search" value="" style="width: 190px;" />&nbsp;
            <input type="submit" name="submit" value="', $txt['search'], '" style="width: 11ex;" />
            <input type="hidden" name="advanced" value="0" />';

   // Search within current topic?
   if (!empty($context['current_topic']))
      echo '
            <input type="hidden" name="topic" value="', $context['current_topic'], '" />';
      // If we're on a certain board, limit it to this board ;).
   elseif (!empty($context['current_board']))
      echo '
            <input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

   echo '
         </form>';

   // Show a random news item? (or you could pick one from news_lines...)
   if (!empty($settings['enable_news']))
      echo '
         <div id="random_news"><h3>', $txt['news'], ':</h3><p>', $context['random_news_line'], '</p></div>';

   echo '
      </div>
   </div>';


   // Show the menu here, according to the menu sub template.
   template_menu();

   // Show the navigation tree.
   theme_linktree();

   // The main content should go here.
   echo '
   <div id="bodyarea">';
}

function template_body_below()
{
   global $context, $settings, $options, $scripturl, $txt;

   echo '
   </div>';

   // Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
   echo '
   <div id="footerarea" class="headerpadding topmargin clearfix">
      <ul class="smalltext">
         <li class="copywrite">', !empty($settings['custom_copyright']) ? '<span class="smalltext">'. parse_bbc($settings['custom_copyright']). '</span>' : '', '<br />
                  ', theme_copyright(), '
</li>
         <li><a id="button_xhtml" href="http://validator.w3.org/check/referer" target="_blank" class="new_win" title="', $txt['valid_xhtml'], '"><span>XHTML</span></a></li>
         <li><a id="button_rss" href="', $scripturl , '?type=rss;action=.xml" class="new_win"><span>RSS</span></a></li>
         <li class="last"><a id="button_wap2" href="', $scripturl , '?wap2" class="new_win"><span>WAP2</span></a></li>
      </ul>';

   // Show the load time?
   if ($context['show_load_time'])
      echo '
      <p class="smalltext" id="show_loadtime">', $txt['page_created'], $context['load_time'], $txt['seconds_with'], $context['load_queries'], $txt['queries'], '</p>';

   echo '
   </div>
</div>';
}

function template_html_below()
{
   global $context, $settings, $options, $scripturl, $txt, $modSettings;

   echo '
</body></html>';
}

// Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree($force_show = false)
{
   global $context, $settings, $options, $shown_linktree;

   // If linktree is empty, just return - also allow an override.
   if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show))
      return;

   //!!! Temporarily don't do it twice.
   if (!empty($shown_linktree))
      return;
   $shown_linktree = true;

   echo '
   <ul id="linktree">';

   // Each tree item has a URL and name. Some may have extra_before and extra_after.
   foreach ($context['linktree'] as $link_num => $tree)
   {
      echo '
      <li', ($link_num == count($context['linktree']) - 1) ? ' class="last"' : '', '>';
      // Show something before the link?
      if (isset($tree['extra_before']))
         echo $tree['extra_before'];

      // Show the link, including a URL if it should have one.
      echo $settings['linktree_link'] && isset($tree['url']) ? '
         <a href="' . $tree['url'] . '"><span>' . $tree['name'] . '</span></a>' : '<span>' . $tree['name'] .'</span>';

      // Show something after the link...?
      if (isset($tree['extra_after']))
         echo $tree['extra_after'];

      // Don't show a separator for the last one.
      if ($link_num != count($context['linktree']) - 1)
         echo '&nbsp;>';

      echo '
      </li>';
   }
   echo '
   </ul>';
}

// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
   global $context, $settings, $options, $scripturl, $txt;

   echo '
   <div id="main_menu">
      <ul class="clearfix">';

   foreach ($context['menu_buttons'] as $act => $button)
   {
      $classes = array();
      if (!empty($button['active_button']))
         $classes[] = 'active';
      if (!empty($button['is_last']))
         $classes[] = 'last';
      $classes = implode(' ', $classes);
      
      echo '
         <li id="button_', $act, '"', !empty($classes) ? ' class="' . $classes . '"' : '', '>
            <a title="', $act, '" href="', $button['href'], '">
               <span>', ($button['active_button'] ? '<em>' : ''), $button['title'], ($button['active_button'] ? '</em>' : ''), '</span>
            </a>
         </li>';
   }

   echo '
      </ul>
   </div>';
}

// Generate a strip of buttons.
function template_button_strip($button_strip, $direction = 'top', $custom_td = '')
{
   global $settings, $context, $txt, $scripturl;

   // Create the buttons...
   $buttons = array();
   foreach ($button_strip as $key => $value)
      if (!isset($value['test']) || !empty($context[$value['test']]))
         $buttons[] = '<a href="' . $value['url'] . '"' . (isset($value['active']) ? ' class="active"' : '') . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '><span>' . $txt[$value['text']] . '</span></a>';

   if (empty($buttons))
      return '';

   // Make the last one, as easy as possible.
   $buttons[count($buttons) - 1] = str_replace('<span>', '<span class="last">', $buttons[count($buttons) - 1]);

   echo '
      <div class="buttonlist', $direction != 'top' ? '_bottom' : '', '">
         <ul class="clearfix">
            <li>', implode('</li><li>', $buttons), '</li>
         </ul>
      </div>';
}

?>
Title: Re: Language Drop Down
Post by: Daveyo on July 15, 2009, 08:47:31 AM
Sleepy

Got a question to ask you.  Why doesn't the Slovenian Mod not work.  It is on the language drop down menu, but it does not do a thing to the forum to show the language being changed.

Is there something wrong with that mod or what.

I got all the others working fine. 

Also how to get the post pages or information to the specific languages so that people can read it in their language.  Is this possible or not.



Daveyo
Title: Re: Language Drop Down
Post by: Akyhne on July 27, 2009, 08:37:57 AM
This doesn't install in SMF1.1.10, although the code says:
<install for="1.1.2-1.1.99">
I tested it in several forums.
Title: Re: Language Drop Down
Post by: agridoc on August 07, 2009, 06:20:11 AM
I suggested the mod in a topic in Greek support board (http://www.simplemachines.org/community/index.php?topic=328163.msg2194120#msg2194120) and the answer was that it doesn't install in SMF 1.1.10.

I searched a bit and found that

<install for="1.1.2-1.1.99">
Works with 1.1.9 not with 1.110

However
<install for="1.1.1-1.1.99">
as well as
<install for="1.1.2, 1.1.10">
work OK with SMF 1.1.10

So it's rather a small bug in SMF 1.1.10.
Title: Re: Language Drop Down
Post by: kimnue on September 09, 2009, 12:42:57 PM
hi i really wanna make my smf has 2 language
This is my web

i used theme ds-natural and i instll SMF version 1.1.10

this is my web
http://www.hms-agent.co.cc/


it cannot appy mod . Can anyone helpme ? DO i have to modified manually.?

Newbies on this

Thank
Title: Re: Language Drop Down
Post by: Akyhne on September 09, 2009, 01:06:11 PM
Quote from: kimnue on September 09, 2009, 12:42:57 PM
hi i really wanna make my smf has 2 language
This is my web

i used theme ds-natural and i instll SMF version 1.1.10

this is my web
http://www.hms-agent.co.cc/


it cannot appy mod . Can anyone helpme ? DO i have to modified manually.?

Newbies on this

Thank
Quote from: agridoc on August 07, 2009, 06:20:11 AM
I suggested the mod in a topic in Greek support board (http://www.simplemachines.org/community/index.php?topic=328163.msg2194120#msg2194120) and the answer was that it doesn't install in SMF 1.1.10.

I searched a bit and found that

<install for="1.1.2-1.1.99">
Works with 1.1.9 not with 1.110

However
<install for="1.1.1-1.1.99">
as well as
<install for="1.1.2, 1.1.10">
work OK with SMF 1.1.10

So it's rather a small bug in SMF 1.1.10.
Title: Re: Language Drop Down
Post by: SleePy on September 09, 2009, 10:45:09 PM
Also adding ;version_emulate=1.1.9 to the end of the url, will make package manager think it is running a older version of SMF and allow you to install the mod.
Title: Re: Language Drop Down
Post by: agridoc on September 09, 2009, 10:56:54 PM
If I remember well, I tried it and didn't work. The cause is that the bug in 1.1.10 interferes in version range parsing.
Title: Re: Language Drop Down
Post by: Daveyo on September 10, 2009, 01:44:57 AM
Hi

Interesting to know there is a bug in 1.1.10.  Ok if so, we would like for you guys to come up with the fix so I myself can use my Slovenian Package and others can use the other mods as well.  We need someone to take this problem a step up and get it resolved and fixed and send a patch out to everybody.

Please if you guys can lets get it fixed.

Thanks

Daveyo
Title: Re: Language Drop Down
Post by: Akyhne on September 10, 2009, 06:52:22 AM
These are the combinations other people used in the packages I have installed in my forums:
<install for="1.1.0-1.1.10">
.. and
<install for="1.1-1.1.10">

Tiny Portal used
<install for="1.1, 1.1.1-1.1.99">
.. which also works.
Title: Re: Language Drop Down
Post by: kimnue on September 10, 2009, 07:07:16 AM
so which file that i have to change into

<install for="1.1-1.1.10">

thank ;D
Title: Re: Language Drop Down
Post by: Akyhne on September 10, 2009, 07:16:03 AM
package-info.xml in the package of the mod.

I think the problem is this (without checking the code of SMF):
1.1.2 is actually a higher number as 1.1.10, so versions from 1.1.20 to 1.1.99 will probably go through, while 1.1.10-1.1.19 won't.

So when the author uses <install for="1.1.2-1.1.10"> people get into trouble.
Title: Re: Language Drop Down
Post by: Arantor on September 10, 2009, 07:28:12 AM
Yup, that's the problem since 2 > 1 (it doesn't cast to a number). The reason for this is because of non numeric versions, e.g. 2.0 RC1, which cannot be cast to an integer.

1.1 - 1.1.99 will work fine; this is what I use in my mods.

Also note you can install this mod (http://custom.simplemachines.org/mods/index.php?mod=2113), which you can use to override the version number used in the package manager.
Title: Re: Language Drop Down
Post by: Sabre™ on October 08, 2009, 01:34:59 PM
Nice mod.
Cheers :)
Title: Re: Language Drop Down
Post by: Afro on October 17, 2009, 01:07:23 PM
the language select window is small, how do i make it big
Title: Re: Language Drop Down
Post by: SleePy on October 18, 2009, 06:05:19 PM
To do that, you just need to change the html for it in the index template.
Title: Re: Language Drop Down
Post by: Afro on October 19, 2009, 12:12:28 PM
Ok, I will work on that
Title: Re: Language Drop Down question
Post by: Andre N on October 29, 2009, 07:50:11 PM
I like this mod a lot. I recently added it to this site: http://www.xtremelean.us (http://www.xtremelean.us)
but I modified it to use images as buttons to select the language rather than a drop down box. The code I used looks like this:
function template_language_select2()
{
global $context, $txt, $settings, $scripturl;

// Do the Function...
languageDrop();

{
echo '
<form action="" method="post">

<input
   type="image"
   src="'.$settings['images_url'].'/usflag.gif"
   name="language"
   alt="English"
   value="english"
   onclick="this.form.submit(); " >
<input
   type="image"
   src="'.$settings['images_url'].'/mxflag.gif"
      name="language"
   alt="Spanish"
   value="spanish_es"
  onclick="this.form.submit(); " >

<input type="hidden" name="changelang" value="1" /> <noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';
}
// No languages we can find!
}
template_language_select2();


It works great in Firefox, but it doesn't work at all in IE and I can't figure out why. When you click one of the images in IE it just reloads the current page with no change to the language.  Anyone know what I am doing wrong?
Thanks for the mod!  :)
Title: Re: Language Drop Down
Post by: SleePy on October 30, 2009, 10:50:01 PM
If I remember right, IE doesn't support the usage of input you are trying to use.  I believe that a type of image is non standard.
Title: Re: Language Drop Down
Post by: Andre N on November 01, 2009, 11:53:31 PM
Yeah, you're right about that. I found a workaround though. It works like this:
function template_language_select2()
{
global $context, $txt, $settings, $scripturl;

// Do the Function...
languageDrop();

{
echo '
<form name="english" style="display:inline;">
<input
   type="hidden"
   name="language"
   value="english">
<input
   type="hidden"
   name="changelang"
   value="1" />
<a href="javascript:" onclick="document.english.submit()"><img border=0 src="'.$settings['images_url'].'/usflag.gif" alt="English"></a>
</form>
<form name="spanish" style="display:inline;">
<input
   type="hidden"
   name="language"
   value="spanish_es">
<input
   type="hidden"
   name="changelang"
   value="1" />
<a href="javascript:" onclick="document.spanish.submit()"><img border=0 src="'.$settings['images_url'].'/mxflag.gif" alt="Spanish"></a>
</form>';
}
// No languages we can find!
}
template_language_select2();
Title: Re: Language Drop Down
Post by: kai920 on November 10, 2009, 11:27:48 PM
I got an error when trying to upload LanguageDropV1.5.tgz through package manager. (see attached)

But if I manually extract and upload via FTP to /packages, I was able to install it.
Title: Re: Language Drop Down
Post by: leonpadi on November 22, 2009, 05:49:28 AM
Hello !
I would like to kindly ask instructions of how can i add this great add-on to a custom theme.
I started by adding this code...

// Generate the Language Drop Down..
function template_language_select()
{
    global $context, $txt, $scripturl;

    // Do the Function...
    languageDrop();

    // Hopefully We always have something to show for ourselves.
    if (!empty ($context['languages']))
    {
        echo '
            <form action="" method="post" class="smalltext" style="float: right;">
                <select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';
        foreach ($context['languages'] as $language)
            echo '
                    <option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';
        echo '
                </select><input type="hidden" name="changelang" value="1" />&nbsp;<noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';
    }
    // No languages we can find!
    elseif (empty ($context['languages']))
        echo 'LanguageDrop: ' . $txt[398];
    // If this occurs we are in trouble.
    else
        echo 'LanguageDrop: ' . $txt[106];
}

just before "?>" at the custom's theme index.template.php
Now what else do i miss... ? :)
Title: Re: Language Drop Down
Post by: Arantor on November 22, 2009, 05:55:26 AM
The other edit to do on a custom theme is:

Code (find) Select
</td>';
echo '
<td class="titlebg2" align="right" nowrap="nowrap" valign="top">


Code (replace) Select
</td>
<td class="titlebg2" nowrap="nowrap" valign="top">';
template_language_select();
echo '
</td>
<td class="titlebg2" align="right" nowrap="nowrap" valign="top">
Title: Re: Language Drop Down
Post by: leonpadi on November 22, 2009, 05:59:16 AM
Sorry but i can't find the code that needs to be replaced, there is nowhere in the custom theme this code...

<td class="titlebg2" align="right" nowrap="nowrap" valign="top">

Do i have to add the replaced text manually and if yes, then where and in which file of my custom theme ?

Thank you very much for your time dear Arantor :)
Title: Re: Language Drop Down
Post by: Arantor on November 22, 2009, 06:01:08 AM
No, you need to work out where the template you'd add the dropdown and alter the code. Without knowing where you wanted it and without seeing the code of your index.template.php file I can't possibly help.
Title: Re: Language Drop Down
Post by: leonpadi on November 22, 2009, 02:32:16 PM
Okey, since i didn't managed it to work i copy-paste here the code from index.template from the custom theme i use.
Theme's name : BlackRain v2

<?php
// Version: 2.0 RC2; index

/* This template is, perhaps, the most important template in the theme. It
contains the main template layer that displays the header and footer of
the forum, namely with main_above and main_below. It also contains the
menu sub template, which appropriately displays the menu; the init sub
template, which is there to set the theme up; (init can be missing.) and
the linktree sub template, which sorts out the link tree.

The init sub template should load any data and set any hardcoded options.

The main_above sub template is what is shown above the main content, and
should contain anything that should be shown up there.

The main_below sub template, conversely, is shown after the main content.
It should probably contain the copyright statement and some other things.

The linktree sub template should display the link tree, using the data
in the $context['linktree'] variable.

The menu sub template should display all the relevant buttons the user
wants and or needs.

For more information on the templating system, please see the site at:
http://www.simplemachines.org/
*/


// Initialize the template... mainly little settings.
function template_init()
{
global $context$settings$options$txt;

/* Use images from default theme when using templates from the default theme?
if this is 'always', images from the default theme will be used.
if this is 'defaults', images from the default theme will only be used with default templates.
if this is 'never' or isn't set at all, images from the default theme will not be used. */
$settings['use_default_images'] = 'never';

/* What document type definition is being used? (for font size and other issues.)
'xhtml' for an XHTML 1.0 document type definition.
'html' for an HTML 4.01 document type definition. */
$settings['doctype'] = 'xhtml';

/* The version this template/theme is for.
This should probably be the version of SMF it was created for. */
$settings['theme_version'] = '2.0 RC2';

/* Set a setting that tells the theme that it can render the tabs. */
$settings['use_tabs'] = true;

/* Use plain buttons - as opposed to text buttons? */
$settings['use_buttons'] = true;

/* Show sticky and lock status separate from topic icons? */
$settings['separate_sticky_lock'] = true;

/* Does this theme use the strict doctype? */
$settings['strict_doctype'] = false;

/* Does this theme use post previews on the message index? */
$settings['message_index_preview'] = false;

/* Set the following variable to true if this theme requires the optional theme strings file to be loaded. */
$settings['require_theme_strings'] = false;
}

// The main sub template above the content.
function template_html_above()
{
global $context$settings$options$scripturl$txt$modSettings;

// Show right to left and the character set for ease of translating.
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"'
$context['right_to_left'] ? ' dir="rtl"' '''><head>
<meta http-equiv="Content-Type" content="text/html; charset='
$context['character_set'], '" />
<meta name="description" content="'
$context['page_title_html_safe'], '" />
<meta name="keywords" content="'
$context['meta_keywords'], '" />
<title>'
$context['page_title_html_safe'], '</title>';

// Please don't index these Mr Robot.
if (!empty($context['robot_no_index']))
echo '
<meta name="robots" content="noindex" />'
;

// Present a canonical url for search engines to prevent duplicate content in their indices.
if (!empty($context['canonical_url']))
echo '
<link rel="canonical" href="'
$context['canonical_url'], '" />';

// The ?rc2 part of this link is just here to make sure browsers don't cache it wrongly.
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['theme_url'], '/css/index'$context['theme_variant'], '.css?rc2" />
<link rel="stylesheet" type="text/css" href="'
$settings['default_theme_url'], '/css/print.css?rc2" media="print" />';

// Show all the relative links, such as help, search, contents, and the like.
echo '
<link rel="help" href="'
$scripturl'?action=help" />
<link rel="search" href="' 
$scripturl '?action=search" />
<link rel="contents" href="'
$scripturl'" />';

// If RSS feeds are enabled, advertise the presence of one.
if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']))
echo '
<link rel="alternate" type="application/rss+xml" title="'
$context['forum_name_html_safe'], ' - '$txt['rss'], '" href="'$scripturl'?type=rss;action=.xml" />';

// If we're viewing a topic, these should be the previous and next topics, respectively.
if (!empty($context['current_topic']))
echo '
<link rel="prev" href="'
$scripturl'?topic='$context['current_topic'], '.0;prev_next=prev" />
<link rel="next" href="'
$scripturl'?topic='$context['current_topic'], '.0;prev_next=next" />';

// If we're in a board, or a topic for that matter, the index will be the board's index.
if (!empty($context['current_board']))
echo '
<link rel="index" href="'
$scripturl'?board='$context['current_board'], '.0" />';

// We'll have to use the cookie to remember the header...
if ($context['user']['is_guest'])
{
$options['collapse_header'] = !empty($_COOKIE['upshrink']);
$options['collapse_header_ic'] = !empty($_COOKIE['upshrinkIC']);
}

// Some browsers need an extra stylesheet due to bugs/compatibility issues.
foreach (array('ie7''ie6''firefox''webkit') as $cssfix)
if ($context['browser']['is_' $cssfix])
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['theme_url'], '/css/'$cssfix'.css" />';

// RTL languages require an additional stylesheet.
if ($context['right_to_left'])
echo '
<link rel="stylesheet" type="text/css" href="'
$settings['theme_url'], '/css/rtl.css" />';

echo '
<script type="text/javascript" src="'
$settings['default_theme_url'], '/scripts/script.js?rc2"></script>
<script type="text/javascript" src="'
$settings['theme_url'], '/scripts/theme.js?rc2"></script>
<script type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "'
$settings['theme_url'], '";
var smf_default_theme_url = "'
$settings['default_theme_url'], '";
var smf_images_url = "'
$settings['images_url'], '";
var smf_scripturl = "'
$scripturl'";
var smf_iso_case_folding = '
$context['server']['iso_case_folding'] ? 'true' 'false'';
var smf_charset = "'
$context['character_set'], '";'$context['show_pm_popup'] ? '
var fPmPopup = function ()
{
if (confirm("' 
$txt['show_personal_messages'] . '"))
window.open(smf_prepareScriptUrl(smf_scripturl) + "action=pm");
}
addLoadEvent(fPmPopup);' 
'''
var ajax_notification_text = "'
$txt['ajax_in_progress'], '";
var ajax_notification_cancel_text = "'
$txt['modify_cancel'], '";
// ]]></script>'
;

// Output any remaining HTML headers. (from mods, maybe?)
echo $context['html_headers'];

echo '
</head>
<body>'
;
}



function 
template_body_above()
{
global $context$settings$options$scripturl$txt$modSettings;

echo '
<div id="mainframe"'
, !empty($settings['forum_width']) ? ' style="width: ' $settings['forum_width'] . '"' '''>
<div id="ob1">
<div id="ib1">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center"><a href="'
.$scripturl.'" title="'$context['forum_name'], '"><img src="'$settings['images_url'], '/myslogan.gif" style="margin: 2px;" alt="'$context['forum_name'], '" /></a>
 </td>
 
 </tr>
 </table>
<div class="tborder">
<div class="catbg">
<img class="floatright" id="smflogo" src="'
$settings['images_url'], '/smflogo.gif" alt="Simple Machines Forum" />
<h1 id="forum_name">'
;
if (empty($settings['header_logo_url']))
echo $context['forum_name_html_safe'];
else
echo '
<img src="'
$settings['header_logo_url'], '" alt="'$context['forum_name_html_safe'], '" />';

echo '
</h1>
</div>'
;

// Display user name and time.


echo '


<ul id="greeting_section" class="reset titlebg2">
<li id="time" class="smalltext floatright">
'
$context['current_time'], '
<img id="upshrink" src="'
$settings['images_url'], '/upshrink.gif" alt="*" title="'$txt['upshrink_description'], '" align="bottom" style="display: none;" />
</li>'
;

if ($context['user']['is_logged'])
echo '
<li id="name">'
$txt['hello_member'], ' <em>'$context['user']['name'], '</em></li>';
else
echo '
<li id="name">'
$txt['hello_guest'], ' <em>'$txt['guest'], '</em></li>';

echo '
</ul>'
;

if ($context['user']['is_logged'] || !empty($context['show_login_bar']))

echo '
<div id="user_section" class="bordercolor"'
, empty($options['collapse_header']) ? '' ' style="display: none;"''>
<div class="floatright">'
template_language_select(), '</div>
<div class="windowbg2 clearfix">'
;

echo '
<div id="user_section" class="bordercolor"'
, empty($options['collapse_header']) ? '' ' style="display: none;"''>
<div class="windowbg2 clearfix">'
;

if (!empty($context['user']['avatar']))
echo '
<div id="myavatar">'
$context['user']['avatar']['image'], '</div>';

// If the user is logged in, display stuff like their name, new messages, etc.
if ($context['user']['is_logged'])
{
echo '
<ul class="reset">
<li><a href="'
$scripturl'?action=unread">'$txt['unread_since_visit'], '</a></li>
<li><a href="'
$scripturl'?action=unreadreplies">'$txt['show_unread_replies'], '</a></li>';

// Is the forum in maintenance mode?
if ($context['in_maintenance'] && $context['user']['is_admin'])
echo '
<li class="notice">'
$txt['maintain_mode_on'], '</li>';

// Are there any members waiting for approval?
if (!empty($context['unapproved_members']))
echo '
<li>'
$context['unapproved_members'] == $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="'$scripturl'?action=admin;area=viewmembers;sa=browse;type=approve">'$context['unapproved_members'] == $txt['approve_member'] : $context['unapproved_members'] . ' ' $txt['approve_members'], '</a> '$txt['approve_members_waiting'], '</li>';

// Show the total time logged in?
if (!empty($context['user']['total_time_logged_in']))
{
echo '
<li>'
$txt['totalTimeLogged1'];

// If days is just zero, don't bother to show it.
if ($context['user']['total_time_logged_in']['days'] > 0)
echo $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];

// Same with hours - only show it if it's above zero.
if ($context['user']['total_time_logged_in']['hours'] > 0)
echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];

// But, let's always show minutes - Time wasted here: 0 minutes ;).
echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '
</li>'
;
}

if (!empty($context['open_mod_reports']) && $context['show_open_reports'])
echo '
<li><a href="'
$scripturl'?action=moderate;area=reports">'sprintf($txt['mod_reports_waiting'], $context['open_mod_reports']), '</a></li>';
echo '
</ul>'
;
}
// Otherwise they're a guest - this time ask them to either register or login - lazy bums...
elseif (!empty($context['show_login_bar']))
{
echo '
<script type="text/javascript" src="'
$settings['default_theme_url'], '/scripts/sha1.js"></script>
<form class="windowbg" id="guest_form" action="'
$scripturl'?action=login2" method="post" accept-charset="'$context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' $context['session_id'] . '\');"' '''>
'
$txt['login_or_register'], '<br />
<input type="text" name="user" size="10" class="input_text" />
<input type="password" name="passwrd" size="10" class="input_password" />
<select name="cookielength">
<option value="60">'
$txt['one_hour'], '</option>
<option value="1440">'
$txt['one_day'], '</option>
<option value="10080">'
$txt['one_week'], '</option>
<option value="43200">'
$txt['one_month'], '</option>
<option value="-1" selected="selected">'
$txt['forever'], '</option>
</select>
<input type="submit" value="'
$txt['login'], '" class="button_submit" /><br />
'
$txt['quick_login_dec'];

if (!empty($modSettings['enableOpenID']))
echo'
<br />
<input type="text" name="openid_identifier" id="openid_url" size="25" class="input_text openid_login" />'
;

echo '
<input type="hidden" name="hash_passwrd" value="" />
</form>'
;
}

if ($context['user']['is_logged'] || !empty($context['show_login_bar']))
echo '
</div>
</div>'
;

echo '
<div id="news_section" class="titlebg2 clearfix"'
, empty($options['collapse_header']) ? '' ' style="display: none;"''>
<form class="floatright" id="search_form" action="'
$scripturl'?action=search2" method="post" accept-charset="'$context['character_set'], '">
<a href="'
$scripturl'?action=search;advanced" title="'$txt['search_advanced'], '"><img id="advsearch" src="'.$settings['images_url'].'/filter.gif" align="middle" alt="'$txt['search_advanced'], '" /></a>
<input type="text" name="search" value="" style="width: 140px;" class="input_text" />&nbsp;
<input type="submit" name="submit" value="'
$txt['search'], '" style="width: 11ex;" class="button_submit" />
<input type="hidden" name="advanced" value="0" />'
;

// Search within current topic?
if (!empty($context['current_topic']))
echo '
<input type="hidden" name="topic" value="'
$context['current_topic'], '" />';
// If we're on a certain board, limit it to this board ;).
elseif (!empty($context['current_board']))
echo '
<input type="hidden" name="brd['
$context['current_board'], ']" value="'$context['current_board'], '" />';

echo '
</form>'
;

// Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']))
echo '
<div id="random_news"><h3>'
$txt['news'], ':</h3><p>'$context['random_news_line'], '</p></div>';

echo '
</div>
</div>'
;

// Define the upper_section toggle in JavaScript.
echo '
<script type="text/javascript"><!-- // --><![CDATA[
var oMainHeaderToggle = new smc_Toggle({
bToggleEnabled: true,
bCurrentlyCollapsed: '
, empty($options['collapse_header']) ? 'false' 'true'',
aSwappableContainers: [
\'user_section\',
\'news_section\'
],
aSwapImages: [
{
sId: \'upshrink\',
srcExpanded: smf_images_url + \'/upshrink.gif\',
altExpanded: '
JavaScriptEscape($txt['upshrink_description']), ',
srcCollapsed: smf_images_url + \'/upshrink2.gif\',
altCollapsed: '
JavaScriptEscape($txt['upshrink_description']), '
}
],
oThemeOptions: {
bUseThemeSettings: '
$context['user']['is_guest'] ? 'false' 'true'',
sOptionName: \'collapse_header\',
sSessionVar: '
JavaScriptEscape($context['session_var']), ',
sSessionId: '
JavaScriptEscape($context['session_id']), '
},
oCookieOptions: {
bUseCookie: '
$context['user']['is_guest'] ? 'true' 'false'',
sCookieName: \'upshrink\'
}
});
// ]]></script>'
;

// Show the menu here, according to the menu sub template.
template_menu();

// The main content should go here.
echo '
<div id="bodyarea">'
;
theme_linktree2();
}

function 
template_body_below()
{
global $context$settings$options$scripturl$txt$modSettings;

echo '
</div>'
;

// Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
echo '
<div id="footerarea" class="headerpadding topmargin clearfix">
<ul class="reset smalltext">
<li class="copywrite">'
theme_copyright(), '</li>
<li><small>BlackRain V2 2009, by <a href="http://www.jpr62.com" title="" target="_blank">Crip</a></small></li>
<li><a id="button_xhtml" href="http://validator.w3.org/check/referer" target="_blank" class="new_win" title="'
$txt['valid_xhtml'], '"><small>'$txt['xhtml'], '</small></a></li>
'
, !empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']) ? '<li><a id="button_rss" href="' $scripturl '?action=.xml;type=rss" class="new_win"><small>' $txt['rss'] . '</small></a></li>' '''
<li class="last"><a id="button_wap2" href="'
$scripturl '?wap2" class="new_win"><small>'$txt['wap2'], '</small></a></li>
</ul>'
;

// Show the load time?
if ($context['show_load_time'])
echo '
<p class="smalltext" id="show_loadtime">'
$txt['page_created'], $context['load_time'], $txt['seconds_with'], $context['load_queries'], $txt['queries'], '</p>';

echo '
</div>
</div>'
;
}

function 
template_html_below()
{
global $context$settings$options$scripturl$txt$modSettings;

echo '
  </div>
</div>
</body></html>'
;
}

// Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree2()
{
global $context$settings$options;

echo '
 <div id="linktree">'
;

// Each tree item has a URL and name. Some may have extra_before and extra_after.
foreach ($context['linktree'] as $link_num => $tree)
{
// Show something before the link?
if (isset($tree['extra_before']))
echo $tree['extra_before'];

// Show the link, including a URL if it should have one.
echo $settings['linktree_link'] && isset($tree['url']) ? '<a href="' $tree['url'] . '">' $tree['name'] . '</a>' $tree['name'];

// Show something after the link...?
if (isset($tree['extra_after']))
echo $tree['extra_after'];

// Don't show a separator for the last one.
if ($link_num != count($context['linktree']) - 1)
echo '&nbsp;&#38;#187;&nbsp;';
}
echo '
</div>'
;
}

function 
theme_linktree()
{
return;
}

// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
global $context$settings$options$scripturl$txt;
echo '
<div id="tabs6">
 <ul>'
;
  foreach ($context['menu_buttons'] as $act => $button)
echo '<li><a '$button['active_button'] ? ' class="current"' '' ' href="'$button['href'], '"><span>'$button['title'], '</span></a></li>';

echo '
</ul>
 </div>'
;
}

// Generate a strip of buttons.
function template_button_strip($button_strip$direction 'top'$strip_options = array())
{
global $settings$context$txt$scripturl;

if (!is_array($strip_options))
$strip_options = array();

// Right to left menu should be in reverse order.
if ($context['right_to_left'])
$button_strip array_reverse($button_striptrue);

// Create the buttons...
$buttons = array();
foreach ($button_strip as $key => $value)
if (!isset($value['test']) || !empty($context[$value['test']]))
$buttons[] = '<li' . (isset($value['active']) ? ' class="active"' '') . '><a href="' $value['url'] . '"' . (isset($value['custom']) ? ' ' $value['custom'] : '') . '><span>' . (isset($value['active']) ? '<em>' '') . $txt[$value['text']] . (isset($value['active']) ? '</em>' '') . '</span></a></li>';

if (!empty($buttons))
{
// Make the last one, as easy as possible.
$list_item = array('<li>','<li class="active">');
$active_item = array('<li class="last">','<li class="active last">');

$buttons[count($buttons) - 1] = str_replace($list_item$active_item$buttons[count($buttons) - 1]);
}

echo '
<div class="buttonlist'
$direction != 'top' '_bottom' '''"', (empty($buttons) ? ' style="display: none;"' ''), (!empty($strip_options['id']) ? ' id="' $strip_options['id'] . '"'''), '>
<ul class="reset clearfix">
'
implode(''$buttons), '
</ul>
</div>'
;
}




// Generate the Language Drop Down..
function template_language_select()
{
    global 
$context$txt$scripturl;

    
// Do the Function...
    
languageDrop();

    
// Hopefully We always have something to show for ourselves.
    
if (!empty ($context['languages']))
    {
        echo 
'
            <form action="" method="post" class="smalltext" style="float: right;">
                <select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">'
;
        foreach (
$context['languages'] as $language)
            echo 
'
                    <option value="'
$language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' '''>'$language['name'], '</option>';
        echo 
'
                </select><input type="hidden" name="changelang" value="1" />&nbsp;<noscript><input type="submit" value="'
$txt['quick_mod_go'], '" /></noscript></form>';
    }
    
// No languages we can find!
    
elseif (empty ($context['languages']))
        echo 
'LanguageDrop: ' $txt[398];
    
// If this occurs we are in trouble.
    
else
        echo 
'LanguageDrop: ' $txt[106];
}



?>



I would like to see this drop-down menu at the same place (upper left on the user's notification area) where it is shown on the default theme - in which it works perfectly.
Title: Re: Language Drop Down
Post by: Arantor on November 22, 2009, 02:35:55 PM
It's installed in that code.

if ($context['user']['is_logged'] || !empty($context['show_login_bar']))

echo '
<div id="user_section" class="bordercolor"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
<div class="floatright">', template_language_select(), '</div>
<div class="windowbg2 clearfix">';

echo '
<div id="user_section" class="bordercolor"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
<div class="windowbg2 clearfix">';


I think you have an extra echo you're not meant to have though.  (You didn't tell me you were using 2.0 RC2 so I didn't originally give you the 2.0 RC2 install instructions!)

Is the header collapsed?
Title: Re: Language Drop Down
Post by: leonpadi on November 22, 2009, 03:08:24 PM
This is a screenshot...
(http://img696.imageshack.us/img696/817/blackrainv2.jpg)
so...i suppose the header is collapsible...
In this screenshot i DONT have added any code, it's the default for Smf 2 rc2 ...
Edited - > Please Refresh, as the imageshack servers were down instantly, now should be ok...
http://img696.imageshack.us/img696/817/blackrainv2.jpg
Title: Re: Language Drop Down
Post by: Arantor on November 22, 2009, 03:10:47 PM
The screenshot doesn't appear to me :-/
Title: Re: Language Drop Down
Post by: Arantor on November 22, 2009, 03:17:44 PM
Well, in the file you posted, the code that calls the template IS listed. I even showed you the area in the code that it was listed in.

If you turn on "quick login on every page" it'll display for guests, which it won't do right now I believe, if I read the code correctly.
Title: Re: Language Drop Down
Post by: leonpadi on November 22, 2009, 03:26:09 PM
Quote from: Arantor on November 22, 2009, 02:35:55 PM
It's installed in that code.

if ($context['user']['is_logged'] || !empty($context['show_login_bar']))

echo '
<div id="user_section" class="bordercolor"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
<div class="floatright">', template_language_select(), '</div>
<div class="windowbg2 clearfix">';

echo '
<div id="user_section" class="bordercolor"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
<div class="windowbg2 clearfix">';


I think you have an extra echo you're not meant to have though.  (You didn't tell me you were using 2.0 RC2 so I didn't originally give you the 2.0 RC2 install instructions!)

Is the header collapsed?

I get this error...
Fatal error: Call to undefined function languageDrop() in C:\wamp\www\forum\Sources\Load.php(2113) : eval()'d code on line 511
Title: Re: Language Drop Down
Post by: Arantor on November 22, 2009, 03:29:00 PM
That suggests you've not installed one or more of the other changes.
Title: Re: Language Drop Down
Post by: leonpadi on November 22, 2009, 03:33:44 PM
Yeap, propably, and which are those changes i may have to apply ? (dumb question i know, i am a smf noobie :) )
Title: Re: Language Drop Down
Post by: Arantor on November 22, 2009, 03:37:30 PM
Whatever changes you've done, undo all of them. You seem to have gotten 1.1 code inside 2.0. LanguageDrop isn't set up in 2.0 as far as I can see - but it's also not being called.
Title: Re: Language Drop Down
Post by: leonpadi on November 22, 2009, 04:18:55 PM
Ok dear Arantor
So my mistake, i will undo any changes and wait for version 2.0 (and specifically for Rc2 which we are running on)...
Thank you again for your time my friend :)
Title: Re: Language Drop Down
Post by: Arantor on November 22, 2009, 04:20:21 PM
Well, this mod should install fine on 2.0 RC2, but I guess we'll have to wait for the author to comment.
Title: Change Display of Language Name in Drop Down
Post by: laloma on November 24, 2009, 07:31:07 AM
Dear Sirs:

SMF 2 RC2, Default Theme, Language Drop 1

Just upgrade to SMF 2 RC2 and install Language Drop Down Mod. I need to change the Language Name displayed at the Language Drop Down Menu.

Have installed Spanish and English, Spanish is displayed as ´Spanish Es-utf8´and would like to be display as ´Español´

Where I can change this ?

Regards,
Title: Re: Language Drop Down
Post by: Arantor on November 24, 2009, 07:53:00 AM
You cannot easily change this, since it displays the internal language code used by SMF rather than a friendly one.
Title: Re: Language Drop Down
Post by: laloma on November 24, 2009, 08:20:41 AM
Dear Arantor:

Is there a way to change it at the Language Pack ? How to get detailled instructions to change this ?

Also, how to change Box anf Fond Size of the Drop Down Menu ?

Regards,
Title: Re: Language Drop Down
Post by: Arantor on November 24, 2009, 08:34:36 AM
No there isn't a way of changing it in the language pack.

Changing the box size and font size is done in CSS, depends mostly on your theme.
Title: Re: Language Drop Down
Post by: laloma on November 24, 2009, 12:53:25 PM
Dear Arantor:

Where I can get guidance to do both, change Language name and Drop Down menu box and font ?

Regards,
Title: Re: Language Drop Down
Post by: Arantor on November 24, 2009, 02:16:04 PM
Hopefully the mod's author will be around to provide those.

In the case of changing the language name, that's not exactly a simple change.
Title: Re: Language Drop Down
Post by: Neverhurry on December 04, 2009, 03:16:35 AM
Hi Arantor:

I would like to show it in the Luxemburgues theme, i can not find the parse code for 2.0rc2, can you help?
Title: Re: Language Drop Down
Post by: Arantor on December 04, 2009, 03:47:42 AM
The author needs to update the file on the mod site because the one currently there is broken.
Title: Re: Language Drop Down
Post by: searchgr on December 13, 2009, 01:02:16 AM
Package upload failed due to the following error:
"Although the package was downloaded to the server it appears to be empty. Please check the Packages directory, and the "temp" sub-directory are both writable. If you continue to experience this problem you should try extracting the package on your PC and uploading the extracted files into a subdirectory in your Packages directory and try again. For example, if the package was called shout.tar.gz you should:
1) Download the package to your local PC and extract it into files.
2) Using an FTP client create a new directory in your "Packages" folder, in this example you may call it "shout".
3) Upload all the files from the extracted package to this directory.
4) Go back to the package manager browse page and the package will be automatically found by SMF."
Title: Re: Language Drop Down
Post by: Arantor on December 13, 2009, 04:29:21 AM
Quote from: Arantor on December 04, 2009, 03:47:42 AM
The author needs to update the file on the mod site because the one currently there is broken.
Title: Re: Language Drop Down
Post by: Akyhne on December 14, 2009, 07:30:50 AM
Me thinks we should ban the author, until he updates this mod XD
Title: Re: Language Drop Down
Post by: Arantor on December 14, 2009, 08:15:14 AM
I spoke to him about this a while ago, and he said he'd fix it when he had time...
Title: Re: Language Drop Down
Post by: kai920 on December 17, 2009, 01:13:56 AM
Quote from: Arantor on December 04, 2009, 03:47:42 AM
The author needs to update the file on the mod site because the one currently there is broken.
Would this have to do with the language not changing after I select it in the drop down? It just refreshes the page but the interface language does not change.
Title: Re: Language Drop Down
Post by: Arantor on December 17, 2009, 02:20:44 AM
I don't know about that. :(
Title: Re: Language Drop Down
Post by: ~DS~ on December 28, 2009, 12:45:36 AM
Quote from: searchgr on December 13, 2009, 01:02:16 AM
Package upload failed due to the following error:
"Although the package was downloaded to the server it appears to be empty. Please check the Packages directory, and the "temp" sub-directory are both writable. If you continue to experience this problem you should try extracting the package on your PC and uploading the extracted files into a subdirectory in your Packages directory and try again. For example, if the package was called shout.tar.gz you should:
1) Download the package to your local PC and extract it into files.
2) Using an FTP client create a new directory in your "Packages" folder, in this example you may call it "shout".
3) Upload all the files from the extracted package to this directory.
4) Go back to the package manager browse page and the package will be automatically found by SMF."
Same issue here with 2.0 RC2
Title: Re: Language Drop Down
Post by: trikos on December 28, 2009, 06:32:08 AM
Anyone who can install this mod at the moment? There seems to be a problem with the current package.

Does FTP solution work?

-trikos
Title: Re: Language Drop Down
Post by: Arantor on December 28, 2009, 08:05:02 AM
No, the package is still damaged.

I did repackage it a while back but the author asked me not to distribute it as he'd fix it shortly.
Title: Re: Language Drop Down
Post by: trikos on December 28, 2009, 09:19:53 AM
Ok. Thanks :)
Title: Re: Language Drop Down
Post by: ~DS~ on January 08, 2010, 04:20:48 AM
No news yet? I know, I know...the author will update when he/she have time.
Title: Re: Language Drop Down
Post by: Neverhurry on January 19, 2010, 04:11:48 PM
i installed this mod in smf 2.0 rc2 and it works very well.
Title: Re: Language Drop Down
Post by: leonpadi on January 19, 2010, 04:34:37 PM
Quote from: neverhurry on January 19, 2010, 04:11:48 PM
i installed this mod in smf 2.0 rc2 and it works very well.
Yeap, but problem comes with custom themes-skins ...
Title: Re: Language Drop Down
Post by: Arantor on January 19, 2010, 04:37:52 PM
Which is no different any other time though you *can* use 2.0's package manager to attempt to install on custom themes.
Title: Re: Language Drop Down
Post by: leonpadi on January 19, 2010, 04:42:09 PM
So what can we try dear Arantor ? :)
Many people in here would like to see this plugin to work with custom themes like Blackrainv2 for example...which was not happened last time i tried...
http://www.simplemachines.org/community/index.php?topic=139200.msg2370177#msg2370177
Title: Re: Language Drop Down
Post by: ~DS~ on January 19, 2010, 08:32:57 PM
Quote from: neverhurry on January 19, 2010, 04:11:48 PM
i installed this mod in smf 2.0 rc2 and it works very well.
How do you get it to work?  :o
Title: Re: Language Drop Down
Post by: leonpadi on January 20, 2010, 02:53:44 AM
It works like a dream on default theme-skin of smf, i can confirm it BUT it will not work on some custom themes (like the one i mentioned in my other post).
Title: Re: Language Drop Down
Post by: ~DS~ on January 20, 2010, 04:14:35 AM
Finally got it to work, had to upload it to FTP manually. Does anyone knows how to move the language below the search? Like the one on SMF.
Title: Re: Language Drop Down
Post by: ~DS~ on January 22, 2010, 03:04:29 AM
Quote from: Dismal Shadow on January 20, 2010, 04:14:35 AM
Finally got it to work, had to upload it to FTP manually. Does anyone knows how to move the language below the search? Like the one on SMF.
Guess not...
Title: Re: Language Drop Down
Post by: KensonPlays on February 03, 2010, 01:30:06 AM
Quote from: Daveyo on July 15, 2009, 08:47:31 AM
Sleepy

Got a question to ask you.  Why doesn't the Slovenian Mod not work.  It is on the language drop down menu, but it does not do a thing to the forum to show the language being changed.

Is there something wrong with that mod or what.

I got all the others working fine. 

Also how to get the post pages or information to the specific languages so that people can read it in their language.  Is this possible or not.



Daveyo

@Daveyo, how many languages you have?
Title: Re: Language Drop Down
Post by: Bugo on February 07, 2010, 07:50:47 AM
Why was packed to the archive folder?

Font is too small in the selection list.
Title: Re: Language Drop Down
Post by: ~DS~ on March 09, 2010, 06:38:03 PM
I see this had been update for RC3 but is the issue fixed mentioned by Bugo as well under the search button?
Title: Re: Language Drop Down
Post by: 1ondon on March 24, 2010, 10:20:41 AM
Hi.
I posted this in the main foum but got no replies.
I am using 2rc3 and I installed the latest language dropdown mod (1.5.1).
First thing was the dropdown was tiny - I edited the appropriate file and chaged the font from "smalltext to "text" - worked!
However, the dropdown doesn't show to guests or potential registrants (only shows when logged in). How do I get a dropdown to show ALL the time like the SMF forum has?
Also, I want to edit the dropdown to show "francais" instead of the ugly "french-utf8". Where do I edit to change this?

Thanks
1onnny.
Title: Support
Post by: Siirist on May 19, 2010, 04:20:25 PM
Hello,

It seems that there has not been any support on this since December 2009, and that was from Arantor (who is leaving soon).

As I recall looking through, Sleepy has not commented since sometime in October 2009.

Has this mod been abandoned?

Thanks in advance for any info.

Be Well and Take Care,
Cloud
Title: Re: Language Drop Down
Post by: ukhalik2 on May 30, 2010, 04:29:08 PM
is this mod uses google translator or bablefish?
Title: [How to] change $language['name']
Post by: navarretemarce on August 06, 2010, 04:15:57 PM
Hello, I have a simple question.
I am using the language selection drop down mod. Its shows in the select the $language['name'] for each option tag.
I would like to change that name for some languages like spanish_latin-UTF8 for somthing like "Spanish". Where can I make this change?
Thanks
Title: Re: Language Drop Down
Post by: navarretemarce on August 08, 2010, 05:10:45 PM
I have notice that if there is guest surfing the selected language change automatically to default language when surfing.
I have visited 2 forums linked here and the same problem.
Is there any explanation or solution?
Also surfing in THIS forum doesnt shows that unwanted behavior. Is it the code that this forum uses for laguage drop down available?

Any body there?
has this mod been abandoned?
Title: Re: Language Drop Down
Post by: navarretemarce on August 11, 2010, 10:53:54 AM
Okay seems to be ...

I have uploaded a similar mod called "language button menu". Gives a similar functionality but with buttons or flag icons if you want to select the languages...
It fixes the redirection to default language when a guest change the language bug. And suppress the ugly -utf8 form the language name... I am still working in customizable language names, but need some advice of SMF source...
I can´t find where the languages array is defined  :(... Any body here who knows?
I hope my mod will get approved soon...
Title: Re: Language Drop Down
Post by: Akyhne on September 10, 2010, 09:43:04 AM
Quote from: ukhalik2 on May 30, 2010, 04:29:08 PM
is this mod uses google translator or bablefish?
It is not using either. The mod doesn't translate anything, it just lets the viewer change language amongst the available ones in the forum they are visiting. That means it changes the language of of the forum menus not the content of posts etc.

navarretemarce:
You can see the available languages here: http://download.simplemachines.org/?languages
But you don't need that list for anything, except if it's because you need the flags for the countries. You need the language list for the forum your mod is installed in.
Title: Re: Language Drop Down
Post by: dsanchez on September 23, 2010, 04:50:32 PM
Just installed this but I can't see the drop down menu. I'm using a variant of the Curve theme SMF 2.0RC3. Any ideas? Thanks!
Title: Re: Language Drop Down
Post by: SleePy on September 23, 2010, 07:55:27 PM
You may need to make the theme changes to see it on your theme variant.

You can use the mod parser on our modifications site to show your the theme changes and apply those to your custom theme :)
Title: Re: Language Drop Down
Post by: dsanchez on September 24, 2010, 08:02:50 AM
Hello guys,

I managed to install the mod (check http://curefans.com) but I have some questions:

1) it's possible to show the languages in alphabetic order and without the -utf8 in the end?

2) I noticed that if we set by default other language than English (in the Profile > Account settings) the drop-down menu won't work anymore, e.g. if we choose "Spanish" as default language in our profile, and then we want to switch to another language using the menu it won't work, it will remain always in Spanish, unless we go back to English, logout off the forum, and log in back.

3) When a guest is browing the forum and he choose one of the languages of the drop-down menu, the language will be changed, but if he browse another page, the language will be back to english, and he will need to select the language again from the menu.
Title: Re: Language Drop Down
Post by: SleePy on September 25, 2010, 06:46:19 PM

To fix the -utf8 bug, open your index.template.php and find:


<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';


Replace with:

<option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', str_replace('-utf8', '', $language['name']), '</option>';


To sort them, find:

// Hopefully We always have something to show for ourselves.


Add before:

ksort($context['languages']);



To fix the guest thing:  Open Load.php and find:

if (isset($languages[$_POST['language']]))
{
updateMemberData($user_info['id'], array('lngfile' => $_POST['language']));
$user_info['language'] = $_POST['language'];
}


And replace with:

if (!empty($user_info['id']) && isset($languages[$_POST['language']]))
{
updateMemberData($user_info['id'], array('lngfile' => $_POST['language']));
$user_info['language'] = $_POST['language'];
}
elseif (isset($languages[$_POST['language']]))
$_SESSION['language'] = $_POST['language'];



I'm not sure why #2 is happening though.
Title: Re: Language Drop Down
Post by: dsanchez on October 03, 2010, 09:32:33 AM
Thank you very much! :)

#2 is ok now?! :)
Title: Re: Language Drop Down
Post by: SleePy on October 05, 2010, 05:34:17 PM
I am not sure why #2 would occur.  I would need to find time one of these days to test and debug that out if its occurring.
Title: Re: Language Drop Down
Post by: b4pjoe on October 12, 2010, 01:32:29 PM
Quote from: navarretemarce on August 11, 2010, 10:53:54 AM
Okay seems to be ...

I have uploaded a similar mod called "language button menu". Gives a similar functionality but with buttons or flag icons if you want to select the languages...
It fixes the redirection to default language when a guest change the language bug. And suppress the ugly -utf8 form the language name... I am still working in customizable language names, but need some advice of SMF source...
I can´t find where the languages array is defined  :(... Any body here who knows?
I hope my mod will get approved soon...

Is there a separate support topic here for this "language button menu" mod? I would like to know how to make this display language icons instead of buttons?
Title: Re: Language Drop Down
Post by: dsanchez on November 08, 2010, 09:07:45 AM
Just updated to 2.0 RC4 so I had to re-install this mod, and it's not working :(

"Package is corrupt or not compatible with your SMF version"
Title: Re: Language Drop Down
Post by: agridoc on November 08, 2010, 01:31:17 PM
In "Browse Packages" click on "Advanced" (bottom right) and put on
Emulate Version: SMF 2.0 RC3

After that try to see how it goes.
Title: Re: Language Drop Down
Post by: AlexBarsan on December 04, 2010, 01:15:32 PM
Quote from: SleePy on September 23, 2010, 07:55:27 PM
You may need to make the theme changes to see it on your theme variant.
You can use the mod parser on our modifications site to show your the theme changes and apply those to your custom theme :)

Sorry for the intrusion, I instaled your mood (laguage drop) and works perfect on the default theme, but I cant manage to modify the index_template.php of the theme I currently use, the theme is a variant of As-theme by fussilet, Is there a way you can help me?
Best regards,
Alex

PS I'm on SMF 1.1.12
http://www.sparkclub.com.mx/foro
Title: Re: Language Drop Down
Post by: SleePy on December 05, 2010, 09:46:49 PM
Start by adding this to the end of index.template.php just before ?>

// Generate the Language Drop Down..
function template_language_select()
{
    global $context, $txt, $scripturl;

    // Do the Function...
    languageDrop();

    // Hopefully We always have something to show for ourselves.
    if (!empty ($context['languages']))
    {
        echo '
            <form action="" method="post" class="smalltext" style="float: right;">
                <select id="language_select" name="language" onchange="this.form.submit()" class="smalltext">';
        foreach ($context['languages'] as $language)
            echo '
                    <option value="', $language['filename'], '"', isset($context['user']['language']) && $context['user']['language'] == $language['filename'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';
        echo '
                </select><input type="hidden" name="changelang" value="1" />&nbsp;<noscript><input type="submit" value="', $txt['quick_mod_go'], '" /></noscript></form>';
    }
    // No languages we can find!
    elseif (empty ($context['languages']))
        echo 'LanguageDrop: ' . $txt[398];
    // If this occurs we are in trouble.
    else
        echo 'LanguageDrop: ' . $txt[106];
}


Then you will have to tell me where you are wanting to put it in the theme (where exactly in the HTML please) and I can point out the rest.  The rest is just telling php to echo that template out :)
Title: Re: Language Drop Down
Post by: AlexBarsan on December 05, 2010, 10:47:58 PM
Thank you very much for your replay and help, first step DONE!
I wold like the drop down menu to show somewhere on the top say below the news, what part of code should I put in and where? thanks again and sory about my bad english-

I DID'IT! it works just great!
Title: Re: Language Drop Down
Post by: NoFeaR / NFSMW on January 31, 2011, 03:09:50 AM
the RC4 version wont install on my RC3. Can i please get the RC3 version?
Title: Re: Language Drop Down
Post by: SleePy on February 02, 2011, 03:55:15 PM
You should update to RC4.

But I do keep all old versions in my svn repository on my site:
https://svn.sleepycode.com/wsvn/Modifications/Language_Drop/Readme.txt
https://svn.sleepycode.com/wsvn/Modifications/Language_Drop/releases/
Title: Re: Language Drop Down
Post by: Masterd on February 23, 2011, 04:10:40 PM
Updated for SMF 1.1.13 and SMF 2.0 RC5!
Title: Re: Language Drop Down
Post by: fiver on February 28, 2011, 11:12:19 AM
HI Masterd,


I just downloaded and install the latest version. I kept waiting for the installation to complete but it didn't happen. I looked at the Error Log, there are thousands of pages of error. I removed the package but the error kept growing by hundreds per minute.


Please advise how to stop this erro process?


SMF 2 RC5




http://xxxxxx/index.php?action=admin;area=packages;sa=install2;package=Language Drop Down 1.5.3.zip;pid=0
2: fread(): supplied argument is not a valid stream resource
File: l/Sources/Subs-Package.php
Line: 2782




http://xxxxxx/index.php?action=admin;area=packages;sa=install2;package=Language Drop Down 1.5.3.zip;pid=0
2: feof(): supplied argument is not a valid stream resource
File: /Sources/Subs-Package.php
Line: 2781
Title: Re: Language Drop Down
Post by: kat on February 28, 2011, 01:40:01 PM
If that was my forum, I'd restore the backup that I took, before I installed the mod.

You didn't backup?

Dur.

Oh, well. Maybe this'll help:

http://www.simplemachines.org/community/index.php?topic=400356.0
Title: Re: Language Drop Down
Post by: fiver on February 28, 2011, 10:51:30 PM
Hi K@,


Looking at the error log, it is related to sources/sub-packages.php, so for a quick solution I put the forum in Maintenance Mode, renamed folder Source to SourceX, checked the Error Log and it stopped generating the error. Then I rename it back to Source and all is well again. What a relief.







Title: Re: Language Drop Down
Post by: mxcape21 on July 20, 2011, 08:17:29 AM
Hello, I installed this mod without any errors in 2.0 RC5 but the only place I see a language selection is in the profile.  I have made many attempts to add [  language drop(); ]  in different places to my index.template.php file without any success, please help.
I would like to add it right below the search box, thanks.

<div class="news normaltext">
<form id="search_form" style="margin: 0;" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
<input type="text" name="search" value="" class="input_text" />&nbsp;
<input type="submit" name="submit" value="', $txt['search'], '" class="button_submit" />
<input type="hidden" name="advanced" value="0" />';

// Search within current topic?
if (!empty($context['current_topic']))
echo '
<input type="hidden" name="topic" value="', $context['current_topic'], '" />';
// If we're on a certain board, limit it to this board ;).
elseif (!empty($context['current_board']))
echo '
<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

echo '</form>';

                // Show a random news item? (or you could pick one from news_lines...)
if (!empty($settings['enable_news']))
echo '
<h2>', $txt['news'], ': </h2>
<p>', $context['random_news_line'], '</p>';

echo '
</div>
</div>
<br class="clear" />';


Thank you

Never Mind,  I removed it and did a manual install again and all is well 8)
Title: Re: Language Drop Down
Post by: payam30 on August 22, 2011, 11:15:17 AM
Hi,
I have a question.
I'm new with SMF and I have some questions about this mod.
I want to make two diferrent furom . one for swedish speaking people and one for english talking user. But all users may write in both forums if they want.
Is this the right  Mod? And how Do I make a [Swith to swedish/english forum] button? And how do I kontroll both forums?

thank you
Title: Re: Language Drop Down
Post by: agridoc on August 22, 2011, 12:15:28 PM
This mod just switches user (and guest) language.

We are off topic but, although you can make two SMF installations working with the same database, you can equally well organize one forum with proper organization of English and Swedish categories and boards and guide users to collapse and/or ignore those not wanted.

In this case, with Language Drop Down mod a language selection menu will be there for everyone to choose  ;)
Title: Re: Language Drop Down
Post by: ctec67 on October 19, 2011, 08:48:50 AM
Hello,

Can someone please send me this mod zip to [email protected]?

No matter what I try I cannot download it or install it from the
admin, as it keep's getting chopped off after the word Language :(

Thank You!

Sincerely
Carola
Title: Re: Language Drop Down
Post by: GarryRicketson on January 29, 2012, 08:58:52 PM
All though I have been useing SMF for a while, I have not done any mod's, this would be the first time, I just now downloaded, the "Language Drop" .zip,  I am useing SMF 2.02
But I am somewhat "nervous" or doubtful about my ability to install this, ?  The version I down loaded says Version 1.5.3 , but in the readme file it only refers to, up to Version 1.5.2 , and on that it says it has not been released, so I am totally confused.
Can it work on SMF 2.0.2 ?   When I up load it to my site, where do I unzip it too ?, or do I upload the files 1 by one ?, ...
http://artworkandmexico.com/smf/index.php   (http://artworkandmexico.com/smf/index.php)
If anyone can help explain how to install this, in simple terms,. it would be appreciated,..
Thank you from
Garry
I guess I need to back evrything up first ,too, but that is what worrys me,...if installing this is so "risky",..maybe it is ot a good idea, but I really like how the translator seems to work on this forum, thats what I would like to add. Thanks from Garry
Title: Re: Language Drop Down
Post by: Matthew K. on January 29, 2012, 09:21:56 PM
Just install it using Package Manager.

Package Manager (http://wiki.simplemachines.org/smf/Packages)
Title: Re: Language Drop Down
Post by: GarryRicketson on January 29, 2012, 09:30:13 PM
OK , Thank you on the quick reply,
and the link,
from Garry
Title: Re: Language Drop Down
Post by: Matthew K. on January 29, 2012, 09:34:22 PM
Not a problem, good luck.
Title: Re: Language Drop Down
Post by: GarryRicketson on January 30, 2012, 12:25:38 AM
I did it, useing the package manager, it worked good and was easy.
thanks a bunch, from Garry
Title: Re: Language Drop Down
Post by: Matthew K. on January 30, 2012, 01:06:07 PM
Great to hear! :) Enjoy!
Title: Re: Language Drop Down
Post by: AMWebby on August 11, 2012, 07:04:22 AM
I installed this on my custom theme fine but the drip down menu shows the languages twice. Any idea why?
Title: Re: Language Drop Down
Post by: Matthew K. on August 11, 2012, 10:16:46 AM
When you say installed it on your custom theme....how?
Title: Re: Language Drop Down
Post by: AMWebby on August 11, 2012, 10:33:28 AM
After installing the mod I modified index.template.php in my custom theme folder to place the drop down in my menu and the code for the drop down at the foot of that template.

It works fine in the default template, only showing one set of languages but shows two sets in the custom template.
Title: Re: Language Drop Down
Post by: Matthew K. on August 11, 2012, 11:50:08 AM
Right...go ahead and attach your custom themes index.template.php.
Title: Re: Language Drop Down
Post by: AMWebby on August 11, 2012, 11:56:50 AM
This is it. You can see it in action at: http://www.amoc.org/forum/

The only duplicate language it is showing at the moment is English as I worked around the problem by removing the languages from the default template...
Title: Re: Language Drop Down
Post by: Matthew K. on August 11, 2012, 12:05:23 PM
Quote from: AMWebby on August 11, 2012, 11:56:50 AM
This is it. You can see it in action at: http://www.amoc.org/forum/

The only duplicate language it is showing at the moment is English as I worked around the problem by removing the languages from the default template...
Go ahead and try this.
Title: Re: Language Drop Down
Post by: AMWebby on August 11, 2012, 12:12:30 PM
Still getting two English options...

Also can't figure out why Spanish isn't in alphabetical order.
Title: Re: Language Drop Down
Post by: Matthew K. on August 11, 2012, 12:20:23 PM
What version of SMF are you running?
Title: Re: Language Drop Down
Post by: AMWebby on August 11, 2012, 12:23:16 PM
1.1.16
Title: Re: Language Drop Down
Post by: liuxyon on October 05, 2012, 05:06:12 AM
it is can't work for SMF 2.0.2 and theme?

I using SMF2.0.2 and meridian theme.

the index.template.php can't fix and change code.

Title: Re: Language Drop Down
Post by: liuxyon on October 05, 2012, 05:06:37 AM
it is can't work for SMF 2.0.2 and theme?

I using SMF2.0.2 and meridian theme.

the index.template.php can't fix and change code.

Title: Re: Language Drop Down
Post by: Matthew K. on October 09, 2012, 02:33:19 AM
Probably won't work using 2.0.2 yet, especially on a custom theme. Sorry.
Title: Re: Language Drop Down
Post by: ddabcd277 on November 18, 2012, 03:01:51 AM
Hello,

The mod works fine on SMF 2.0.2 with the Curve Theme. Thank you.  :)

I have a question. Excuse me if it is alredy answered. When a language is choosen is it possible also the Boards names and descriptions to be changed?

Regards,
Title: Re: Language Drop Down
Post by: Matthew K. on November 18, 2012, 01:35:50 PM
That's really unrelated to the modification itself, it's related to how SMF handles languages, internally.

Board names and descriptions are inputted by the administrator(s) via the admin panel, they are not text strings and therefore are not translated because they are not static.
Title: Re: Language Drop Down
Post by: ddabcd277 on November 18, 2012, 01:46:21 PM
@ Labradoodle-360

Thank you. I understand that. Thought someone has figure how to achive it. Isn't the board names and their descriptions recorded in the smf database? 
Title: Re: Language Drop Down
Post by: markeefarmer on February 08, 2013, 11:11:04 AM
Have installed mod, but it is not showing on my forum. 
Do I need to activate it somehow for the drop down box to appear? 
Title: Re: Language Drop Down
Post by: Arantor on February 08, 2013, 11:26:15 AM
Quote from: ddabcd277 on November 18, 2012, 01:46:21 PM
@ Labradoodle-360

Thank you. I understand that. Thought someone has figure how to achive it. Isn't the board names and their descriptions recorded in the smf database? 

Sure they are. But they're only recorded *once*. There's nowhere to store multiple variations of the board names.
Title: Re: Language Drop Down
Post by: Ardenstone on March 16, 2013, 06:25:32 PM
Thanks for making this!  I tried downloading it by browsing to it from Package Manager and received an error ("Although the package was downloaded to the server it appears to be empty. Please check the Packages directory, and the "temp" sub-directory are both writable...").  Other packages work; I suspect the issue is the spaces in the file name.  Maybe I have something strange setup, but I had the same issue on two different SMF installations.

I downloaded the package manually, renamed it to LangaugeDropDown_1.5.3.zip (not sure I needed to do that step), threw it in my packages folder and it's working great.  Thanks again for developing it!
Title: Re: Language Drop Down
Post by: Matthew K. on March 17, 2013, 01:19:26 AM
Glad you find it useful :)
Title: Re: Language Drop Down
Post by: dan4ever on June 11, 2013, 12:19:05 PM
Hi

Is it possible to have the "Dropmenu" under the search button?
Like the SMF-site itself.

Were do I change that?
Had a look into index.template.php and tried to put "<br>" but no result.

I have SMF 2.0.4
Title: Re: Language Drop Down
Post by: Matthew K. on June 12, 2013, 06:29:47 PM
No result? What happened? What code did you try to modify?
Title: Re: Language Drop Down
Post by: dan4ever on June 16, 2013, 12:43:02 PM
Had a look into index.template.php and tried to put "<br>" before the "Drop Down", but no result.
Title: Re: Language Drop Down
Post by: Matthew K. on June 16, 2013, 08:16:40 PM
Linebreaks are designed for visual breaks in paragraphs not actual layout breaks which they are typically used for unfortunately. Can you attach your index.template.php?
Title: Re: Language Drop Down
Post by: dan4ever on June 17, 2013, 11:58:08 AM
Thanks... Here it is
Title: Re: Language Drop Down
Post by: dan4ever on April 12, 2014, 07:39:54 PM
Still no answer...
Title: Re: Language Drop Down
Post by: DenDen60 on April 13, 2016, 11:45:16 AM
I would like to use this mod, but it's really old. I can't install it on my forum. I have tried to find other modes, but they don't seem to work like the select language menu here.
Title: Re: Language Drop Down
Post by: -Rock Lee- on April 13, 2016, 12:40:03 PM
Quote from: DenDen60 on April 13, 2016, 11:45:16 AM
I would like to use this mod, but it's really old. I can't install it on my forum. I have tried to find other modes, but they don't seem to work like the select language menu here.

Oh tried to emulate the version? also with such an old modification is not recommended to use for risk injection can lead this!


Regards!
Title: Re: Language Drop Down
Post by: DenDen60 on April 13, 2016, 12:56:09 PM
You mean that it could lt could be exploited to insert a virus?
Title: Re: Language Drop Down
Post by: -Rock Lee- on April 13, 2016, 12:58:35 PM
Quote from: DenDen60 on April 13, 2016, 12:56:09 PM
You mean that it could lt could be exploited to insert a virus?

You can generate a vulnerability to a threat, would use it at your own risk. Note that the years pass and is not the same smf 1.0 to 2.0.11 there were changes and safety improvements to critical things ...

Regards!
Title: Re: Language Drop Down
Post by: JBlaze on April 13, 2016, 09:02:13 PM
Emulating the version is not a security risk. It does not create a vulnerability, nor is it unsafe to use. Emulating the version only temporarily changes the SMF version variable itself, it does not revert the entire forum back to a previous version.
Title: Re: Language Drop Down
Post by: -Rock Lee- on April 13, 2016, 09:52:32 PM
Quote from: JBlaze on April 13, 2016, 09:02:13 PM
Emulating the version is not a security risk. It does not create a vulnerability, nor is it unsafe to use. Emulating the version only temporarily changes the SMF version variable itself, it does not revert the entire forum back to a previous version.

Not emulate itself but to use a code of a third something old can cause Problem? ... I can be wrong but from what I read in if the code is the Tecero may be, or rather smf not guarantee it is safe. Truth or am I wrong?

Regards!
Title: Re: Language Drop Down
Post by: Kindred on April 13, 2016, 10:36:00 PM
In general, you are wrong...

Any mod code which is reported insecure would be removed
Title: Re: Language Drop Down
Post by: DenDen60 on April 14, 2016, 09:47:03 AM
Thanks for your replies, I will try to install it.
Title: Re: Language Drop Down
Post by: -Rock Lee- on April 14, 2016, 10:25:03 AM
Quote from: Kindred on April 13, 2016, 10:36:00 PM
In general, you are wrong...

Any mod code which is reported insecure would be removed

Ah thank you very much indeed @Kindred thanks for clearing that doubt :D

Regards!
Title: Re: Language Drop Down
Post by: maximus23 on April 14, 2016, 01:38:28 PM
Hi,

Tested on freshly installed smf 2.0.11 and it works perfectly !!! 
 
Install the package on the SMF Default 'Curve' Theme ONLY. Core or other themes will need manual edits.

I should like to announce a few fairly minor technical adjustments very  briefly.

Open file: Themes/default/index.template.php

Search and remove :

', template_language_select(), '            
Search :

<input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

echo '</form>';


Add After :

echo'', $txt['select_language'], '&nbsp;', template_language_select(), '<br /><br />';

Search :

<form action="" method="post" class="smalltext" style="float: right;">

Replace by :

<form action="" method="post" class="normaltext" style="float: right;">

Save the file.            

Open file: Themes/default/languages/Modifications.english.php or Modifications.english-utf8.php

ADD at the End:

$txt['select_language'] ='Select language';

Save the file.

Open file: Themes/default/languages/Modifications.french.php or Modifications.french-utf8.php

ADD at the End:

$txt['select_language'] ='Sélectionnez votre langage';

Save the file.

Etc... for other languages.

:)
Title: Re: Language Drop Down
Post by: DenDen60 on April 14, 2016, 05:11:47 PM
Question.

If I already have a theme installed, should I uninstall it, or does making the Curve theme the Default theme for everybody enough?

Title: Re: Language Drop Down
Post by: AllMassive on March 21, 2021, 06:17:51 AM
could you please take a look into this (https://www.simplemachines.org/community/index.php?topic=577180.msg4085177#msg4085177) Post.
this mod seems to generate errors.
error with smf 2.0.18 is:
Undefined index: actual_theme_dir