I have built an application with JSF and all messages issued by the server are localized with resource bundles.
My question is: how to get messages issued in the client browser with javascipt localized with the messages stored in the resource bundles?
Do I have to generate javascript dynamically and if so how can this be done?
For example, how can I have the server localize the «alert» javascript message in the following form validation method:
function valider() {
typeActionRadio = document.getElementById("membres_editer_creer:typeActionAdr");
if (typeActionRadio.style.display == "block") {
var boutonsRadio = document.forms["membres_editer_creer"]["membres_editer_creer:typeActionAdr"];
for ( var i = 0; i < boutonsRadio.length; i++)
if (boutonsRadio.item(i).checked) return true;
}
alert ("Vous devez indiquer la raison du changement d'adresse (bouton radio à sélectionner).");
return false;
}