Welcome visitor
* Login
* Register
It is currently May 23rd, 2019, 8:51 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » HTML



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  Detect and change language
PostPosted: September 10th, 2009, 10:21 pm 

Posts: 23
Does anyone knows what can i do to show the content of my website according to the language of the visitor? I saw that on the [url]torproject.org[/url] site, it did automatically change to my language.


Top
 Profile  
 
  Re: Detect and change language
PostPosted: September 11th, 2009, 12:36 am 
User avatar

Posts: 79
it is not according to the language of the user but the language of the browser, it can be done with this:
<script type="text/javascript">
lng = (navigator.language || navigator.userLanguage);
lng = lng.slice(0,2);
window.location = 'http://www.yoursite.com/index.+lng+.htm
</script>

but you should have already created files named:
[u]index.ja.htm
index.en.htm[/u
]etc...


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » HTML


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron