问题
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

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.
回答1:
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.
来源:https://stackoverflow.com/questions/4255436/my-language-translation-does-not-work-in-google-chrome-and-ie