<script type="text/javascript">
$('.ask').on('click', function () {
var message = "{{ __('so.fields.are-you-sure') }}";
confirm(message);
}
</script>
I wanna shown Yes, No text which is in Lang file on confirm button. How can i do this ? Which code I must add ?
Or is this possible with jqeury?
CodePudding user response:
Your code works, just make sure that the translation exists
according to the attached snippet it should be found in
en/so/fields.php file - en is the language dir as example
and contains the index
return [
'are-you-sure' => 'Are you Sure!',
];
But, if you are asking about localizing the confirm buttons
this method depends on the language of web browser,
not your preferred language
instead of using confirm you can use jQuery UI Dialog's modal confirmation
so you can translate the buttons & customize the dialog as you like.
Hope this helps you!
