加入网站后如何更改Messenger语言?

时间:2019-02-28 13:12:04

标签: javascript laravel messenger

我的网站中有多种语言。我已经使用以下方法添加了Messenger:

db.collection.update(  {
   "_id": 1,
   "codes.name":{$in:{"code2","code3","code4"}}
},{$set:{"codes.$.active":true}})

是否可以根据会话的本地语言来更改Messenger语言?

1 个答案:

答案 0 :(得分:0)

<script type="text/javascript">
        window.fbAsyncInit = function() {
        FB.init({
            appId: 'my_app_id',
            autoLogAppEvents: !0,
            xfbml: !0,
            version: 'v3.0'
        })
    };
    (function(d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) {
            return
        }
        js = d.createElement(s);
        js.id = id;
        @if(Session::get('locale') == 'ar')
        js.src = "https://connect.facebook.net/ar_AR/sdk/xfbml.customerchat.js";
        @elseif(Session::get('locale') == 'fr')
        js.src = "https://connect.facebook.net/fr_FR/sdk/xfbml.customerchat.js";
        @elseif(Session::get('locale') == 'en')
        js.src = "https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js";
        @endif
        fjs.parentNode.insertBefore(js, fjs)
    }(document, 'script', 'facebook-jssdk'))
</script>