@cometchat/skills 4.3.0 → 4.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/bin/install.js +27 -0
- package/package.json +14 -1
- package/skills/cometchat/SKILL.md +233 -69
- package/skills/cometchat/references/asking-questions.md +48 -0
- package/skills/cometchat-a11y/SKILL.md +3 -2
- package/skills/cometchat-android-v5/SKILL.md +2 -1
- package/skills/cometchat-android-v5-calls/SKILL.md +36 -22
- package/skills/cometchat-android-v5-calls/references/README.md +1 -1
- package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +7 -5
- package/skills/cometchat-android-v5-calls/references/audio-controls.md +4 -4
- package/skills/cometchat-android-v5-calls/references/call-layouts.md +33 -25
- package/skills/cometchat-android-v5-calls/references/call-session.md +2 -2
- package/skills/cometchat-android-v5-calls/references/custom-ui.md +5 -5
- package/skills/cometchat-android-v5-calls/references/event-listeners.md +2 -2
- package/skills/cometchat-android-v5-calls/references/idle-timeout.md +20 -14
- package/skills/cometchat-android-v5-calls/references/in-call-chat.md +1 -1
- package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +43 -27
- package/skills/cometchat-android-v5-calls/references/participant-management.md +3 -3
- package/skills/cometchat-android-v5-calls/references/raise-hand.md +25 -19
- package/skills/cometchat-android-v5-calls/references/recording.md +2 -2
- package/skills/cometchat-android-v5-calls/references/ringing-integration.md +1 -1
- package/skills/cometchat-android-v5-calls/references/screen-sharing.md +5 -9
- package/skills/cometchat-android-v5-calls/references/session-settings.md +3 -3
- package/skills/cometchat-android-v5-calls/references/setup.md +1 -1
- package/skills/cometchat-android-v5-calls/references/share-invite.md +9 -4
- package/skills/cometchat-android-v5-calls/references/video-controls.md +4 -4
- package/skills/cometchat-android-v5-calls/references/voip-calling.md +2 -2
- package/skills/cometchat-android-v5-components/SKILL.md +4 -3
- package/skills/cometchat-android-v5-core/SKILL.md +5 -3
- package/skills/cometchat-android-v5-customization/SKILL.md +171 -7
- package/skills/cometchat-android-v5-extensions/SKILL.md +7 -4
- package/skills/cometchat-android-v5-features/SKILL.md +5 -4
- package/skills/cometchat-android-v5-placement/SKILL.md +2 -1
- package/skills/cometchat-android-v5-production/SKILL.md +2 -1
- package/skills/cometchat-android-v5-push/SKILL.md +2 -3
- package/skills/cometchat-android-v5-testing/SKILL.md +2 -1
- package/skills/cometchat-android-v5-theming/SKILL.md +2 -1
- package/skills/cometchat-android-v5-troubleshooting/SKILL.md +3 -2
- package/skills/cometchat-android-v6/SKILL.md +2 -1
- package/skills/cometchat-android-v6-builder-settings/SKILL.md +11 -7
- package/skills/cometchat-android-v6-calls/SKILL.md +79 -18
- package/skills/cometchat-android-v6-calls/references/advanced-features.md +87 -0
- package/skills/cometchat-android-v6-calls/references/call-layouts.md +24 -15
- package/skills/cometchat-android-v6-calls/references/call-session.md +2 -2
- package/skills/cometchat-android-v6-calls/references/device-management.md +17 -16
- package/skills/cometchat-android-v6-calls/references/idle-timeout.md +7 -4
- package/skills/cometchat-android-v6-calls/references/in-call-chat.md +13 -8
- package/skills/cometchat-android-v6-calls/references/raise-hand.md +6 -4
- package/skills/cometchat-android-v6-compose-components/SKILL.md +52 -29
- package/skills/cometchat-android-v6-compose-customization/SKILL.md +156 -1
- package/skills/cometchat-android-v6-compose-placement/SKILL.md +129 -40
- package/skills/cometchat-android-v6-compose-theming/SKILL.md +27 -1
- package/skills/cometchat-android-v6-core/SKILL.md +208 -28
- package/skills/cometchat-android-v6-events/SKILL.md +4 -1
- package/skills/cometchat-android-v6-extensions/SKILL.md +2 -1
- package/skills/cometchat-android-v6-features/SKILL.md +26 -2
- package/skills/cometchat-android-v6-kotlin-components/SKILL.md +31 -1
- package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +172 -1
- package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +20 -5
- package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +36 -5
- package/skills/cometchat-android-v6-migration/SKILL.md +44 -42
- package/skills/cometchat-android-v6-production/SKILL.md +6 -3
- package/skills/cometchat-android-v6-push/SKILL.md +43 -2
- package/skills/cometchat-android-v6-testing/SKILL.md +11 -8
- package/skills/cometchat-android-v6-troubleshooting/SKILL.md +26 -5
- package/skills/cometchat-angular-calls/SKILL.md +256 -389
- package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +3 -2
- package/skills/cometchat-angular-calls/references/call-layouts.md +29 -12
- package/skills/cometchat-angular-calls/references/call-session.md +2 -2
- package/skills/cometchat-angular-calls/references/custom-ui.md +18 -10
- package/skills/cometchat-angular-calls/references/device-management.md +53 -34
- package/skills/cometchat-angular-calls/references/group-calls.md +45 -24
- package/skills/cometchat-angular-calls/references/idle-timeout.md +31 -15
- package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +7 -6
- package/skills/cometchat-angular-calls/references/raise-hand.md +9 -4
- package/skills/cometchat-angular-calls/references/recording-screen-share.md +32 -39
- package/skills/cometchat-angular-calls/references/ringing-integration.md +3 -1
- package/skills/cometchat-angular-calls/references/share-invite.md +11 -5
- package/skills/cometchat-angular-calls/references/virtual-background.md +29 -0
- package/skills/cometchat-angular-components/SKILL.md +149 -620
- package/skills/cometchat-angular-core/SKILL.md +232 -312
- package/skills/cometchat-angular-customization/SKILL.md +415 -223
- package/skills/cometchat-angular-features/SKILL.md +216 -334
- package/skills/cometchat-angular-patterns/SKILL.md +168 -359
- package/skills/cometchat-angular-placement/SKILL.md +189 -560
- package/skills/cometchat-angular-production/SKILL.md +241 -92
- package/skills/cometchat-angular-push/SKILL.md +280 -294
- package/skills/cometchat-angular-testing/SKILL.md +430 -158
- package/skills/cometchat-angular-theming/SKILL.md +190 -265
- package/skills/cometchat-angular-troubleshooting/SKILL.md +192 -157
- package/skills/cometchat-astro-patterns/SKILL.md +3 -2
- package/skills/cometchat-calls/SKILL.md +25 -19
- package/skills/cometchat-calls/references/use-case-broadcast.md +15 -10
- package/skills/cometchat-calls/references/use-case-marketplace.md +2 -3
- package/skills/cometchat-calls/references/use-case-support.md +3 -4
- package/skills/cometchat-calls/references/use-case-team.md +23 -12
- package/skills/cometchat-calls/references/use-case-telehealth.md +3 -4
- package/skills/cometchat-components/SKILL.md +163 -25
- package/skills/cometchat-core/SKILL.md +258 -20
- package/skills/cometchat-customization/SKILL.md +50 -25
- package/skills/cometchat-features/SKILL.md +314 -35
- package/skills/cometchat-flutter-v5/SKILL.md +10 -4
- package/skills/cometchat-flutter-v5-calls/SKILL.md +188 -158
- package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +48 -24
- package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +20 -15
- package/skills/cometchat-flutter-v5-calls/references/call-session.md +100 -145
- package/skills/cometchat-flutter-v5-calls/references/device-management.md +12 -8
- package/skills/cometchat-flutter-v5-calls/references/group-calls.md +30 -36
- package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +15 -13
- package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +12 -9
- package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +115 -65
- package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +41 -30
- package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +17 -14
- package/skills/cometchat-flutter-v5-calls/references/share-invite.md +8 -2
- package/skills/cometchat-flutter-v5-conversations/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-core/SKILL.md +5 -4
- package/skills/cometchat-flutter-v5-customization/SKILL.md +136 -5
- package/skills/cometchat-flutter-v5-events/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-messages/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-production/SKILL.md +15 -6
- package/skills/cometchat-flutter-v5-push/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-testing/SKILL.md +17 -6
- package/skills/cometchat-flutter-v5-theming/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +7 -6
- package/skills/cometchat-flutter-v5-users-groups/SKILL.md +3 -2
- package/skills/cometchat-flutter-v6/SKILL.md +17 -16
- package/skills/cometchat-flutter-v6-calls/SKILL.md +72 -57
- package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +5 -3
- package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +89 -0
- package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +15 -12
- package/skills/cometchat-flutter-v6-calls/references/call-session.md +2 -2
- package/skills/cometchat-flutter-v6-calls/references/device-management.md +9 -3
- package/skills/cometchat-flutter-v6-calls/references/group-calls.md +10 -10
- package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +15 -7
- package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +6 -3
- package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +23 -16
- package/skills/cometchat-flutter-v6-components/SKILL.md +32 -11
- package/skills/cometchat-flutter-v6-conversations/SKILL.md +39 -11
- package/skills/cometchat-flutter-v6-core/SKILL.md +182 -21
- package/skills/cometchat-flutter-v6-customization/SKILL.md +97 -25
- package/skills/cometchat-flutter-v6-events/SKILL.md +3 -2
- package/skills/cometchat-flutter-v6-features/SKILL.md +15 -6
- package/skills/cometchat-flutter-v6-messages/SKILL.md +111 -60
- package/skills/cometchat-flutter-v6-migration/SKILL.md +18 -25
- package/skills/cometchat-flutter-v6-placement/SKILL.md +79 -50
- package/skills/cometchat-flutter-v6-production/SKILL.md +13 -12
- package/skills/cometchat-flutter-v6-push/SKILL.md +41 -19
- package/skills/cometchat-flutter-v6-testing/SKILL.md +4 -4
- package/skills/cometchat-flutter-v6-theming/SKILL.md +38 -5
- package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +182 -17
- package/skills/cometchat-flutter-v6-users-groups/SKILL.md +12 -4
- package/skills/cometchat-i18n/SKILL.md +140 -79
- package/skills/cometchat-ios/SKILL.md +4 -2
- package/skills/cometchat-ios-calls/SKILL.md +225 -95
- package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +11 -9
- package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +45 -0
- package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +6 -7
- package/skills/cometchat-ios-calls/references/call-layouts.md +31 -91
- package/skills/cometchat-ios-calls/references/call-session.md +51 -54
- package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +33 -29
- package/skills/cometchat-ios-calls/references/custom-ui.md +38 -38
- package/skills/cometchat-ios-calls/references/group-calls.md +33 -70
- package/skills/cometchat-ios-calls/references/idle-timeout.md +24 -25
- package/skills/cometchat-ios-calls/references/in-call-chat.md +19 -23
- package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +128 -70
- package/skills/cometchat-ios-calls/references/picture-in-picture.md +20 -20
- package/skills/cometchat-ios-calls/references/raise-hand.md +14 -227
- package/skills/cometchat-ios-calls/references/recording-screen-share.md +35 -122
- package/skills/cometchat-ios-calls/references/ringing-integration.md +17 -16
- package/skills/cometchat-ios-calls/references/share-invite.md +8 -12
- package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +4 -4
- package/skills/cometchat-ios-components/SKILL.md +200 -12
- package/skills/cometchat-ios-core/SKILL.md +173 -45
- package/skills/cometchat-ios-customization/SKILL.md +276 -110
- package/skills/cometchat-ios-features/SKILL.md +64 -36
- package/skills/cometchat-ios-placement/SKILL.md +15 -12
- package/skills/cometchat-ios-production/SKILL.md +12 -4
- package/skills/cometchat-ios-push/SKILL.md +53 -19
- package/skills/cometchat-ios-testing/SKILL.md +14 -9
- package/skills/cometchat-ios-theming/SKILL.md +39 -3
- package/skills/cometchat-ios-troubleshooting/SKILL.md +41 -21
- package/skills/cometchat-native-bare-patterns/SKILL.md +36 -19
- package/skills/cometchat-native-calls/SKILL.md +29 -17
- package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +2 -2
- package/skills/cometchat-native-calls/references/call-layouts.md +15 -14
- package/skills/cometchat-native-calls/references/call-session.md +2 -2
- package/skills/cometchat-native-calls/references/custom-ui.md +12 -8
- package/skills/cometchat-native-calls/references/device-management.md +53 -30
- package/skills/cometchat-native-calls/references/group-calls.md +35 -30
- package/skills/cometchat-native-calls/references/idle-timeout.md +6 -6
- package/skills/cometchat-native-calls/references/in-call-chat.md +10 -8
- package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +2 -2
- package/skills/cometchat-native-calls/references/raise-hand.md +15 -13
- package/skills/cometchat-native-calls/references/recording-screen-share.md +49 -170
- package/skills/cometchat-native-calls/references/share-invite.md +7 -5
- package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +4 -2
- package/skills/cometchat-native-components/SKILL.md +84 -52
- package/skills/cometchat-native-core/SKILL.md +102 -33
- package/skills/cometchat-native-customization/SKILL.md +150 -28
- package/skills/cometchat-native-expo-patterns/SKILL.md +60 -29
- package/skills/cometchat-native-features/SKILL.md +24 -17
- package/skills/cometchat-native-placement/SKILL.md +19 -10
- package/skills/cometchat-native-production/SKILL.md +9 -3
- package/skills/cometchat-native-push/SKILL.md +2 -1
- package/skills/cometchat-native-testing/SKILL.md +1 -2
- package/skills/cometchat-native-theming/SKILL.md +54 -29
- package/skills/cometchat-native-troubleshooting/SKILL.md +11 -5
- package/skills/cometchat-nextjs-patterns/SKILL.md +22 -8
- package/skills/cometchat-placement/SKILL.md +42 -3
- package/skills/cometchat-production/SKILL.md +12 -5
- package/skills/cometchat-react-calls/SKILL.md +220 -10
- package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +4 -3
- package/skills/cometchat-react-calls/references/call-layouts.md +5 -6
- package/skills/cometchat-react-calls/references/call-session.md +1 -1
- package/skills/cometchat-react-calls/references/custom-ui.md +61 -15
- package/skills/cometchat-react-calls/references/device-management.md +55 -51
- package/skills/cometchat-react-calls/references/group-calls.md +18 -23
- package/skills/cometchat-react-calls/references/idle-timeout.md +25 -12
- package/skills/cometchat-react-calls/references/in-call-chat.md +7 -7
- package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +9 -11
- package/skills/cometchat-react-calls/references/raise-hand.md +14 -14
- package/skills/cometchat-react-calls/references/recording-screen-share.md +39 -38
- package/skills/cometchat-react-calls/references/ringing-integration.md +2 -2
- package/skills/cometchat-react-calls/references/share-invite.md +4 -5
- package/skills/cometchat-react-calls/references/testing-calls-on-web.md +20 -2
- package/skills/cometchat-react-calls/references/virtual-background.md +32 -0
- package/skills/cometchat-react-patterns/SKILL.md +45 -5
- package/skills/cometchat-react-push/SKILL.md +258 -72
- package/skills/cometchat-react-router-patterns/SKILL.md +12 -6
- package/skills/cometchat-react-testing/SKILL.md +14 -5
- package/skills/cometchat-theming/SKILL.md +181 -18
- package/skills/cometchat-troubleshooting/SKILL.md +40 -20
|
@@ -3,18 +3,19 @@ name: cometchat-i18n
|
|
|
3
3
|
description: Localization (i18n) across all CometChat UI Kit families — React, React Native, Angular, Android (V5/V6), iOS, Flutter (V5/V6). Covers CometChatLocalize.init signature differences (positional vs object), bundled languages, custom-language registration, RTL support, fallback to English, and cross-family drift risks. Cross-family — applies wherever the agent is configuring CometChat localization.
|
|
4
4
|
license: "MIT"
|
|
5
5
|
compatibility: "All CometChat UI Kit families v4.x / v5.x / v6.x"
|
|
6
|
-
allowed-tools: "shell, file-read, file-search, file-list, ask-user"
|
|
7
6
|
metadata:
|
|
8
7
|
author: "CometChat"
|
|
9
8
|
version: "4.0.0"
|
|
10
9
|
tags: "cometchat i18n localization l10n cometchatlocalize languages rtl arabic hebrew bundled-languages custom-language fallback cross-family"
|
|
11
10
|
---
|
|
12
11
|
|
|
12
|
+
> **Ground truth:** the UI Kit `CometChatLocalize` API + `docs/fundamentals`. **Official docs:** https://www.cometchat.com/docs/fundamentals/overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP). Verify symbols against the installed package/source before relying on them.
|
|
13
|
+
|
|
13
14
|
## Purpose
|
|
14
15
|
|
|
15
16
|
Localize the CometChat UI Kit to the user's language. Every kit ships with English + ~15 bundled languages (Arabic, Bengali, Chinese, German, Spanish, French, Hindi, Indonesian, Italian, Japanese, Korean, Malay, Portuguese, Russian, Swedish, Turkish — exact set varies by kit version). Custom languages can be added at runtime.
|
|
16
17
|
|
|
17
|
-
The biggest gotcha: **the
|
|
18
|
+
The biggest gotcha: **the localization API differs across kits.** Web + Angular v5 use `CometChatLocalize.init({ ... })` (object); **React Native v5 uses a `<CometChatI18nProvider>` component + `useCometChatTranslation` hook (no `CometChatLocalize.init`)**; **Android uses `CometChatLocalize.setLocale(context, "es")`** (Context + code String); **iOS uses `CometChatLocalize.set(locale: "es")`**; **Flutter has no `CometChatLocalize` class at all — register the kit's `Translations` localization delegate.** (Angular's positional `init("es")` was a v4-only form — v5 moved to the object signature, matching React.) This skill is the canonical reference.
|
|
18
19
|
|
|
19
20
|
---
|
|
20
21
|
|
|
@@ -33,78 +34,108 @@ CometChatLocalize.init({
|
|
|
33
34
|
|
|
34
35
|
Object literal. `init({ ... })`.
|
|
35
36
|
|
|
36
|
-
### React Native (v5) —
|
|
37
|
+
### React Native (v5) — `CometChatI18nProvider` (NOT `CometChatLocalize.init`)
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
import { CometChatLocalize } from "@cometchat/chat-uikit-react-native";
|
|
39
|
+
The RN v5 kit does **not** export a `CometChatLocalize` class with `.init(...)` (that was the v4 RN API). v5 localizes through a **provider component** + a hook. Wrap your app (inside `CometChatThemeProvider`) and read strings with `useCometChatTranslation`:
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
```tsx
|
|
42
|
+
import {
|
|
43
|
+
CometChatThemeProvider,
|
|
44
|
+
CometChatI18nProvider,
|
|
45
|
+
} from "@cometchat/chat-uikit-react-native";
|
|
46
|
+
|
|
47
|
+
const App = () => (
|
|
48
|
+
<CometChatThemeProvider theme={{ mode: "light" }}>
|
|
49
|
+
{/* autoDetectLanguage reads the device locale; or pin one with selectedLanguage="es" */}
|
|
50
|
+
<CometChatI18nProvider autoDetectLanguage={true} fallbackLanguage="en">
|
|
51
|
+
{/* your screens / kit components */}
|
|
52
|
+
</CometChatI18nProvider>
|
|
53
|
+
</CometChatThemeProvider>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// In a component:
|
|
57
|
+
import { useCometChatTranslation } from "@cometchat/chat-uikit-react-native";
|
|
58
|
+
const { t } = useCometChatTranslation();
|
|
59
|
+
// t("CHATS")
|
|
45
60
|
```
|
|
46
61
|
|
|
47
|
-
|
|
62
|
+
`CometChatI18nProviderProps`: `selectedLanguage?`, `autoDetectLanguage?: boolean`, `fallbackLanguage?`, `translations?: { [code]: {...} }` (verified vs `shared/resources/CometChatLocalizeNew/CometChatI18nProvider.tsx`). For imperative switching there's `setGlobalLanguage(language, translations?, fallback?)`.
|
|
48
63
|
|
|
49
|
-
### Angular (
|
|
64
|
+
### Angular (v5) — OBJECT signature
|
|
50
65
|
|
|
51
66
|
```ts
|
|
52
67
|
import { CometChatLocalize } from "@cometchat/chat-uikit-angular";
|
|
53
68
|
|
|
54
|
-
CometChatLocalize.init("es");
|
|
55
|
-
//
|
|
56
|
-
CometChatLocalize.init(
|
|
69
|
+
CometChatLocalize.init({ language: "es" });
|
|
70
|
+
// with more options:
|
|
71
|
+
CometChatLocalize.init({
|
|
72
|
+
language: "es",
|
|
73
|
+
fallbackLanguage: "en-US",
|
|
74
|
+
timezone: "Europe/Madrid",
|
|
75
|
+
});
|
|
57
76
|
```
|
|
58
77
|
|
|
59
|
-
**
|
|
78
|
+
**Object literal, not positional** — in v5 (`@cometchat/chat-uikit-angular@5`), `init(settings: LocalizationSettings)` takes an object, the same shape as React. (Verified in `projects/cometchat-uikit/src/lib/resources/CometChatLocalize/cometchat-localize.ts` — `static init(settings: LocalizationSettings)`.) The old positional `init("es")` form was the **v4** Angular API and no longer applies. Switch language at runtime with `CometChatLocalize.setCurrentLanguage("fr")`, read keys with `getLocalizedString(key)`, and add custom strings with `addTranslation({ ... })`.
|
|
60
79
|
|
|
61
80
|
### Android V5 — Java/Kotlin static method
|
|
62
81
|
|
|
63
82
|
```kotlin
|
|
64
|
-
// Kotlin
|
|
65
|
-
CometChatLocalize.setLocale(
|
|
83
|
+
// Kotlin — takes (Context, language-code String). Language.* are String constants.
|
|
84
|
+
CometChatLocalize.setLocale(context, Language.SPANISH) // or "es"
|
|
66
85
|
```
|
|
67
86
|
|
|
68
87
|
```java
|
|
69
88
|
// Java
|
|
70
|
-
CometChatLocalize.setLocale(
|
|
89
|
+
CometChatLocalize.setLocale(context, Language.SPANISH); // or "es"
|
|
71
90
|
```
|
|
72
91
|
|
|
73
|
-
`setLocale`, not `init`.
|
|
92
|
+
`setLocale`, not `init`. **Signature is `setLocale(Context, @Language.Code String)`** — a Context plus a two-letter language-code String (NOT a `java.util.Locale`). `Language` exposes `ENGLISH="en"`, `SPANISH="es"`, `FRENCH="fr"`, `GERMAN="de"`, … (verified vs `chatuikit/.../localise/CometChatLocalize.java` + `Language.kt`).
|
|
74
93
|
|
|
75
|
-
### Android V6 (
|
|
94
|
+
### Android V6 (stable) — same as V5
|
|
76
95
|
|
|
77
|
-
V6 keeps the `setLocale(
|
|
96
|
+
V6 keeps the same API: `CometChatLocalize.setLocale(context, "es")` (verified vs `chatuikit-kotlin/.../localise/CometChatLocalize.kt:22` — `fun setLocale(context: Context, language: String)`). No drift between V5 and V6.
|
|
78
97
|
|
|
79
98
|
### iOS V5
|
|
80
99
|
|
|
81
100
|
```swift
|
|
82
101
|
import CometChatUIKitSwift
|
|
83
102
|
|
|
84
|
-
CometChatLocalize.
|
|
103
|
+
CometChatLocalize.set(locale: "es") // or set(locale: Language.spanish)
|
|
85
104
|
```
|
|
86
105
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
### Flutter V5 (GetX-based)
|
|
90
|
-
|
|
91
|
-
```dart
|
|
92
|
-
import 'package:cometchat_calls_uikit/cometchat_calls_uikit.dart';
|
|
93
|
-
|
|
94
|
-
CometChatLocalize.init(language: 'es');
|
|
95
|
-
```
|
|
106
|
+
The method is **`set(locale:)`**, not `setLocale(...)`. It takes a String (or a `Language`) — `public class func set(locale: String)` / `set(locale: Language)` (verified vs `Components/Shared/Helpers/CometChatLocalize/CometChatLocalize.swift:78,82`). There is no `setStringResources` — override individual strings via your app's `Localizable.strings`.
|
|
96
107
|
|
|
97
|
-
|
|
108
|
+
### Flutter V5 + V6 — there is NO `CometChatLocalize.init(...)`
|
|
98
109
|
|
|
99
|
-
|
|
110
|
+
> **Verified against the kit source + docs (`ui-kits/cometchat-uikit-flutter-v6`, `documentation/docs/ui-kit/flutter/localize.mdx`): Flutter does NOT expose a `CometChatLocalize` class.** Localization is wired the idiomatic Flutter way — register the kit's `Translations` localization delegate on your `MaterialApp` and drive the language through the app's `Locale`. Earlier drafts of this skill showed `CometChatLocalize.init(language: 'es')`; that symbol does not exist in the Flutter UI Kit (V5 or V6) — do not emit it.
|
|
100
111
|
|
|
101
112
|
```dart
|
|
102
|
-
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';
|
|
103
|
-
|
|
104
|
-
|
|
113
|
+
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart' as cc; // V6
|
|
114
|
+
// V5: import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart' as cc; (5.2.x)
|
|
115
|
+
|
|
116
|
+
MaterialApp(
|
|
117
|
+
// Language follows the app Locale. Set `locale:` to force one, or omit to
|
|
118
|
+
// follow the device + supportedLocales.
|
|
119
|
+
locale: const Locale('es'),
|
|
120
|
+
supportedLocales: const [
|
|
121
|
+
Locale('en'), Locale('ar'), Locale('de'), Locale('es'), Locale('fr'),
|
|
122
|
+
Locale('hi'), Locale('ja'), Locale('ko'), Locale('pt'), Locale('ru'),
|
|
123
|
+
Locale('zh'), // …19 supported total — see the docs list
|
|
124
|
+
],
|
|
125
|
+
localizationsDelegates: const [
|
|
126
|
+
cc.Translations.delegate, // ← the CometChat UI Kit strings
|
|
127
|
+
GlobalMaterialLocalizations.delegate,
|
|
128
|
+
GlobalWidgetsLocalizations.delegate,
|
|
129
|
+
GlobalCupertinoLocalizations.delegate,
|
|
130
|
+
],
|
|
131
|
+
home: const YourHomeScreen(),
|
|
132
|
+
);
|
|
105
133
|
```
|
|
106
134
|
|
|
107
|
-
|
|
135
|
+
Read a translated string with `cc.Translations.of(context).users`. Add a custom
|
|
136
|
+
language or override one by subclassing `cc.Translations` and registering your
|
|
137
|
+
own `LocalizationsDelegate` *before* `cc.Translations.delegate` in the list
|
|
138
|
+
(full recipe in `documentation/docs/ui-kit/flutter/localize.mdx`).
|
|
108
139
|
|
|
109
140
|
---
|
|
110
141
|
|
|
@@ -113,13 +144,13 @@ Same as V5 in Flutter — named arg.
|
|
|
113
144
|
| Family | Init call | Notes |
|
|
114
145
|
|---|---|---|
|
|
115
146
|
| React (v6) | `CometChatLocalize.init({ language, fallbackLanguage })` | Object |
|
|
116
|
-
| React Native (v5) |
|
|
117
|
-
|
|
|
118
|
-
| Android (V5/V6) | `CometChatLocalize.setLocale(
|
|
119
|
-
| iOS (V5) | `CometChatLocalize.
|
|
120
|
-
| Flutter (V5/V6) | `
|
|
147
|
+
| React Native (v5) | `<CometChatI18nProvider autoDetectLanguage selectedLanguage="es" fallbackLanguage="en">` + `useCometChatTranslation()` | **Provider component, NOT `CometChatLocalize.init`** |
|
|
148
|
+
| Angular (v5) | `CometChatLocalize.init({ language, fallbackLanguage })` | Object (same shape as React) |
|
|
149
|
+
| Android (V5/V6) | `CometChatLocalize.setLocale(context, "es")` | Method `setLocale(Context, String code)` — NOT a `Locale` |
|
|
150
|
+
| iOS (V5) | `CometChatLocalize.set(locale: "es")` | Method `set(locale:)` (String or `Language`) — NOT `setLocale` |
|
|
151
|
+
| Flutter (V5/V6) | `MaterialApp(localizationsDelegates: [cc.Translations.delegate, …], supportedLocales: […], locale: Locale('es'))` | **No `CometChatLocalize`** — register the kit's `Translations` delegate + drive via `Locale`; read with `Translations.of(context)` |
|
|
121
152
|
|
|
122
|
-
The agent must consult this table before writing any localization code. **Verify against the installed package's type definitions** if uncertain —
|
|
153
|
+
The agent must consult this table before writing any localization code. **Verify against the installed package's type definitions** if uncertain — the localization surface genuinely differs per family (e.g. React Native moved from a `CometChatLocalize` class to the `<CometChatI18nProvider>` component; Flutter never had a `CometChatLocalize` class).
|
|
123
154
|
|
|
124
155
|
---
|
|
125
156
|
|
|
@@ -130,7 +161,7 @@ After CometChat init is configured but before mounting any kit components:
|
|
|
130
161
|
```ts
|
|
131
162
|
// React example — in your provider
|
|
132
163
|
useEffect(() => {
|
|
133
|
-
CometChatUIKit.init(settings)
|
|
164
|
+
CometChatUIKit.init(settings)?.then(() => {
|
|
134
165
|
CometChatLocalize.init({ language: getUserLocale(), fallbackLanguage: "en" });
|
|
135
166
|
// Now mount kit components
|
|
136
167
|
});
|
|
@@ -138,21 +169,25 @@ useEffect(() => {
|
|
|
138
169
|
```
|
|
139
170
|
|
|
140
171
|
```kotlin
|
|
141
|
-
// Android — in Application.onCreate
|
|
172
|
+
// Android — in Application.onCreate. setLocale takes (Context, code String).
|
|
142
173
|
override fun onCreate() {
|
|
143
174
|
super.onCreate()
|
|
144
|
-
val settings = UIKitSettings.
|
|
145
|
-
CometChatUIKit.init(this, settings) {
|
|
146
|
-
|
|
147
|
-
|
|
175
|
+
val settings = UIKitSettings.UIKitSettingsBuilder()/* ... */.build()
|
|
176
|
+
CometChatUIKit.init(this, settings, object : CometChat.CallbackListener<String>() {
|
|
177
|
+
override fun onSuccess(p: String) {
|
|
178
|
+
CometChatLocalize.setLocale(this@MyApp, getUserLocale()) // e.g. "es"
|
|
179
|
+
}
|
|
180
|
+
override fun onError(e: CometChatException) {}
|
|
181
|
+
})
|
|
148
182
|
}
|
|
149
183
|
```
|
|
150
184
|
|
|
151
185
|
```swift
|
|
152
|
-
// iOS — in App.init or AppDelegate
|
|
186
|
+
// iOS — in App.init or AppDelegate. The method is set(locale:), takes a String.
|
|
153
187
|
CometChat.init(appId: ...) { _, error in
|
|
154
188
|
guard error == nil else { return }
|
|
155
|
-
|
|
189
|
+
let code = Locale.preferredLanguages.first?.split(separator: "-").first.map(String.init) ?? "en"
|
|
190
|
+
CometChatLocalize.set(locale: code)
|
|
156
191
|
}
|
|
157
192
|
```
|
|
158
193
|
|
|
@@ -170,55 +205,67 @@ Each kit lets you register a custom language or override individual strings.
|
|
|
170
205
|
CometChatLocalize.init({
|
|
171
206
|
language: "es",
|
|
172
207
|
fallbackLanguage: "en",
|
|
173
|
-
resources: {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
208
|
+
// FLAT key->value map for the ACTIVE language (NOT a nested `resources: { es: {...} }`
|
|
209
|
+
// object — LocalizationSettings has no `resources` field; it's silently ignored).
|
|
210
|
+
translationsForLanguage: {
|
|
211
|
+
"Chat": "Charla",
|
|
212
|
+
"Messages": "Mensajes",
|
|
213
|
+
// ... override only the strings you want, for the active language
|
|
179
214
|
},
|
|
180
215
|
});
|
|
216
|
+
// To add overrides for additional languages, call CometChatLocalize.addTranslation({...}) per language.
|
|
181
217
|
```
|
|
182
218
|
|
|
219
|
+
### React Native (v5) — `translations` prop on the provider
|
|
220
|
+
|
|
221
|
+
```tsx
|
|
222
|
+
<CometChatI18nProvider
|
|
223
|
+
selectedLanguage="es"
|
|
224
|
+
translations={{ es: { CHATS: "Charla", MESSAGES: "Mensajes" } }}
|
|
225
|
+
>
|
|
226
|
+
{/* … */}
|
|
227
|
+
</CometChatI18nProvider>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Add a brand-new language the same way: `translations={{ custom: { CHATS: "…" } }}` with `selectedLanguage="custom"`.
|
|
231
|
+
|
|
183
232
|
### Angular
|
|
184
233
|
|
|
185
|
-
|
|
234
|
+
Init with the object signature, then register custom strings via `addTranslation` (v5):
|
|
186
235
|
|
|
187
236
|
```ts
|
|
188
|
-
CometChatLocalize.init("es"
|
|
237
|
+
CometChatLocalize.init({ language: "es" });
|
|
238
|
+
CometChatLocalize.addTranslation({
|
|
189
239
|
es: { CHAT: "Charla", MESSAGES: "Mensajes" },
|
|
190
240
|
});
|
|
191
241
|
```
|
|
192
242
|
|
|
193
243
|
### Android
|
|
194
244
|
|
|
245
|
+
The Android kit has **no string-override API** on `CometChatLocalize` (no `addStringResources`/`setStringResources`). Override individual strings the Android-native way — add a `values-es/strings.xml` with the kit's string keys to your app resources; Android resource resolution picks them up for the active locale.
|
|
246
|
+
|
|
195
247
|
```kotlin
|
|
196
|
-
|
|
197
|
-
"CHAT" to "Charla",
|
|
198
|
-
"MESSAGES" to "Mensajes",
|
|
199
|
-
)
|
|
200
|
-
CometChatLocalize.setLocale(Locale("es"))
|
|
201
|
-
CometChatLocalize.addStringResources("es", customResources) // verify symbol
|
|
248
|
+
CometChatLocalize.setLocale(context, "es") // selects the locale; string overrides live in res/values-es/
|
|
202
249
|
```
|
|
203
250
|
|
|
204
|
-
The exact symbol for resource-override on Android varies by version — check the kit's published API surface.
|
|
205
|
-
|
|
206
251
|
### iOS
|
|
207
252
|
|
|
253
|
+
iOS has **no `setStringResources` API** either. Override strings via your app's `Localizable.strings` (per-locale `.lproj`) using the kit's string keys; `set(locale:)` only selects the active locale.
|
|
254
|
+
|
|
208
255
|
```swift
|
|
209
|
-
CometChatLocalize.
|
|
210
|
-
CometChatLocalize.setStringResources(["CHAT": "Charla"], for: "es")
|
|
256
|
+
CometChatLocalize.set(locale: "es") // overrides live in es.lproj/Localizable.strings
|
|
211
257
|
```
|
|
212
258
|
|
|
213
259
|
### Flutter
|
|
214
260
|
|
|
261
|
+
Flutter has **no `CometChatLocalize.init`** — subclass the kit's `Translations` delegate to override or add strings, and register your delegate *before* `cc.Translations.delegate` in `MaterialApp.localizationsDelegates` (full recipe in `documentation/docs/ui-kit/flutter/localize.mdx`):
|
|
262
|
+
|
|
215
263
|
```dart
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
);
|
|
264
|
+
class MyTranslations extends cc.Translations {
|
|
265
|
+
@override
|
|
266
|
+
String get chats => 'Charla'; // override individual getters
|
|
267
|
+
}
|
|
268
|
+
// register MyTranslationsDelegate() ahead of cc.Translations.delegate
|
|
222
269
|
```
|
|
223
270
|
|
|
224
271
|
---
|
|
@@ -262,11 +309,11 @@ if (isRTLLocale(language) && !I18nManager.isRTL) {
|
|
|
262
309
|
Every kit falls back to English when a translation is missing for the active locale. Make this explicit:
|
|
263
310
|
|
|
264
311
|
```ts
|
|
265
|
-
// React/RN/
|
|
266
|
-
CometChatLocalize.init({ language: "es", fallbackLanguage: "en" });
|
|
312
|
+
// React/RN/Angular (object signature) — fallbackLanguage is a settings field
|
|
313
|
+
CometChatLocalize.init({ language: "es", fallbackLanguage: "en-US" });
|
|
267
314
|
```
|
|
268
315
|
|
|
269
|
-
Angular
|
|
316
|
+
Angular v5's `LocalizationSettings` carries `fallbackLanguage` (verified in `cometchat-localize.ts` — defaults to `en-US`). RN's `<CometChatI18nProvider>` takes a `fallbackLanguage` prop. Flutter's `Translations` delegate and iOS's `set(locale:)` don't expose an explicit fallback arg — they fall back to English internally, so the skill doesn't try to override it there.
|
|
270
317
|
|
|
271
318
|
---
|
|
272
319
|
|
|
@@ -321,9 +368,23 @@ This is the workaround for kits that cache localized strings at first render.
|
|
|
321
368
|
|
|
322
369
|
---
|
|
323
370
|
|
|
371
|
+
## Advanced init options + date/time formatting (web / JS family)
|
|
372
|
+
|
|
373
|
+
`CometChatLocalize.init(settings)` (web, RN, Angular) accepts more than a language — the `LocalizationSettings` carries options the basic recipe omits (all verified in `cometchat-uikit-react-v6/src/resources/CometChatLocalize/cometchat-localize.ts`):
|
|
374
|
+
|
|
375
|
+
- **`translationsForLanguage`** — inject custom string overrides at init (sugar for `addTranslation`).
|
|
376
|
+
- **`missingKeyHandler`** — a callback invoked with any key that has no translation (log it, or return a fallback). Great for catching gaps in custom languages.
|
|
377
|
+
- **`timezone`** — IANA zone string (e.g. `"America/New_York"`) used when the kit formats timestamps.
|
|
378
|
+
|
|
379
|
+
**Date/time formatting** is controlled with `CalendarObject` (exported from the kit, `utils/CalendarObject.ts`) — pass one globally or per-component (e.g. a component's `lastActiveAtDateTimeFormat`-style prop) to control how the kit renders relative/absolute times. Query the docs MCP / `ui-kit/react/localize` for the full `CalendarObject` field list and the `flag_message_reason_*` / `message_composer_mention_*` translation-key conventions.
|
|
380
|
+
|
|
381
|
+
> These are web/JS-family details. Native families (Android/iOS/Flutter) localize through their own resource/string mechanisms — see the per-family `-core`/`-troubleshooting` skills.
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
324
385
|
## Anti-patterns
|
|
325
386
|
|
|
326
|
-
1. **
|
|
387
|
+
1. **Using the wrong localization surface for the family.** Web + **Angular v5** take `CometChatLocalize.init({ language })` (object); **React Native v5** uses `<CometChatI18nProvider>` + `useCometChatTranslation` (NO `CometChatLocalize.init`); **Android** uses `CometChatLocalize.setLocale(context, "es")`; **iOS** uses `CometChatLocalize.set(locale: "es")`; **Flutter** has no `CometChatLocalize` — register the kit's `Translations` delegate. The legacy positional `init("es")` only ever applied to Angular **v4**. Verify against the installed package's types if unsure.
|
|
327
388
|
2. **Setting locale before kit init.** Some kits ignore the early call. Always sequence: kit init → localize init.
|
|
328
389
|
3. **No fallback language on web/RN/Flutter.** Missing translations show as raw keys (`CHAT_HEADER_TITLE` etc.) instead of English fallback.
|
|
329
390
|
4. **`document.dir` not synced with locale on web.** RTL languages render LTR — broken layout.
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
name: cometchat-ios
|
|
3
3
|
description: Entry-point for CometChat iOS UI Kit integration in any Swift/iOS project. Detects the project type, gathers requirements through an interactive conversation, and writes production-quality integration code for UIKit and SwiftUI applications.
|
|
4
4
|
license: "MIT"
|
|
5
|
-
allowed-tools: "shell, file-read, file-search, file-list, ask-user"
|
|
6
5
|
metadata:
|
|
7
6
|
author: "CometChat"
|
|
8
7
|
version: "3.0.0"
|
|
9
8
|
tags: "cometchat dispatcher entry ios swift uikit swiftui chat messaging"
|
|
10
9
|
---
|
|
11
10
|
|
|
11
|
+
> **Ground truth:** `CometChatUIKitSwift ~> 5` (+ `CometChatCallsSDK ~> 5`) — Pods/SPM `.swiftinterface` + `ui-kit/ios`. **Official docs:** https://www.cometchat.com/docs/ui-kit/ios/overview · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP). Verify symbols against the installed package/source before relying on them.
|
|
12
|
+
|
|
12
13
|
## Use this skill when
|
|
13
14
|
|
|
14
15
|
The user wants to add CometChat to any iOS project. Trigger phrases:
|
|
@@ -76,7 +77,8 @@ First, check for iOS project indicators:
|
|
|
76
77
|
Store this mental map — you'll use it throughout the conversation.
|
|
77
78
|
|
|
78
79
|
**Compatibility baselines:**
|
|
79
|
-
- iOS 13+ required for CometChat UI Kit
|
|
80
|
+
- iOS 13+ required for CometChat UI Kit (CometChatSDK floor is iOS 11)
|
|
81
|
+
- **iOS 16+ required if you use calling** — `CometChatCallsSDK` 5.x has a deployment target of iOS 16.0; a project targeting iOS 13 will fail to link the Calls SDK
|
|
80
82
|
- Swift 5.0+ required
|
|
81
83
|
- Xcode 14+ recommended
|
|
82
84
|
|