<%@ Page Title="" Language="C#" MasterPageFile="~/whir_system/master/SystemMasterPage.master"
    AutoEventWireup="true" CodeFile="language_edit.aspx.cs" Inherits="whir_system_module_developer_language_edit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="mainbox">
        <dl class="title_column">
            <a href="language.aspx"><b>多语言设置</b></a> <em class="line"></em>
            <asp:HyperLink ID="hlkEdit" runat="server" CssClass="aSelect" NavigateUrl="language_edit.aspx"><b>添加语言配置</b></asp:HyperLink>
        </dl>
        <div class="line_border">
        </div>
        <div class="All_table">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                    <td width="100" class="item">
                        简体中文:
                    </td>
                    <td>
                        <whir:TextBox ID="txtCN" runat="server" Width="300px" Height="80px" TextMode="MultiLine"
                            CssClass="text_common" ErrorCss="form_error" TipCss="form_tip" Required="true"></whir:TextBox>
                    </td>
                </tr>
                <tr>
                    <td width="100" class="item">
                        繁体中文:
                    </td>
                    <td>
                        <whir:TextBox ID="txtHK" runat="server" Width="300px" Height="80px" TextMode="MultiLine"
                            CssClass="text_common" ErrorCss="form_error" TipCss="form_tip" Required="true"></whir:TextBox>
                    </td>
                </tr>
                <tr>
                    <td width="100" class="item">
                        英文:
                    </td>
                    <td>
                        <whir:TextBox ID="txtEN" runat="server" Width="300px" Height="80px" TextMode="MultiLine"
                            CssClass="text_common" ErrorCss="form_error" TipCss="form_tip" Required="true"></whir:TextBox>
                    </td>
                </tr>
                <script type="text/javascript">
                    $(function () {

                        //中文自动翻译
                        $("#<%=txtCN.ClientID %>").blur(function () {
                            var txtEn = $("#<%=txtEN.ClientID %>");
                            if ($(this).val() != "" & txtEn.val() == "") {
                                txtEn.val("...");
                                $.ajax({
                                    type: "GET",
                                    url: "<%=SysPath %>ajax/common/translater.aspx",
                                    data: "source=" + encodeURI($(this).val()) + "&from=zh-cn&to=en",
                                    success: function (msg) {
                                        txtEn.val(msg);
                                        txtEn.blur();
                                    },
                                    error: function (response) {
                                        whir.toastr.warning("翻译失败");
                                    }
                                });
                            }

                            //翻译繁体中文
                            var txtHk = $("#<%=txtHK.ClientID %>");
                            if ($(this).val() != "" & txtHk.val() == "") {
                                txtHk.val("...");
                                txtHk.focus();
                                $.ajax({
                                    type: "GET",
                                    url: "<%=SysPath %>ajax/common/translater.aspx",
                                    data: "source=" + encodeURI($(this).val()) + "&from=zh-cn&to=zh-tw",
                                    success: function (msg) {
                                        txtHk.val(msg);
                                        txtHk.blur();
                                    },
                                    error: function (response) {
                                        whir.toastr.warning("翻译失败");
                                    }
                                });
                            }

                        });

                        //英文自动翻译
                        $("#<%=txtEN.ClientID %>").blur(function () {
                            var fieldName = $("#<%=txtCN.ClientID %>");
                            if ($(this).val() != "" & fieldName.val() == "") {
                                fieldName.val("...");
                                $.ajax({
                                    type: "GET",
                                    url: "<%=SysPath %>ajax/common/translater.aspx",
                                    data: "source=" + encodeURI($(this).val()) + "&from=en&to=zh-cn",
                                    success: function (msg) {
                                        fieldName.val(msg);
                                        fieldName.blur();
                                    },
                                    error: function (response) {
                                        whir.toastr.warning("翻译失败");
                                    }
                                });

                            }
                        });
                    });
                </script>
            </table>
            <div class="button_submit_div">
                <asp:LinkButton ID="btnSave" runat="server" CssClass="aLink" OnCommand="Save_Command"
                    CommandName="Save">
                <em><img src="<%= SysPath %>res/images/button_submit_icon_1.gif" /></em><b>提交并返回</b>
                </asp:LinkButton>
                <asp:LinkButton ID="btnSaveContinue" runat="server" CssClass="aLink" OnCommand="Save_Command"
                    CommandName="SaveContinue">
                <em><img src="<%= SysPath %>res/images/button_submit_icon_2.gif" /></em><b>提交并继续</b>
                </asp:LinkButton>
                <a class="aBack" href="language.aspx"><b>返回</b></a>
            </div>
        </div>
    </div>
</asp:Content>
