Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: [Unknown] on October 03, 2004, 11:40:21 PM

Title: Showing languages for easy guest/user selection.
Post by: [Unknown] on October 03, 2004, 11:40:21 PM
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]
Title: Re: Showing languages for easy guest/user selection.
Post by: Anguz on October 04, 2004, 02:11:44 AM
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 (http://www.simplemachines.org/community/index.php?board=13.0;language=german)
Title: Re: Showing languages for easy guest/user selection.
Post by: HT on May 17, 2005, 12:52:53 PM
How can a guest chsnge language?
Title: Re: Showing languages for easy guest/user selection.
Post by: Owdy on May 17, 2005, 12:57:27 PM
Did you eaven read first post? http://www.simplemachines.org/community/index.php?language=german
Title: Re: Showing languages for easy guest/user selection.
Post by: guppy on May 17, 2005, 11:33:12 PM
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
Title: Re: Showing languages for easy guest/user selection.
Post by: [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]
Title: Re: Showing languages for easy guest/user selection.
Post by: 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?
Title: Re: Showing languages for easy guest/user selection.
Post by: edi67 on May 31, 2005, 09:18:59 AM
thanx unknown i use your method and clicking in nation flags forum begin in selected language

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

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg67.echo.cx%2Fimg67%2F1188%2Fus5ob.jpg&hash=70982f87040e1da04be9d369770f034ab365287c)
Title: Re: Showing languages for easy guest/user selection.
Post by: Serenity on June 02, 2005, 03:13:45 PM
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?
Title: Re: Showing languages for easy guest/user selection.
Post by: Ivan Minic on June 27, 2005, 06:19:07 AM
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
Title: Re: Showing languages for easy guest/user selection.
Post by: [Unknown] on June 27, 2005, 12:43:42 PM
As the parse error page shows, you have to use a \ in front of the 's.

-[Unknown]
Title: Re: Showing languages for easy guest/user selection.
Post by: Ivan Minic on June 27, 2005, 03:56:34 PM
<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..
Title: Re: Showing languages for easy guest/user selection.
Post by: [Unknown] on June 27, 2005, 04:00:37 PM
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]
Title: Re: Showing languages for easy guest/user selection.
Post by: Ivan Minic on June 27, 2005, 04:14:29 PM
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.burek.co.yu%2Fsmf%2FSmileys%2Fdefault%2Feusa_clap.gif&hash=2f9aa820f8fbf334db7889b8af7f86a209fe25a1)
Bravo! Ave [Unknown] !
Title: Re: Showing languages for easy guest/user selection.
Post by: JustJa on August 15, 2005, 03:35:11 AM
 Ok... But... where am I supposed to insert that code?
In wich php file?

:D
Title: Re: Showing languages for easy guest/user selection.
Post by: [Unknown] on August 15, 2005, 05:11:41 AM
Anywhere you like.  I'd suggest index.template.php.

-[Unknown]
Title: Re: Showing languages for easy guest/user selection.
Post by: JustJa on August 16, 2005, 05:15:25 PM
Parse error: parse error, unexpected '<' in XXX/index.php on line 46
What am I doing wrong?
tryed everything...
Title: Re: Showing languages for easy guest/user selection.
Post by: 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.
Title: Re: Showing languages for easy guest/user selection.
Post by: JustJa on August 20, 2005, 03:41:59 PM
Hi...
I still have problems with this... I wrote about it on the help desk. Is there anyone willing to help?
Thanks :)
Title: Re: Showing languages for easy guest/user selection.
Post by: [Unknown] on August 26, 2005, 01:14:35 AM
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]
Title: Re: Showing languages for easy guest/user selection.
Post by: smacktalk on August 26, 2005, 02:42:01 PM
Quote from: [Unknown] on August 26, 2005, 01:14:35 AM
Are you using subdomains?

-[Unknown]

no. I think we have ours working now. The problem we have is when you click on the link to the topic, it goes to the forum but under the  default language.
Title: Re: Showing languages for easy guest/user selection.
Post by: JustJa on August 26, 2005, 07:06:29 PM
Hi Unknown  :D
I am sorry, I got it fixed already
Thanks ;D
Title: Re: Showing languages for easy guest/user selection.
Post by: Raves on October 09, 2005, 10:13:39 AM
Quote from: edi67 on May 31, 2005, 09:18:59 AM
thanx unknown i use your method and clicking in nation flags forum begin in selected language

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

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fimg67.echo.cx%2Fimg67%2F1188%2Fus5ob.jpg&hash=70982f87040e1da04be9d369770f034ab365287c)

Hi!

Can someone give me the code, in what files to put it and tell where to put images? I am trying to make it look like this above but just can't make it.. idiot, I know..

Please help!
Title: Re: Showing languages for easy guest/user selection.
Post by: Elmacik on November 22, 2005, 02:13:24 AM
So, isnt there a way to automatically get th language list?
Title: Re: Showing languages for easy guest/user selection.
Post by: crisje on January 19, 2007, 11:29:59 AM
I also need this solution ... so that I can place three languages or more ... like romanian dutch and english...

someone please I`m new at this !
But great forum btw  ;) much better than phbbb !

Cheers 2 all !
Title: Re: Showing languages for easy guest/user selection.
Post by: KGIII on March 31, 2007, 02:19:19 AM
Hi,

I am going through the old unsolved support topics. Have you tried the language dropdown modification available in the mods downloads section?
Title: Re: Showing languages for easy guest/user selection.
Post by: rospone on November 03, 2007, 06:55:47 PM
I have installed italian language pack (utf8) together with default english language and I'm trying to use both languages independently

So, after reading this topic, I just  put a link directly to the two languages language like follows:
http://mysitename/community/index.php?language=italian-utf8
http://mysitename/community/index.php?language=english

..and It worked great; the problem is that when you try to register with a new username, after received the activation link you are being redirected to the english page.
Is there a way to change the instructions in the automatic activation mail so to be redirected to the italian language page and not to the english one and viceversa?
Should I change a script command some way? and anybody knows if  there is a way to do it?
Thank you
Title: Re: Showing languages for easy guest/user selection.
Post by: Deaks on December 09, 2007, 06:36:49 PM
hi rospone, can i ask did you get this sorted?