> For the complete documentation index, see [llms.txt](https://sinitic.gitbook.io/knowledge-base/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sinitic.gitbook.io/knowledge-base/webchat-apis/using-webchat-and-chatcenter-with-different-teams-and-languages.md).

# Using Webchat and ChatCenter with Different Teams and Languages

Create a team for each language that will require support.![](https://3596211051-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LKRxyYN947NtZeWKUi5%2F-LU15RZi_7aa0zaEtqGl%2F-LU15ugHsuACwABZvVVy%2FScreen%20Shot%202018-12-18%20at%2011.16.55%20AM.png?alt=media\&token=190b6f05-f84f-4fdd-ad6a-db90a95177e2)

**If the target website uses different URLs or domains for different languages.** i.e.: [https://website.com/**en**/games.html](https://website.com/en/games.html) / [https://website.com/**jp**/games.html](https://website.com/jp/games.html)​

Paste the code of the team that is assigned to the specified language to the adjacent URL or domain (the code can be found in ChatCenter settings under the team setting). When users visit /jp/games.html the website source code contains the code generated for Team JP.

**If the target website does not use unique URLs for different languages.** If the target website does not use unique URLs for different languages and instead uses javascript to handle website localizations, we need to switch the team programmatically using Sinitic webchat API.

## Change the agent team

To switch a team, you can call javascript function `window.$sinitic.api('setTeam', ateamId)` with `ateamId` from the generated code snippet![](https://lh6.googleusercontent.com/E_dB-lIKcH1PPd5yCYNUzNDcHhIUwYXEPfPWm4EWmItzaEoLp-r49xVuD-VCU6QEo5n22MK9f5FBNKi_aBYCpEh2mbQ2Ir1Ja6dr0EzoHb9polUhROcRquiEdosaJDf0LedK8xQv)

**The following example demonstrates the use of Webchat and the results of when a website language is switched:**

1. User visits `https://website.com/en/about`
2. The website loads javascript code generated by the Sinitic platform with `ateamId:` **`ateam_JY7e8w`**
3. The user switches the website language to Japanese

   &#x20;a. If the website redirects to `https://website.com/jp/about`, then a new code is loaded with `ateamId:` **`ateam_eT4BF9`**

   &#x20;b. If the website does not redirect and only changes the language setting in javascript, the website needs to call the method `$sinitic.api(‘setTeam’,` **`’ateam_eT4BF9’`**`)`
4. All following conversations will be assigned to the team with id **ateam\_eT4BF9**

*Note: Teams cannot be switched amidst an active conversation, for the change of a team to take effect, the conversation needs to be closed and then reopened.*

## Change the language of webchat UI and welcome screen

We support the following display language:

| Language            | code    |
| ------------------- | ------- |
| English             | `en`    |
| Traditional Chinese | `zh_TW` |
| Simplified Chinese  | `zh_CN` |
| Japanese            | `jp`    |
| Vietmanese          | `vi`    |
| Indoesian           | `in`    |
| Thai                | `th`    |

Default UI language is the master language of your bot. If you need to change it lively,  you can call `$sinitic.api('setLang', code)`

## Toggle Chat Window

We also provide `toggleChat` api to contorl the chat window.

`$sinitic.api('toggleChat', true)`opens the chat window

`$sinitic.api('toggleChat', false)`closes the chat window

`$sinitic.api('toggleChat')`switches between open and close

| Open                                                                                                                                                                                                                                                                                 | Closed                                                                                                                                                                                                                                                                                 |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p></p><p><img src="https://3596211051-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LKRxyYN947NtZeWKUi5%2F-LUWP24uc1hz_vIKsqXd%2F-LUWQlkVp3w4Ib8GDzi_%2F%E5%9C%96%E7%89%87.png?alt=media&amp;token=b40aa469-43d9-432b-9991-15d79194f34a" alt="Webchat (open)"></p> | <p></p><p><img src="https://3596211051-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LKRxyYN947NtZeWKUi5%2F-LUWP24uc1hz_vIKsqXd%2F-LUWR01dyZaOr_zb402t%2F%E5%9C%96%E7%89%87.png?alt=media&amp;token=6adf104a-696a-400f-9149-edda38ce874b" alt="Webchat (closed)"></p> |
