News:

Want to get involved in developing SMF? Why not lend a hand on our GitHub!

Main Menu

Language Drop Down

Started by Matthew K., January 02, 2007, 11:41:04 PM

Previous topic - Next topic

ukhalik2

is this mod uses google translator or bablefish?

navarretemarce

#301
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

navarretemarce

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?

navarretemarce

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...

Akyhne

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.

dsanchez

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!

SleePy

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 :)
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

dsanchez

#307
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.

SleePy


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.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

dsanchez

Thank you very much! :)

#2 is ok now?! :)

SleePy

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.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

b4pjoe

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?

dsanchez

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"

agridoc

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.
  For Greek aeromodellers and our friends around the world  - Greek Button sets for SMF - Greeklish to Greek mod
Δeν αφιερώνω χρόνο για μηνύματα σε greeklish.

AlexBarsan

#314
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

SleePy

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 :)
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

AlexBarsan

#316
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!

NoFeaR / NFSMW

the RC4 version wont install on my RC3. Can i please get the RC3 version?

SleePy

Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Masterd

Updated for SMF 1.1.13 and SMF 2.0 RC5!

Advertisement: