MenuMenu

RTCMultiConnection.autoTranslateText

Convert all incoming chat (text) messages into your preferred language

Set boolean

connection.language = 'ja'; // choose target language

connection.autoTranslateText = true;

// you can use "e.data" and "e.original"
connection.onmessage = function(e) {
   // e.data     ---- japanese text
   // e.original ---- original text
};

Description

parameterdescription
autoTranslateText It is a boolean, that can be either "true" or "false"

Demo

<script src="https://rtcmulticonnection.herokuapp.com/dist/RTCMultiConnection.min.js"></script>
<script src="https://rtcmulticonnection.herokuapp.com/socket.io/socket.io.js"></script>

<script>
var connection = new RTCMultiConnection();

// this line is VERY_important
connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/';

// if you want to open data channels
connection.session = {
    data: true
};

connection.openOrJoin('your-room-id');

connection.language = 'ja'; // choose a language

connection.autoTranslateText = true;

// you can use "e.data" and "e.original"
connection.onmessage = function(e) {
    // e.data     ---- japanese text
    // e.original ---- original text
};
</script>