Skip to main content
The CometChatI18nProvider manages multi-language localization for the UI Kit. It handles automatic language detection, manual language switching, and custom translations.
Prerequisites:
  1. Install react-native-localize: npm install react-native-localize
  2. Wrap your app with CometChatI18nProvider inside CometChatThemeProvider
  3. Without the provider wrapper, automatic language detection won’t work

Supported Languages


Provider Props


Prerequisites

To enable localization features in your React Native application, you need to install the react-native-localize package. This package provides native device locale detection and is required for the automatic language detection functionality.

Installation

Install the required dependency:

Usage

Here is how you can implement custom localization:

Basic Usage (System Language Detection)

Overriding Translations

Using Translations in Custom Components

CometChat UI Kit provides a useCometChatTranslation hook to access translations within components, which can be used when developing custom components.

Methods

useCometChatTranslation

Hook to access translations within components.

Customization Capabilities

Below are the things which the developer can customize:
  • Set a supported language (selectedLanguage): The developer can set a language out of the 19 supported languages.
  • Customize default localization strings (translations): The developer can customize default localization strings for a particular language.
  • Add custom strings (translations): A developer can add custom strings in the localization for a particular language.
  • Add a new language (translations): The developer can add completely new languages.
  • Disable auto detection (autoDetectLanguage): The developer can disable auto detection of device language.
  • Handle missing keys: The developer can handle missing localization keys.
  • Set fallback language (fallbackLanguage): The developer can set a fallback language.
By using the CometChatI18nProvider component and useCometChatTranslation hook, you can provide a user-friendly, localized experience to your users, enhancing the overall user experience within your application.

Next Steps

Introduction to Theming

Learn how CometChatThemeProvider manages light and dark modes

Sound Manager

Manage audio playback for incoming and outgoing events

Components Overview

Explore all available UI Kit components

Getting Started

Set up CometChat UI Kit in your React Native app