Home > other >  How do I add laravel "translation strings" to the return confirm()
How do I add laravel "translation strings" to the return confirm()

Time:01-15

How do I add "translation strings" to the words "Are you sure?"

Like this __('Are you sure?')

I tried adding __ but it got an error.

{{ Form::open(array('route' => array(
          'admin.users.change_status', $user->id),
          'method' => 'patch',
          'onsubmit' => 'return confirm("Are you sure?")'
    )) }}

CodePudding user response:

You would have to escape the string you're making, because clientside is not aware of serverside localisation methods.

{{ Form::open(array('route' => array(
      'admin.users.change_status', $user->id),
      'method' => 'patch',
      'onsubmit' => 'return confirm("' . __('Are you sure?') .'")'
)) }}
  •  Tags:  
  • Related