我的语言翻译在 Google Chrome 和 IE 中不起作用
我开发了一个网络应用程序,用于将语言从英语翻译成 阿拉伯语。
这是一个模特个人资料页面。如果我单击
,它在页面底部有两个链接 “英语”链接将以英语显示,我有一个“阿拉伯语”链接将以阿拉伯语显示
我可以将非英语值插入到 < strong>MySQL DB并且可以将其检索回来。
我在 Firefox 中下载并更改了区域设置切换器插件,并且还对我的 计算机输入语言。 在 Firefox 中工作正常,但在 GOOGLE CHROME 中无法工作 和IE。当我单击底部的“阿拉伯语”链接时,它甚至没有更改为阿拉伯语
其他浏览器中存在什么问题。我应该做什么才能使我的网络应用程序在 所有浏览器。
编辑:我的英文页面将如下所示。
当我单击阿拉伯语链接时,它将更改为 您可以看到标签的变化。现在我想明白两件事 1. 我希望看到所有浏览器中发生相同的变化。我应该怎么办? 2. 如果我将此 Web 应用程序发送给未安装语言环境的人 系统应该能够访问这两个链接。 我应该如何实现这个目标?我一无所知。
用于插入数据库的服务器端代码:
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 页面对应于两个链接(英语和阿拉伯语是)
<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>
<a id="ArabicLanguageLink" name="ar-SA" href="#"> Arabic</a>
我的 JS 函数初始化(){ $('#EnglishLanguageLink').click(this.changelanguage); $('#ArabicLanguageLink').click(this.changelanguage); 在 name 属性中,
this.changelanguage=function(){
var name = this.name;
$(this).translate("languages/UserPortal.json", name);
};
我将传递语言 en-US 和 ar-SA。它将查看 json 文件并针对语言进行相应的更改。
I developed a web application for the process of Language translation from English to
Arabic.
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
I am able to insert the Non-English values in to the MySQL DB and can retrieve it back.
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.
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.
My Server Side code for inserting into DB:
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;
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>
<a id="ArabicLanguageLink" name="ar-SA" href="#"> Arabic</a>
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);
};
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从您的评论来看,您似乎所需要做的就是更改 Chrome 和 IE 中发送的区域设置。
事实上,它只是在请求标头中作为“Accept-Language”发送。值得注意的是 W3C 在此事上的官方立场,但无论如何,你通过上述链接提供替代方案。
因此,在 Chrome 中,您可以在“字体和语言”下更改它。 IE也会有类似的设置(你可以搜索一下)。
但实际上,这里不存在“问题”;在一个浏览器中测试它(检查此标头)并且您已经在所有浏览器中测试了它。抛开界面/设计/无论什么问题,你不需要在所有浏览器中测试这个,恕我直言。
我把它留给你了。
From your comments, it seems all you need to do is change the locale that is sent in Chrome and IE.
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.
So, in Chrome you can change it under "Fonts and Languages". I.E. will have a similar setting (you can search for it).
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.
I leave it with you.