Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a textbox in that textbox if i type some text n press space or tab from keyboard the text is translating from english to kannada,Now I m taking one button i want to translate on button click event.plss help me how can i do this..thank u
Posted
Comments
kishore Rajendran 28-Mar-12 0:09am    
Transfer the code you used in keypress event to button click event

Generally your text is converting to kannada when your focus moves from the respective textBox.
So on your design page, double click on the button , the aspx.cs page ll be opened with this tag-
protected void Button1_Click1(object sender, EventArgs e)
{
}

Paste the conversion code here, then u can achieve the same with button Click event.
Gotaitu ankotini..:-)

All the very Best
 
Share this answer
 
Comments
jjjjjjjjjjjssssssssssssaaaaaaaaaa 28-Mar-12 4:45am    
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
<HTML
xmlns:o>
<HEAD>
<TITLE>Gujarati
translation-Ravishankar</TITLE>
<script
type="text/javascript" src="http://www.google.com/jsapi"></script>

<script
type="text/javascript">
google.load("elements",
"1", {
packages:
"transliteration"

});
function onLoad()
{
var options =
{
sourceLanguage:
google.elements.transliteration.LanguageCode.ENGLISH,
destinationLanguage:
google.elements.transliteration.LanguageCode.GUJARATI,
shortcutKey:
'ctrl+g',
transliterationEnabled:
true
};
var
control =
new
google.elements.transliteration.TransliterationControl(options);
control.makeTransliteratable(['transliterateTextarea']);

}

google.setOnLoadCallback(onLoad);
</script>

</HEAD>
<BODY><div
class="base" align="center">


<TABLE class="standard"
width="1200">
<TBODY>
<TR>

<TD
class="mainPanel">
<TABLE>
<TBODY>
<TR>
<TD
vAlign="top"
width="800">
<TABLE
cellPadding="5">
<TBODY>
<TR>
<TD>

<form
name="convarea" action=""
ID="Form1">
<table
ID="Table2">
<tr>
<td
align="center">
<textarea
id="transliterateTextarea" style="width: 550px; height: 220px"
name="DraftxData"></textarea>
</td>
</tr>
<tr>
<td
style="color:
Gray">
(Press
Ctrl+g to toggle between English and
Gujarati)
</td>
</tr>

</table>
</form>



</div></BODY>
</HTML>
3/27/2012

Hello sir this my code in aspx page i have used javascript i have not written any code in cs page now i wanna translate on button click event how can i do that..
Here's a sample method working for the seven letters of "tajmhal" (it may need some tweaking if groups of latin letters must be replaced by one Gujarati character):
C#
public static string Transliterate(string latinCharacters)
{
        StringBuilder gujarati = new StringBuilder(latinCharacters.Length);
        for (int i = 0; i < latinCharacters.Length; i ++)
        {
                switch (char.ToLower(latinCharacters[i]))
                {
                        case 'a':
                                gujarati.Append('\u0abe');
                                break;
                        case 'h':
                                gujarati.Append('\u0ab9');
                                break;
                        case 'j':
                                gujarati.Append('\u0a9c');
                                break;
                        case 'l':
                                gujarati.Append('\u0ab2');
                                break;
                        case 'm':
                                gujarati.Append('\u0aae');
                                break;
                        case 't':
                                gujarati.Append('\u0aa4');
                                break;
                }
        }
        return gujarati.ToString();
}
 
Share this answer
 
v2

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