Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-react-uikit-v7.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
AI Integration Quick Reference
| Field | Value |
|---|---|
| Locale prop | locale="fr" on CometChatProvider |
| Default | en-us |
| Languages | 19 built-in: de, en-gb, en-us, es, fr, hi, hu, it, ja, ko, lt, ms, nl, pt, ru, sv, tr, zh, zh-tw |
| Hook | useLocale() → { getLocalizedString, language } |
| Static access | CometChatLocalize.getSharedInstance()?.t(key) |
| Custom translations | Pass via CometChatLocalize constructor or addTranslation() |
Overview
The UI Kit ships with translations for 19 languages. All user-facing text (button labels, status messages, timestamps, error messages) is resolved through translation keys. Set thelocale prop on CometChatProvider to switch languages.
Setting the Language
Supported Languages
| Code | Language |
|---|---|
en-us | English (US) — default |
en-gb | English (UK) |
de | German |
es | Spanish |
fr | French |
hi | Hindi |
hu | Hungarian |
it | Italian |
ja | Japanese |
ko | Korean |
lt | Lithuanian |
ms | Malay |
nl | Dutch |
pt | Portuguese |
ru | Russian |
sv | Swedish |
tr | Turkish |
zh | Chinese (Simplified) |
zh-tw | Chinese (Traditional) |
Accessing Translations in Components
Use theuseLocale hook:
Adding Custom Translations
Override or add translation keys for a language:Fallback Language
If a key is not found in the current language, the system falls back to the fallback language (default:en-us). Configure via CometChatLocalize:
Date & Time Localization
Date formatting respects the locale. TheCometChatDate component and all timestamp displays use locale-aware formatting:
- Relative time: “2 minutes ago”, “il y a 2 minutes”
- Day names: “Monday”, “Lundi”
- Date formats: “12/25/2024” (en-us), “25/12/2024” (en-gb)
Static Access (Non-React Code)
For plugins and utilities that run outside React components:Differences from v6
| v6 | v7 |
|---|---|
CometChatLocalize.setLanguage("fr") | locale="fr" prop on CometChatProvider |
| Global static state | React context via LocaleProvider |
| Manual init required | Automatic — provider handles it |
| Same 19 languages | Same 19 languages |