Call CometChatLocalize.setLocale() before rendering any UI Kit components.
Kotlin (XML Views)
Jetpack Compose
import com.cometchat.uikit.core.resources.localise.CometChatLocalizeimport com.cometchat.uikit.core.resources.localise.Language// Set language to HindiCometChatLocalize.setLocale(this, Language.HINDI)// Read current localeval currentLocale = CometChatLocalize.getLocale(this)
import com.cometchat.uikit.core.resources.localise.CometChatLocalizeimport 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 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.
res/values/strings.xml
<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.