News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Showing languages for easy guest/user selection.

Started by [Unknown], October 03, 2004, 11:40:21 PM

Previous topic - Next topic

[Unknown]

Most, especially smaller, forums are not multilingual.  After all, the prupose of a forum is to dicuss something, so if people are talking in Thai and you speak Hindi... it really doesn't contribute to the conversation :P.

However, there are often times when mutlilingual forums are desirable.  Consider a forum for a game, to be released in many different countries.  Consider one for a movie, or more importantly... an international project such as this one.  Consider a forum for an international foundation or movement.  Obviously, this is why SMF has such a feature, and why it's even used.

However, it's easy to forget about guests.  If I speak German (only), and I find myself looking at an English forum... I may not realize it can switch to German.  I may not realize that there's a board (or several) that contain posts of my langauge.... and I may just leave.  Obviously, this is something to be avoided - but how?

Well, the first trick is that SMF allows anyone (guests, users, spiders, even dancing monkeys) to change their language at any time.  The most noticeable way is in your profile, but that is only for registered members.  The other way works only for as long as your browser is open, but can be used by guests - it is the "query string" method.

To use this method, you just put language=languagename in the URL.  For example, you could use any of the following:

http://www.simplemachines.org/community/index.php?language=english
http://www.simplemachines.org/community/index.php?board=72.0;language=german
http://www.simplemachines.org/community/index.php?action=search;langauge=spanish

But, how can you utilize this?  Well, there are a few ways, but one might be to use flags in the top right corner.  You could then make the flag select the language it's tied to.  The problem is, how do you know where you are?

One way would be to use javascript:

<a href="javascript:window.location += (window.location.indexOf('?') != -1 ? ';' : '?') + 'language=german';void(0);">...</a>

This would send them to the German version of the page they are on. (well, it wouldn't translate posts, or anything...) It's only downside is that if they are on a page that changes when you go to it, or requires input (such as a post preview or search results) it might give an error.

-[Unknown]

Anguz

Nice one, didn't know you could do that.

One idea would be to point the URL for each language to it's area in the forum. So if someone changes to German, it'd load the German board. Eg: German
Cristián Lávaque http://cristianlavaque.com

HT


Owdy

Former Lead Support Specialist

Tarvitsetko apua SMF foorumisi kanssa? Otan työtehtäviä vastaan, lue:http://www.simplemachines.org/community/index.php?topic=375918.0

guppy

If I have a navigation menu with quick links to some useful posts, how can I code the links so that guests using a different language won't end up back in English?

e.g. if I point to this post using the "standard" code:

<a href="http://www.simplemachines.org/community/index.php?topic=17595.0">....</a>

I'll end up in English since it's a static link

[Unknown]

No, once the language has changed the change will "stick" until you change it again.  Try it.

-[Unknown]

Serenity

i use the same thing! only one problem when using SSI on my other pages it goes to my standard language english!

is there a way to fix that?

edi67

thanx unknown i use your method and clicking in nation flags forum begin in selected language

http://www.forumzoneru.25.com1.ru/index.php

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

Serenity

Quote from: [Unknown] on May 17, 2005, 11:56:45 PM
No, once the language has changed the change will "stick" until you change it again.  Try it.

-[Unknown]
yes but that means they need to enter the forum first before your index page!  :-\ or not?

Ivan Minic

Quote<a href="javascript:window.location += (window.location.indexOf('?') != -1 ? ';' : '?') + 'language=german';void(0);">...</a>
No matter how I put this in my forum template i always get template parse error... I moded many things and they work like charm, i edited some stuff myself and also had no problems but this...
I did put links to 2 main languages but, those are fixed links that link to index page and not to specific page that was visited.. as i see ti this is the only way to do this, and this can't be inserted anywhere.... so.. any help would be very welcome

[Unknown]

As the parse error page shows, you have to use a \ in front of the 's.

-[Unknown]

Ivan Minic

<a href="javascript:window.location += (window.location.indexOf(\'?\') != -1 ? \';\' : \'?\') + \'language=serbian\';void(0);">...</a>
<a href="javascript:window.location += (window.location.indexOf(\'?\') != -1 ? \';\' : \'?\') + \'language=english\';void(0);">...</a>

If i put it like this, it doesn't work, there is no parse error, but doesn't work... I'm probably doing something wrong..

[Unknown]

Try:

<a href="javascript:window.location += (window.location.href.indexOf(\'?\') != -1 ? \';\' : \'?\') + \'language=serbian\';void(0);">...</a>
<a href="javascript:window.location += (window.location.href.indexOf(\'?\') != -1 ? \';\' : \'?\') + \'language=english\';void(0);">...</a>


-[Unknown]

Ivan Minic


JustJa

 Ok... But... where am I supposed to insert that code?
In wich php file?

:D

[Unknown]

Anywhere you like.  I'd suggest index.template.php.

-[Unknown]

JustJa

Parse error: parse error, unexpected '<' in XXX/index.php on line 46
What am I doing wrong?
tryed everything...

smacktalk

Quote from: Serenity on May 31, 2005, 05:57:23 AM
i use the same thing! only one problem when using SSI on my other pages it goes to my standard language english!

is there a way to fix that?

We are having the same issue.

JustJa

Hi...
I still have problems with this... I wrote about it on the help desk. Is there anyone willing to help?
Thanks :)

[Unknown]

Brasileira, can you post three lines above and below where you're trying to insert it, please?

Quote from: smacktalk on August 19, 2005, 02:16:34 PM
Quote from: Serenity on May 31, 2005, 05:57:23 AM
i use the same thing! only one problem when using SSI on my other pages it goes to my standard language english!

is there a way to fix that?

We are having the same issue.

Are you using subdomains?

-[Unknown]

Advertisement: