Update localization
All TalkJS UIs can be localized so that everything is displayed in the user's own language. You can specify a default language for all users, as well as set a language on user-by-user basis.
The default UI language is American English (en-US
). You can change the default language on the Settings page of your TalkJS dashboard.
If you need to support multiple languages at once, you can set the locale
field per user. The locale
field expects an IETF language tag.
Here's an example of how you can set the locale
for a user, using the classic JavaScript SDK:
1session.currentUser.set({2 name: 'Alice',4 photoUrl: 'https://talkjs.com/images/avatar-1.jpg',5 welcomeMessage: 'Hey there! How are you? :-)',6 locale: 'nl-NL', // <-- that's the one!7});
Here's an example of how you can set the locale
for a user, using the REST API:
1PUT https://api.talkjs.com/v1/YOUR_APP_ID/users/1234523{4 "name": "Alice",6 "photoUrl": "https://talkjs.com/images/avatar-1.jpg",7 "welcomeMessage": "Hey there! How are you? :-)",8 "locale": "nl-NL"9}
If your app's reading direction is right-to-left and you use the dir
attribute in your <html>
tag (eg <html dir="rtl">
), then TalkJS is automatically shown in right-to-left mode. Otherwise, set the dir
option in ChatboxOptions and InboxOptions to "rtl"
and everything will work as expected.
Additionally, TalkJS automatically defaults to a right-to-left layout when a right-to-left language is selected.
If your language is commonly entered using an on-screen keyboard for character selection, you might find that TalkJS's behavior to automatically send messages on "enter" conflicts with character selection. A pragmatic workaround for this is to set enterSendsMessage to false
in createInbox's messageField
option.
Localization is currently available for the following languages:
- Albanian (
sq-AL
) - Arabic (
ar
) (with right-to-left UI layout) - Bosnian (
bs-BA
) - Bulgarian (
bg-BG
) - Catalan (ES) (
ca-ES
) - Chinese (Simplified) (
zh-CN
) - Chinese (Traditional) (
zh-TW
) - Croatian (
hr-HR
) - Czech (
cs-CZ
) - Danish (
da-DK
) - Dutch (
nl-NL
) - English (U.S.) (
en-US
) - Estonian (
et-EE
) - Finnish (
fi-FI
) - French (
fr-FR
) - Georgian (
ka-GE
) - German (
de-DE
) - Greek (
el-GR
) - Hebrew (
he-IL
) (with right-to-left UI layout) - Hindi (
hi-IN
) - Hungarian (
hu-HU
) - Icelandic (
is-IS
) - Indonesian (
id-ID
) - Italian (
it-IT
) - Japanese (
ja-JP
) - Korean (
ko-KR
) - Norwegian (Bokmål) (
nb-NO
) - Persian (Farsi) (
fa
) - Polish (
pl-PL
) - Portuguese (Brazilian) (
pt-BR
) - Romanian (
ro-RO
) - Russian (
ru-RU
) - Serbian (
sr-SP
) - Spanish (
es-ES
) - Swedish (
sv-SE
) - Turkish (
tr-TR
) - Ukrainian (
uk-UA
) - Vietnamese (
vi-VN
)
Is the language you need missing from the list? Get in touch and a member of the TalkJS team will add it.