Localization for javascript confirmation buttons

I am working with the Confirm field in javascript. For all browsers, I found that when changing the language of the browser, the language of the confirmation button in the Confirmation field does not change. I tested chrome, firefox, changing the language to French. But the button shortcut does not translate. The β€œOK” and β€œCancel” labels do not change to another language.

Please note: I am trying to see a localized string in the confirmation field.

+6
source share
1 answer

It is not possible to use the confirm() and alert() JavaScript functions and have reliable results. It just depends on the language of the web browser, that is, the program , and not your preferred language.
The preferred language is used to tell the web server what your language preferences are for the web page .

So, how to localize confirmation dialogs or messages, you would ask?
Well, get rid of them. Instead, please use the jQuery UI Dialog modal confirmation and follow your regular localization method for JavaScript string resources.
This is the only way to get confirmation dialog headers and buttons reliably translated into the language of your web application.

+8
source

All Articles