Hello ...
i would like to know how can i use trans method in js file .
i have install mcamara package and i can use trans method in blade only like
{{ trans('countries.Active') }}
i use the in js file but not working
thanks
$(document).on("click", ".form-check-input", function () {
let cb = document.getElementById("CountryStatus");
let text = document.getElementById("CountryStatusText");
if (cb.checked == true) {
text.value = "'{{ trans('countries.Active') }}'";
text.style.color = "green";
} else {
text.value = "'{{ trans('countries.NotActive') }}'";
text.style.color = "red";
}
});
@Khalid475 js cannot parse php, so you need to pass all translations to js and have a helper function in js to read them. This what the package we shared is for