AI Integration Quick Reference
AI Integration Quick Reference
| Field | Value |
|---|---|
| Package | @cometchat/chat-uikit-react (replaces v5 packages) |
| New init pattern | UIKitSettingsBuilder + CometChatUIKit.init() |
| Theming | CSS variables replace inline style objects. See Theming |
| Localization | CometChatLocalize.init(settings) — language codes changed (e.g., en → en-US), new CalendarObject for date formatting |
| Key changes | setLocale → setCurrentLanguage, localize → getLocalizedString, datePattern → CalendarObject-based props |
Overview of Changes
| Feature | v5 | v6 |
|---|---|---|
| Initialization | Used init(language, resources) with separate params. | Uses init(settings: LocalizationSettings) with a configuration object. |
| Translation Management | Manually updated translations using resources. | Uses translationsForLanguage in init() and addTranslation(). |
| Language Codes | Used shorthand codes (e.g., en, fr). | Uses full language-region codes (e.g., en-US, fr). |
| Date & Time Localization | Not configurable. | Supports CalendarObject for date formatting. |
| Timezone Handling | Not available. | Introduced timezone setting. |
| Missing Key Handler | Not available. | Introduced missingKeyHandler to handle missing translations. |
CometChatLocalize
Initialization
In CometChat v5 UI Kit, theCometChatLocalize.init() accepts 2 parameters: language & resources
V5 UI Kit
CometChatLocalize.init() method accepts a localization setting instead of individual parameters.
V6 UI Kit
Language Code Changes
In CometChat v5 UI Kit, the language code for English wasen. In CometChat v6 UI Kit, the language codes have been expanded to distinguish between regional variants:
en-USfor American Englishen-GBfor British English
Managing Translations
In CometChat v5 UI Kit, the only way to add or override translations was by passing them in theinit() method.
V5 UI Kit
init() method or the addTranslation() method.
V6 UI Kit
Handling Date & Time Localization
CometChat v5 UI Kit lacked support for date formatting, but CometChat v6 UI Kit introduces theCalendarObject for date and time formatting.
V6 UI Kit
Handling Missing Translation Keys
CometChat v5 UI Kit did not handle missing translation keys, whereas CometChat v6 UI Kit introduces amissingKeyHandler for better control.
V6 UI Kit
Migrating JSON Translation Files
In CometChat v5 UI Kit, the language code for English wasen.
V5 UI Kit
en-US & en-GB.
V6 UI Kit
Additional Resources
CometChatLocalize Class
View the source code for the localization class.
Language JSON Files
Browse all available language translation files.
Property Changes
In CometChat v6 UI Kit, several props and methods in components and the CometChatLocalize class have been updated. Below is a detailed reference of renamed, added, and removed properties and methods.Conversations
New Properties
| Name | Type | Description |
|---|---|---|
| lastMessageDateTimeFormat | CalendarObject | Format for displaying the timestamp of the last message in the conversations list. |
Removed Properties
| Name | Type | Description |
|---|---|---|
| datePattern | DatePatterns | Format for displaying the timestamp of the last message in the conversations list. |
Message Header
New Properties
| Name | Type | Description |
|---|---|---|
| lastActiveAtDateTimeFormat | CalendarObject | Format for displaying the “last active” timestamp in the message header. |
Message List
New Properties
| Name | Type | Description |
|---|---|---|
| separatorDateTimeFormat | CalendarObject | Format for the date separators in the message list. |
| stickyDateTimeFormat | CalendarObject | Format for sticky date headers displayed in the message list. |
| messageSentAtDateTimeFormat | CalendarObject | Format for the timestamp displayed next to messages. |
| messageInfoDateTimeFormat | CalendarObject | Format for timestamps displayed in message details (e.g., delivery or read time). |
Removed Properties
| Name | Type | Description |
|---|---|---|
| datePattern | DatePatterns | Format for the date separators & sticky date in the message list. |
| timePattern | DatePatterns | Format for the timestamp displayed next to messages. |
Thread Header
New Properties
| Name | Type | Description |
|---|---|---|
| separatorDateTimeFormat | CalendarObject | Format for the date separators. |
| messageSentAtDateTimeFormat | CalendarObject | Format for the timestamp displayed next to messages. |
Call Logs
New Properties
| Name | Type | Description |
|---|---|---|
| callInitiatedDateTimeFormat | CalendarObject | Format for displaying the call initiation time in call logs. |
Removed Properties
| Name | Type | Description |
|---|---|---|
| datePattern | DatePatterns | Format for rendering dates in the call logs. |
CometChatLocalize Class
New Methods
| Name | Description |
|---|---|
| addTranslation | Adds custom translations to the default translations. |
| getDefaultLanguage | Returns the default language. |
| getDateLocaleLanguage | Returns the language used for date localization. |
| formatDate | Formats a timestamp based on the provided calendar configuration. |
Renamed Methods
| Name | Description | Old Name |
|---|---|---|
| getCurrentLanguage | Gets the current language. | getLocale |
| setCurrentLanguage | Sets the current language. | setLocale |
| getLocalizedString | Localizes the given string based on the active language. | localize |
Removed Methods
| Name | Description |
|---|---|
| getLanguageCode | Returns the language code of current language. |
| setDefaultLanguage | Sets the default language if no language is passed in init method. |
| isRTL | Returns true if the active language is rtl otherwise return false. |
| getDir | Returns rtl or ltr based on the active language. |
Next Steps
React.js Integration
Fresh v6 setup guide for React.js.
Components Overview
Explore all v6 prebuilt UI components.
Theme
New CSS variable-based theming system.
Methods
Init, login, logout, and other UI Kit methods.