Hello,
I wish to convert a string (english language) into it's equivalent Germen language.
key 65 is charachter 'a' but if the keyboard's layout is german and key code is 65, it should display the german charachter that equivalent to keycode 65....
In the link above you have all the keyChars. If you open the VIEW SOURCE of the site, search for Press a key and you will come to the function that is used to find which key is pressed and how you can proceed. I would recommend here using SWITCH instead
of just if-s.
4. Then just replace it to the string
Exmp: in the function above doConvert(this) means Im passing the value of the object to the function, so you will have the latest text in the textbox, you will only need to get the last character of the string and convert it as per your needs.
You can get the last character of the string like int he following example
doConvert(this)
function doConvert(d){
var length = d.value.length;
var lastCharacter = d.value.charAt(length - 1);
}
then you have the last char, using the code from the site above, you can catch which keyboard char is pressed and replace the char. as appropriate.
Hope this helps a bit.
Best Regards,
Hajan
Dont forget to Mark as Answer the answer that solved your problem!
megetron
Member
520 Points
921 Posts
Convert english string according to keyboard's layout
Jun 01, 2010 11:37 PM|LINK
Hello,
I wish to convert a string (english language) into it's equivalent Germen language.
key 65 is charachter 'a' but if the keyboard's layout is german and key code is 65, it should display the german charachter that equivalent to keycode 65....
Now, how do I achieve this kind of convertion?
hajan
Star
10655 Points
1782 Posts
Re: Convert english string according to keyboard's layout
Jun 02, 2010 01:17 AM|LINK
Im not sure if there is an implementation of such converter, but the first idea that came up in my mind was this:
1. Speaking for web application (thats why this forum is) you will need to do it on client-side
2. On TextBox where you will type the key chars, you may use onKeyUp event.
Exmp: <asp:textBox id="myTxt1" runat="server" onkeyUp="doConvert(this)" TextMode="MultiLine" />
3. Write javascript function that will have all the characters from the keyboard which are different (you can skip the equal ones).
Exmp: http://www.cambiaresearch.com/c4/702b8cd1-e5b0-42e6-83ac-25f0306e3e25/javascript-char-codes-key-codes.aspx
In the link above you have all the keyChars. If you open the VIEW SOURCE of the site, search for Press a key and you will come to the function that is used to find which key is pressed and how you can proceed. I would recommend here using SWITCH instead of just if-s.
4. Then just replace it to the string
Exmp: in the function above doConvert(this) means Im passing the value of the object to the function, so you will have the latest text in the textbox, you will only need to get the last character of the string and convert it as per your needs.
You can get the last character of the string like int he following example
doConvert(this)
function doConvert(d){
var length = d.value.length;
var lastCharacter = d.value.charAt(length - 1);
}
then you have the last char, using the code from the site above, you can catch which keyboard char is pressed and replace the char. as appropriate.
Hope this helps a bit.
Hajan
Dont forget to Mark as Answer the answer that solved your problem!
My ASP.NET Weblog
yahya_ammour...
Member
16 Points
10 Posts
Re: Convert english string according to keyboard's layout
Dec 21, 2011 08:32 AM|LINK
try the below article
just change the property "TextLanguage" for textbox After adding German language
http://www.codeproject.com/KB/custom-controls/automatic_switch_textbox.aspx
</div> </div>