Extension settings
- Login to CometChat and select your app.
- Go to the Extensions section and enable the Message Translation extension.
How does it work?
The messages translation extension allows the receivers of the message to translate it in the language of their choice. In a group of multi-lingual people, a message sent by one of the participants can be in English. However, it can be translated by other members of the group to their languages. We support translations in the following languages:Language | Language code |
---|---|
Afrikaans | af |
Albanian | sq |
Amharic | am |
Arabic | ar |
Armenian | hy |
Azerbaijani | az |
Bengali | bn |
Bosnian | bs |
Bulgarian | bg |
Catalan | ca |
Chinese (Simplified) | zh |
Chinese (Traditional) | zh-TW |
Croatian | hr |
Czech | cs |
Danish | da |
Dari | fa-AF |
Dutch | nl |
English | en |
Estonian | et |
Farsi (Persian) | fa |
Filipino, Tagalog | tl |
Finnish | fi |
French | fr |
French (Canada) | fr-CA |
Georgian | ka |
German | de |
Greek | el |
Gujarati | gu |
Haitian Creole | ht |
Hausa | ha |
Hebrew | he |
Hindi | hi |
Hungarian | hu |
Icelandic | is |
Indonesian | id |
Irish | ga |
Italian | it |
Japanese | ja |
Kannada | kn |
Kazakh | kk |
Korean | ko |
Latvian | lv |
Lithuanian | lt |
Macedonian | mk |
Malay | ms |
Malayalam | ml |
Maltese | mt |
Marathi | mr |
Mongolian | mn |
Norwegian (Bokmål) | no |
Pashto | ps |
Polish | pl |
Portuguese (Brazil) | pt |
Portuguese (Portugal) | pt-PT |
Punjabi | pa |
Romanian | ro |
Russian | ru |
Serbian | sr |
Sinhala | si |
Slovak | sk |
Slovenian | sl |
Somali | so |
Spanish | es |
Spanish (Mexico) | es-MX |
Swahili | sw |
Swedish | sv |
Tamil | ta |
Telugu | te |
Thai | th |
Turkish | tr |
Ukrainian | uk |
Urdu | ur |
Uzbek | uz |
Vietnamese | vi |
Welsh | cy |
Implementation
The extension uses thecallExtension()
method provided by CometChat SDKs.
The messages will be translated according to the languages specified by the receiver. You can specify the languages for translation as an array. If you pass in an empty array, the language will default to English.
callExtension()
method. It will have the following JSON structure:
Translating at the sender’s end
If the languages of the end-users/receivers are known before hand, this method of implementation can be used. That is, before your triggerCometChat.sendMessage
method, make a call to the message translation extension as mentioned above. Since the message has not been sent yet, the msgId
won’t be available and can be skipped in that call.
Once you get the response, make an entry in your message’s metadata as shown below: