Documentation Index Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
AI Integration Quick Reference
Field Value Import com.cometchat.uikit.core.resources.localise.CometChatLocalizeSet language CometChatLocalize.setLocale(context, Language.FRENCH)Get language CometChatLocalize.getLocale(context)Supported languages 19: ar, de, en, es, fr, hi, hu, it, ja, ko, lt, ms, nl, pl, pt, ru, sv, tr, zh Override labels res/values/strings.xml — override UI Kit string resource keysRelated Theme Introduction · Sound Manager
Set the CometChat UI Kit language and override UI text so your app matches your users’ locale.
Core Concepts
CometChatLocalize — utility object in chatuikit-core to set and read the UI Kit locale. Shared by both Kotlin XML and Jetpack Compose modules.
Language — constants for supported language codes (Language.ENGLISH, Language.FRENCH, etc.)
strings.xml — Android string resources that control visible text in UI Kit components. Override keys in your app’s strings.xml.
Supported Languages
Language Code Language Code Arabic arKorean koChinese zhLithuanian ltDutch nlMalay msEnglish enPolish plFrench frPortuguese ptGerman deRussian ruHindi hiSpanish esHungarian huSwedish svItalian itTurkish trJapanese ja
Set the UI Kit Locale
Call CometChatLocalize.setLocale() before rendering any UI Kit components.
Kotlin (XML Views)
Jetpack Compose
import com.cometchat.uikit.core.resources.localise.CometChatLocalize
import com.cometchat.uikit.core.resources.localise.Language
// Set language to Hindi
CometChatLocalize. setLocale ( this , Language.HINDI)
// Read current locale
val currentLocale = CometChatLocalize. getLocale ( this )
import com.cometchat.uikit.core.resources.localise.CometChatLocalize
import com.cometchat.uikit.core.resources.localise.Language
// Set language before setContent {}
CometChatLocalize. setLocale ( this , Language.HINDI)
setContent {
CometChatTheme {
// UI Kit composables will use Hindi strings
CometChatConversations ( .. .)
}
}
Override UI Kit Labels
Override any UI Kit string by adding the same key to your app’s res/values/strings.xml. No source code changes needed — Android’s resource merging handles it.
< resources >
<!-- Override the conversations list title -->
< string name = "cometchat_chats" translatable = "true" > Conversations </ string >
<!-- Override the "typing" indicator text -->
< string name = "cometchat_typing" translatable = "true" > writing... </ string >
</ resources >
This works identically for both Kotlin XML Views and Jetpack Compose — both modules read from the same Android string resources.
Customize Date & Time Labels
Override how timestamps like “Today”, “Yesterday”, and “X mins ago” are displayed.
Kotlin (XML Views)
Jetpack Compose
Set a DateTimeFormatterCallback on individual components: import com.cometchat.uikit.kotlin.shared.interfaces.DateTimeFormatterCallback
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
val messageList = findViewById < CometChatMessageList >(R.id.message_list)
messageList. setDateTimeFormatter ( object : DateTimeFormatterCallback {
private val dateFormatter = SimpleDateFormat ( "dd MMM yyyy" , Locale. getDefault ())
override fun time (timestamp: Long ): String = SimpleDateFormat ( "hh:mm a" , Locale. getDefault ()). format ( Date (timestamp))
override fun today (timestamp: Long ): String = "Today"
override fun yesterday (timestamp: Long ): String = "Yesterday"
override fun lastWeek (timestamp: Long ): String = "Last Week"
override fun otherDays (timestamp: Long ): String = dateFormatter. format ( Date (timestamp))
override fun minutes (diffInMinutesFromNow: Long , timestamp: Long ): String = " $diffInMinutesFromNow mins ago"
override fun hours (diffInHourFromNow: Long , timestamp: Long ): String = " $diffInHourFromNow hrs ago"
})
Pass a dateTimeFormatter parameter to the component: CometChatMessageList (
user = user,
dateTimeFormatter = object : DateTimeFormatterCallback {
override fun time (timestamp: Long ): String = SimpleDateFormat ( "hh:mm a" , Locale. getDefault ()). format ( Date (timestamp))
override fun today (timestamp: Long ): String = "Today"
override fun yesterday (timestamp: Long ): String = "Yesterday"
override fun lastWeek (timestamp: Long ): String = "Last Week"
override fun otherDays (timestamp: Long ): String = SimpleDateFormat ( "dd MMM yyyy" , Locale. getDefault ()). format ( Date (timestamp))
override fun minutes (diffInMinutesFromNow: Long , timestamp: Long ): String = " $diffInMinutesFromNow mins ago"
override fun hours (diffInHourFromNow: Long , timestamp: Long ): String = " $diffInHourFromNow hrs ago"
}
)
Additional API
Method Description CometChatLocalize.setLocale(context, language)Sets the UI Kit language CometChatLocalize.getLocale(context)Returns the current locale country code CometChatLocalize.getLanguage(context)Returns the current locale language code CometChatLocalize.isRtl(context)Checks if the current locale is right-to-left CometChatLocalize.resetToDefault()Resets locale to system default CometChatLocalize.createLocalizedContext(context, language)Creates a context with a specific locale without affecting the app globally