Click here to Skip to main content
15,887,867 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<link href="http://www.google.com/uds/modules/elements/transliteration/api.css"
type="text/css" rel="stylesheet"/>
<script type="text/javascript">
// Load the Google Transliteration API
//ÔñÛ ¬ÝÏÞ ÕÏÚ©ÔÅ ÆÉÚШ ÕØ¥Û Ó¨ÞÐ
google.load("elements", "1", {
packages: "transliteration"
});
function onLoad() {
var options = {
sourceLanguage:
google.elements.transliteration.LanguageCode.ENGLISH,
destinationLanguage:
google.elements.transliteration.LanguageCode.HINDI,
shortcutKey: 'ctrl+g',
transliterationEnabled: true
};

// Create an instance on TransliterationControl with the required
// options.
var control =
new google.elements.transliteration.TransliterationControl(options);

// Enable transliteration in the textbox with id
// 'transliterateTextarea'.
control.makeTransliteratable(['<%=Translation.ClientID %>']);
control.makeTransliteratable(['<%=Result.ClientID %>']);
}
google.setOnLoadCallback(onLoad);


</script>
<script type="text/javascript">
function GetChar(event) {
var chCode = ('charCode' in event) ? event.charCode : event.keyCode;
var out1 = document.getElementById('<%=Result.ClientID %>');
var pnb = document.getElementById('<%=Translation.ClientID %>').value;
out1.value += String.fromCharCode(chCode);
}
</script>
</head>
<body>
<form id="form1" runat="server">

<asp:TextBox ID="Translation" runat="server" TextMode="MultiLine" onkeypress="GetChar (event);">

<asp:TextBox ID="Result" runat="server" TextMode="MultiLine" >


</form>
</body>
</html>
...........
above is my code to type in English and convert it in to hindi....
here the value of first textbox is converted into hindi and second is into english.
but i want the the second textbox should be converted into hindi...
Regards.
G.C. Maurya
Posted

1 solution

I recently learned that in India people often use input method based on transliteration. This is not a nice native way; it makes the whole culture fully dependent on English-basic culture, and put local Indian cultures in a submissive position. I guess, the it is deeply rooted in the fact of having many different writing systems in India, more then in the rest of the worlds taken together.

By the way, you should not talk about Hindi, you should talk about the script used in many modern Indian languages and also Sanskrit, this is Devanāgarī, देवनागरी.

I was wondering: did anyone bother to go in a civilized way not based on Latin script, as it is done for Cyrillic, Greek and even for Chinese and Japanese language? This way is making an original keyboard layouts, which can be switched by the standard input language switch.

This problem can be solved using the The Microsoft Keyboard Layout Creator. Please see:
http://msdn.microsoft.com/en-us/goglobal/bb964665.aspx[^].

Basically, you can load this application, create a layout, and then compile the project. It will create a standard "setup.exe" file which provides the installation for different instruction-set architectures, depending on what is used in the target system. Then you install and use it.

Some people from India told me that some scripts are too big to fit in the Western keyboard. That's true, but I don't think this is a stopper. Extra character can be entered using the dead char feature (two keys following each other, producing only one character; please see the help on the application for the explanation). Alternatively, for one script, you can use two, not one keyboard layout, switching between them. After all, I type in Cyrillic using a Western keyboard where some character don't fit, and I don't have Cyrillic letters printed on the keys, nevertheless, I have no hassled typing.

Please use this idea, and you can create decent Indian text input modes, with dignity. If you need some help, I'll gladly provide it. :-)

—SA
 
Share this answer
 
Comments
Bernhard Hiller 31-May-13 2:43am    
My 5 for the very interesting link, I'll create my own layout for easy typing of Eastern European characters (like those with a Czech 'hacek', or the Hungarian versions of umlaut).
A small problem remains: this tool won't help me when I am in some internet shop somewhere in far-away-country and want to write an email in German containing an umlaut.
Sergey Alexandrovich Kryukov 31-May-13 8:25am    
Thank you, Bernhard.

In this case, there is another idea: a Web-based variant of keyboard layout. I know only one site (probably only English/Russian keyboard layout, but with all reasonable variants) which is made perfectly: not only you can click at virtual keyboard and switch layouts conveniently, you can also just type. (Main driving point is the "phonetic" layout which allows to use known Latin keys to enter, say, Cyrillic. Many people, including myself, cannot use "official" Cyrillic layout, the only one provided by Microsoft with Windows, as it is completely unrelated to standard English.)

It's made by Paul Gorodyansky. You can learn how it works and create your own:

http://winrus.com

And this is the keyboard itself:


http://winrus.com/keyboard.htm

—SA
Bernhard Hiller 1-Jun-13 4:25am    
Meanwhile I played with the Keyboard Layout creator: it's a really great tool.
Здравствуйте Сергей! Очен хорошо. Спасибо.
(Spelling errors are caused by my lack of a proper command of Russian).
As for the web site, its functionality is also great. And some reverse engineering before creating a similar functionality for an Indian language should be easy, since with JavaScript, the source code cannot be hidden.
Sergey Alexandrovich Kryukov 1-Jun-13 22:05pm    
It's "Очень", not "очен" :-) Be the way, Russian is way too complex for contemporary level of automatic translators. The results of automatic translation is the endless source of jokes.

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900