Latest Register Log In

+ Advanced Search

Setting Language via Link

Setting Language via Link
Jan 06, 2004 (Edited Mar 10, 2014)

If you have more than one language installed, the most appropriate language will be selected for site viewer's based on the language their web browser reports. This isn't always accurate/ideal though, so the user needs a manual override. If the language selector is switched on at Admin -> Settings -> Switches, users can select a language from a dropdown selector -- if the switch is off, they can only select their language in their profile.

Sometimes you may want to replace the language selector with a set of text or graphical hyperlinks. Here's an example of how to do that:
<a href="index.php?action=setlanguage&returnto={CURRENTURLENCODED}&languagegroup=English">English</a> <a href="index.php?action=setlanguage&returnto={CURRENTURLENCODED}&languagegroup=Spanish">Spanish</a>

To use national flag images, place this HTML in your template (presumably the wrapper) where you want it, perhaps in the spot currently occupied by the language selector:
<a href="index.php?action=setlanguage&returnto={CURRENTURLENCODED}&languagegroup=English"><img src="{IMAGESURL}/flags/us.png" ></a>
<a href="index.php?action=setlanguage&returnto={CURRENTURLENCODED}&languagegroup=Spanish"><img src="{IMAGESURL}/flags/es.png" ></a>

Repeat for each language you have.




Description Creating links to change the current language, optionally with national flag images.
Rating
Views 1,416 views. Averaging 0 views per day.
Similar Listings