在翻译成另一种语言之前,如何使用重复的变量存储原始数据

时间:2019-05-21 13:27:53

标签: javascript jquery html css

english text should be stored instead of hindi取决于语言(例如:英语),我必须在浏览器上以特定语言显示文本,如图所示,并且必须将该文本存储到数据库中。但是通过使用谷歌翻译器,客户正在翻译成另一种语言(例如印地文),并且该语言(印地语)正被存储到数据库中。我的要求是,即使客户使用Google翻译,我也必须将英文文本存储到数据库中。我的客户建议是,将英语文本存储到另一个变量中,并将包含英语的变量发送到服务器,以便我可以保存到数据库。我该怎么做到

如果用户选择特定语言,则下面的

是html / css代码。文字语言取决于userlang变量

    <div id="videocontent" class="HT-Div"><%try{if (comboFlag == 0) {if (userLang.equals("hi")) {%><span i18n="video.i">I</span>,<b> ${vidProposerName} </b> 
                        <c:choose>
                <c:when  test="${apptype =='A'}">  
                            <span i18n="video.appno">application number </span>
                </c:when>
                <c:otherwise>
                        <span i18n="video.trasno"> Transaction ID </span>
                </c:otherwise> 
            </c:choose>


                        <% if(tfl.equalsIgnoreCase("Y")){%>
 <b> ${vidApplicationNumber} </b><span i18n="video.niti">niti text</span><b> ${vidplanName} </b> <span i18n="video.se">se</span> <b> ${vidPolicyTerm} </b> <span i18n="video.saal">saal text</span><span i18n="video.fstyear"> fst year text </span><b> &#8377 ${dsp} </b><span i18n="video.and">rs aur</span>  <b> ${vidComboPremiumPayTerm1 - 1} </b> <span i18n="video.yfor">year for </span><b>&#8377 ${mopr}</b> <span i18n="video.rupeyyesr">rupey yesr</span> <span i18n="video.lasttexttfl">last texttfl</span>
<%}else{ %><b> &#8377<b> ${vidApplicationNumber} </b><span i18n="video.niti">niti text</span><b> ${vidplanName} </b> <span i18n="video.se">se</span> <b> ${vidPolicyTerm} </b> <span i18n="video.saal">saal text</span> <b>&#8377 <label id="lblenPremiumAmt"> </label> <input type="hidden" id="hfenPremiumAmt" value="${vidPremiumAmt} "></b> <span i18n="video.rupey">rupey </span> <span>${vidModelFrequency}   </span>, <span i18n="video.agle"> agle </span> <b>${vidComboPremiumPayTerm1} </b> <span i18n="video.lasttext"> last text </span><%}
} 
//done - Archit
else if (userLang.equals("kn")) {if(tfl.equalsIgnoreCase("Y")) {%><span i18n="video.i">I</span> <b> ${vidProposerName} </b> <span i18n="video.appno">application number </span><b> ${vidApplicationNumber}</b>, <b>${vidPolicyTerm}</b> <span i18n="video.nitidisc">nitidesc text</span>  <b> &#8377 ${dsp}</b> <span i18n="video.disctext1">disctext1</span> <b> &#8377 <label id="lblenPremiumAmt"> </label> <input type="hidden" id="hfenPremiumAmt" value="${vidPremiumAmt}"> </b> <span> ${vidModelFrequency} </span> <b>${vidComboPremiumPayTerm1} </b><span i18n="video.disctext2">disc text2</span><%} 
                                                           else{%><span i18n="video.i">I</span> <b> ${vidProposerName} </b> <span i18n="video.appno">application number </span><b> ${vidApplicationNumber}</b>, <b>${vidPolicyTerm}</b> <span i18n="video.niti">niti text</span> <b>${vidComboPremiumPayTerm1}</b> <span i18n="video.knppt"> knppt </span> <b> &#8377 <label id="lblenPremiumAmt"> </label> <input type="hidden" id="hfenPremiumAmt" value="${vidPremiumAmt}"> </b>, <span> ${vidModelFrequency} </span> <span i18n="video.knlsttxt"> knlsttxt </span><%} 

javascript函数将数据发送到服务器

function uploadToServer(blob, callback) {               
    var videocontent1= encodeHtmlEntity( $("#videocontent").text());    

    var res = encodeURIComponent(videocontent1);

    //var res = htmlEncode(videocontent1);
    var formData = new FormData();
    formData.append('formData', blob);                
    formData.append('videocontent', res);

    $.ajax({

        url: 'testuploadvideo',
        data: formData,

       type: 'POST',
        contentType: false, 
        processData: false, 
        success : function(data){
            if(data.status == 'success'){
                window.location.href ='psccompleted';
                }else{
                        alert("upload failed");
                    }
            }
    });
}

如果用户使用Google翻译器进行翻译,则videocontent值将变为印地语。

如何获取英语文本格式

0 个答案:

没有答案