我的语言翻译在Google Chrome和IE中无效 [英] My Language translation does not work in Google chrome and IE

查看:147
本文介绍了我的语言翻译在Google Chrome和IE中无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个网络应用程序,用于从英语到
阿拉伯语的语言翻译过程。

它是一个模型简介页面。如果我点击

英文链接,它会在页面底部显示两个链接,它将以英文显示,我有一个阿拉伯语将以阿拉伯语显示的链接

it is a model profile page. Its has two links in the bottom of the page if I click the
"English" link it will display in English and i have a "Arabic" link which will display in Arabic

我可以将非英语值插入 MySQL DB 并可以将其检索回来。

I am able to insert the Non-English values in to the MySQL DB and can retrieve it back.

我在Firefox中下载并更改了 Locale Switcher插件,并对我的
计算机输入语言进行了更改。 它在Firefox中正常运行但它无法在 GOOGLE CHROME
IE 中运行。当我点击底部的阿拉伯语链接时,它甚至没有更改为阿拉伯语

I downloaded and changed the Locale Switcher plugin in Firefox and also made changes for my computer input language. Its working fine in Firefox but it is not working in GOOGLE CHROME and IE. its not even changing to Arabic language when i click the 'Arabic" link in bottom

其他浏览器有什么问题。我应该怎么做才能使我的网站 - 应用程序在
所有浏览器中工作。

What is the problem in the other browsers. What should I do to make my Web-App work in all of the browsers.

编辑:我的英文页面将如下所示。

Edit: My English page will Look Like this.

当我点击阿拉伯语链接,它将更改为
你可以看到标签的变化。现在我想要两件事情来理解
1.我想看到所有浏览器都发生了相同的变化。我该怎么办?
2.如果我发送这个网络应用程序到一个没有在他的
系统中安装了语言环境的人应该能够访问这两个链接。
我应该如何实现这一点?我无能为力。

When I click the Arabic Link it will change as You can see the changes in label. Now i want two things to understand 1. I want see the same changes happening in all the browsers. what should I do? 2. If i am sending this web app to a person who doesnot have a locale installed in his system should be able to access both the links. How should i achieve this? i am clueless.

用于插入数据库的我的服务器端代码:

            try{
        con = LanguageTranslation.getConnection();
        System.out.println("Inside try");
        PreparedStatement pstmt = con.prepareStatement("INSERT INTO    TRANSLATE SET NAME= ?, SEX= ?, CITY= ?, COMMENTS= ?, BMONTH= ?, BDATE= ?, BYEAR= ? ");
        pstmt.setString(1, details.getName());
        pstmt.setInt(2, details.getSex());
        pstmt.setString(3, details.getCity());
        pstmt.setString(4, details.getComment());
        pstmt.setString(5, details.getMonth());
        pstmt.setString(6, details.getDate());
        pstmt.setString(7, details.getYear());
        i=pstmt.executeUpdate();
            }
            catch(SQLException e){
        e.printStackTrace();            
            }
           return details;

更新:
我的 html 对应于这两个链接的页面(英语和阿拉伯语)

Update: My html page corresponding to both the links(English and Arabic is)

       <input type="button" id="clearbutton" value="clear" onclick="clearprofile()">
       <input type="button" id="findbutton" value="find" onclick="finddetails()">
       </div> 
       <a id="EnglishLanguageLink" name="en-US" href="#"> English</a>
       &nbsp;
       <a id="ArabicLanguageLink" name="ar-SA" href="#"> Arabic</a>

我的 JS
函数Intialize(){
$('#EnglishLanguageLink')。click(this.changelanguage);
$('#ArabicLanguageLink')。click(this.changelanguage);
}

My JS function Intialize(){ $('#EnglishLanguageLink').click(this.changelanguage); $('#ArabicLanguageLink').click(this.changelanguage); }

       this.changelanguage=function(){
       var name =   this.name;
       $(this).translate("languages/UserPortal.json", name);    
        };  

在name属性中,我将传递en-US和ar-SA语言。这将看到json文件并对该语言进行相应的更改。

Inside the name attribute I will pass the languages en-US and ar-SA. which will see the json file and make the corresponding changes for the language.

推荐答案

从您的评论中,您似乎只需要do是更改在Chrome和IE中发送的区域设置。

From your comments, it seems all you need to do is change the locale that is sent in Chrome and IE.

事实上,它只是在Request标头中以Accept-Language发送。值得注意的是W3C对此事的官方立场,但无论如何,你通过上述链接提供替代方案。

Infact, it's just sent in the Request headers as "Accept-Language". Worth noting W3C's official stance on this matter, but anyway, you provide alternatives via the aforementioned link.

因此,在Chrome中,您可以在字体和语言下进行更改。 I.E.将有类似的设置(你可以搜索它)。

So, in Chrome you can change it under "Fonts and Languages". I.E. will have a similar setting (you can search for it).

但实际上,这里没有问题;在一个浏览器中测试它(检查这个标题),你已经测试过了。接口/设计/除了问题之外,你不需要在所有浏览器中测试 this ,恕我直言。

But really, there is no "issue" here; test it in one browser (the checking of this header) and you've tested it in all. Interface/Design/Whatever issues aside, you don't need to test this in all browsers, IMHO.

我把它留给你。

这篇关于我的语言翻译在Google Chrome和IE中无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆