Saturday, 31 August 2013

Dynamically switch content in website based on user language selection

Dynamically switch content in website based on user language selection

I am designing a small, simple website that will need two languages. I
want to keep things simple. I would like to use placeholders/variables in
the code that will have user-visible text. Then, allow the user to the
select the language of his choice (using a simple link), and make the
entire site's text switch over to that language. I would prefer something
similar to a language file, in which the values in the code are simply
switched when the user selects his language. Below is a small example to
illustrate what I am referring to.
<div class='title'>
[$siteTitleGoesHere]
</div>
I hope that makes sense. I am familiar enough with php and javascript that
I might be able to use them to do this, if given direction. Thanks for any
help.

No comments:

Post a Comment