Issue
<script type="text/javascript">
$('.ask').on('click', function () {
var message = "{{ __('so.fields.are-you-sure') }}";
confirm(message);
}
</script>
I want to show Yes, No text which is in Lang file on confirm button. How can I do this? Which code do I need to add?
Or is this possible with jQuery?
Solution
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.
Answered By - Omar Tammam Answer Checked By - Terry (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.