Localization gives us callbacks, but you must also find the language that the user has chosen to use the json file of the language you are using. To do this, go to jqeury.localize.js file and make a global variable at the top of the file
var globallanguage;
After that, go to line 185, where the code below exists, and enter the "langball" input variable "globallanguage".
lang = normaliseLang(options.language ? options.language : $.defaultLanguage);
globallanguage=lang;
Now you have the user selection saved in "globallanguage". Then you can go to any file you want and use the code below to get the translation.
var message;
var messagetitle;
$("[data-localize]").localize("i18n/site",
{ language: globallanguage,
callback: function(data, defaultCallback)
{message = data.alert.incidentalert.LEAVE;
defaultCallback(data);
}});
$("[data-localize]").localize("i18n/site",
{ language: globallanguage,
callback: function(data, defaultCallback)
{messagetitle = data.alert.incidentalert.LEAVEHEADER;
defaultCallback(data);
}});
, JSON, .
SwalAlert2 SWAL .
swal({
title : messagetitle,
text : message,
type : "warning",
showCancelButton : true,
confirmButtonColor : "#e54747",
confirmButtonText : button,
closeOnConfirm : false
}).then(function () {
- , , SweetAlerts JS-librady , ...