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?
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
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. CONFIRMEDIf you must localize your buttons, your best bet would be a modal DHTML dialog.
My OS language is French and the OK and Cancel buttons are in french so the answer is : yes!
IE :
removed dead ImageShack link
Firefox :
removed dead ImageShack link
Chrome :
removed dead ImageShack link