sweetalert Laravel希腊语languege不正确地返回

时间:2016-06-10 08:19:34

标签: php laravel sweetalert

我的控制器

 alert()->success(trans('msg.TRANSLATE'), 'success');
 return \Redirect::to('foo');

在我的刀片上

// This Not Working   
 @if( session()->has('sweet_alert_message'))
        <script>
            swal(
                    {
                        title: "{{ session('sweet_alert_message.title' )}}",
                        text: "{{ session('sweet_alert_message.message')}}",
                        type: "{{ session('sweet_alert_message.type')}}",
                        timer: 3000,
                        showConfirmButton: false
                    }
            );
        </script>
    @endif

问题是希腊语返回中文... 但如果我把希腊语直接放在swal希腊语上,那就完美了

// This example working 
    @if( session()->has('sweet_alert_message'))
        <script>
            swal(
                    {
                        title: "Αυτή η ενέργεια δεν επιτρέπεται",
                        text: "Αυτή η ενέργεια δεν επιτρέπεται",
                        type: "error",
                        timer: 3000,
                        showConfirmButton: false
                    }
            );
        </script>
    @endif

1 个答案:

答案 0 :(得分:1)

第一个解决方案

   $msg =  json_encode(trans('msg.TRANSLATE'));

    alert()->success($msg, 'success');
    return \Redirect::to('foo');

第二个解决方案

  title: "δεν επιτρέπεται", // Don't use so many latters try somthink like this 

在我工作..