hi
I want to detect input language of client. so
i tried in java script with(navigator)it dosent work for my perpose
i also used ( HTTP_ACCEPT_LANGUAGE) it return system language not keyboard language?
what i must do?

Recommended Answers

All 4 Replies

There is a way to do it in Flash, but I am not sure about JavaScript alone.

What are you trying to do, exactly?
Are you trying to adjust the page content based on some setting? If so, that is not a Good Thing.
My current keyboard configuration has nothing to do with the language(s) I want to see in pages I visit.

Offer the user a button to click - and, please, no flags.

forexample if client type in Persian textbox align must be "rtl"
and if he is typing in English textbox align must be "ltr"

if client type in Persian textbox align must be "rtl"
and if he is typing in English textbox align must be "ltr"

This little demo

<html> 
  <head> 
    <meta name="generator" content=
    "HTML Tidy for Windows (vers 25 March 2009), see www.w3.org"> 
    <title></title> 
  </head> 
  <body> 
    <textarea onclick="shoDir(this)" id='one' dir='rtl'> 
آزمون
</textarea> 
    <textarea onclick="shoDir(this)" id='two' dir='ltr'> 
test
</textarea> 
<script type="text/javascript"> 
function shoDir(that){
    alert(that.getAttribute('dir'))}
    </script> 
  </body> 
</html>

shows how to test the 'dir' attribute of a textarea. The code to set it is quite similar: .setAttribute('dir','rtl') or .setAttribute('dir','ltr') .

I don't have the required language support, so I can't test whether the attribute accessible to javascript changes when the keyboard is used to change the active language for input.

Caution: this toy does not specify a charset or codepage.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.