Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Localization for javascript confirmation buttons

I am working with Confirm box in javascript. For all browsers i found that when change the language of the browser, the confirmation button language in Confirm box doesn't change. I tested on chrome, firefox by changing the language to french. But the buttons label is not translated. Label of "OK" and "Cancel" doesn't change to other language.

Please Note : I am trying to see the localized string on confirmation box.

like image 964
insomiac Avatar asked Dec 04 '12 00:12

insomiac


1 Answers

There is no way to use confirm() and alert() JavaScript functions and have reliable results. It simply depends on the language of web browser, that is the program, not your preferred language.
The preferred language is used to tell the web server what is your preference in reference to the web page language.

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

like image 60
Paweł Dyda Avatar answered Oct 19 '22 23:10

Paweł Dyda