views:

612

answers:

2

In a multi-language web site, can I rely on the javascript confirm to translate the text of the Ok/Cancel buttons? If so, is it related to the browser or OS language setting?

+8  A: 

My OS language is French and the OK and Cancel buttons are in french so the answer is : yes!

IE :

IE

Firefox :

Firefox

Chrome :

Chrome

Olivier PAYEN
What does your Firefox or Chrome do?
Crescent Fresh
And your OS install is in french, this post doesn't really provide any insight on why they are localized.
Andrew Moore
+10  A: 

The OK/Cancel button in Internet Explorer will obey the Operating System UI language settings.

The technical reason is that IE is using the MessageBox Win32 API call to display its Javascript dialog box. That API relies on the OS UI language and not the browser UI language, as it is owned by the OS.

As for 3rd party browsers, it really depends if they are using MessageBox or not to display their box. If they are, it will obey to the Operating System language, if not, it will obey to the browser UI language.

EDIT: Firefox and Chrome are not using MessageBox so technically they should be following the browser UI language settings, though I don't have a french install to test it on. CONFIRMED


If you must localize your buttons, your best bet would be a modal DHTML dialog.

Andrew Moore
ie: you could install the french-language firefox on an german-language windows xp. Now what should confirm show? +1
Joel Coehoorn
In IE6, at least, the languages dialog says "Menus and Dialogs are currently displayed in ...." at the bottom. It doesn't change based upon your browser's language, which supports this.
Greg
**@Joel:** A french install of Firefox will have its buttons localized in french no matter what the OS UI language is.
Andrew Moore