简体   繁体   English

如何使Google翻译在asp.net中适用于文本框?

[英]How to get Google translate to work for textboxes in asp.net?

I have an asp.net website in which I have used google translate to translate the text from English to Hindi or Marathi.Here is a part of the code: 我有一个asp.net网站,在其中我已使用Google翻译将文本从英语翻译为北印度语或马拉地语。以下是代码的一部分:

<head>
<meta name="google-translate-customization" 
content="3280487709591956-dc3fc45d489f056a-g5378ebab0cbcd0a4-12"/>   
</head>

<div id="google_translate_element">            
<asp:TextBox ID="txtQuestion" runat="server" Height="101px" TextMode="MultiLine"
Width="627px" meta:resourcekey="txtQuestionResource1" AutoPostBack="True">
</asp:TextBox>
</div>

<script type="text/javascript">
function googleTranslateElementInit()
{
    new google.translate.TranslateElement({ pageLanguage: 'en', 
    layout:google.translate.TranslateElement.InlineLayout.SIMPLE }
    ,'google_translate_element');
 }
</script>

<script type="text/javascript" 
src="//translate.google.com/translate_a/element.js? cb=googleTranslateElementInit">
</script>

Now, when I select the language say Hindi, what happens is that, the entire website text including the text in labels,dropdownlists etc. gets translated but the textbox text remains as it is.I want the textbox text to change as well.Kindly let me know where I am going wrong and how to get the textbox text translated ? 现在,当我选择说印地语的语言时,会发生这样的情况,包括标签,下拉列表等中的整个网站文本都被翻译了,但文本框文本保持原样。我希望文本框文本也能更改。让我知道我要去哪里错了以及如何翻译文本框文本?

I think in this situation you should probably take a look at angular.js, it will suit your your needs best. 我认为在这种情况下,您可能应该看一下angular.js,它会最适合您的需求。

You can wrap the service layer up in a model and put it in a controller so you can make it responsive for your controls on your page. 您可以将服务层包装在模型中,然后放入控制器中,以便使其对页面上的控件具有响应性。

https://angularjs.org/ https://angularjs.org/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM