News wrote:
I need help with confirm() funciton.
I have an application that displays pages in English and French languages.
What I need is to display buttons upon clicking confirm(), buttons for
English obviously Ok and Cancel, for French users Ok and Annuler.
You can't - with window.confirm. The only option is to write your own
DHTML dialog. But in a multilingual UA the button labels depend on
chosen installation language, say in English IE it will be OK / Cancel,
in French IE OK / Annuler - without your intervention.
Naturally it is possible to have a French visitor using English browser
version - but nothing you can do, again besides writing your own DHTML
widget or taking a ready one.
Actually a real problem not with button labels, but with the dialog
message itself. While "OK" is mainly OK everywhere :-), what about
Cancel?
"To stop transaction please press..." Cancel? Annuler? Abbrechen?
I mean you can translate the start, but what to place at the end? Gives
me a headache every time I need to make some multilanguage project.
It would be *really* nice IMHO to have some predefined global string
constants like OK_Label or CANCEL_Label to simply insert them into
messages.