News:

Wondering if this will always be free?  See why free is better.

Main Menu

User selects preferred language on registering

Started by Mr. Matt, October 14, 2006, 11:32:40 PM

Previous topic - Next topic

Mr. Matt

I'm new to SMF and just trying to figure out how everything works.  I'll be running a board where everyone will speak English but it will be quite international so I want the option that people can easily set their preferred language when they register rather than having to find the option later.

I've tried looking around but couldn't find something close.  It's probably not required that much.

Could anyone give me some pointers on how I can go about achieving this?

Thanks for your help.

Oldiesmann

It's quite easy to do. Which version of SMF are you using?

Mr. Matt


Rudolf

First make sure that you have enabled user selection of the language.
In Admin -> Features and Options -> Enable user-selectable language support

Then your users can select their preferred language in their profile.
Profile -> Account Related Settings -> Preferred Language:
*Note: this is visible only when you have more then one language installed
I will update all my mods in the next few weeks. Thanks for your patience.

SVG-Collapse (you need an SVG compliant browser)

Mr. Matt

Yes, I have that enabled but I'm looking for a way that users can select their default language when they register rather than having the forum go to the default language and then changing it later.

Oldiesmann

#5
Just modify the code from Profile.template.php slightly...

if (!empty($modSettings['userLanguage']) && count($context['languages']) > 1)
{
// Load the Profile language file so we can use $txt[349]...
loadLanguage('Profile');

echo '
<tr>
<td width="40%"><b>', $txt[349], ':</b></td>
<td>
<select name="lngfile">';

// Fill a select box with all the languages installed.
foreach ($context['languages'] as $language)
echo '
<option value="', $language['filename'], '"', $language['selected'] ? ' selected="selected"' : '', '>', $language['name'], '</option>';
echo '
</select>
</td>
</tr>';
}

Advertisement: