Language | Code |
---|---|
English (United States) | en-US |
English (United Kingdom) | en-GB |
Dutch | nl |
French | fr |
German | de |
Hindi | hi |
Italian | it |
Japanese | ja |
Korean | ko |
Portuguese | pt |
Russian | ru |
Spanish | es |
Turkish | tr |
Chinese | zh |
Chinese (Traditional) | zh-TW |
Malay | ms |
Swedish | sv |
Lithuanian | lt |
Hungarian | hu |
CometChatLocalize
class provides methods for managing localization in the UI Kit.
🔗 View full class file in the GitHub repository:LocalizationSettings
interface defines various localization settings for an application or component. It allows developers to configure the language, translations, time zone, and calendar formatting while providing options for automatic detection and missing key handling.
Property | Type | Description |
---|---|---|
language | string | The language code (e.g., "en" , "fr" ) for the current localization. |
translationsForLanguage | { [key: string]: any } | An object containing key-value pairs for translations in the current language. |
disableAutoDetection | boolean | Disables automatic language detection based on the browser or device settings. |
fallbackLanguage | string | The fallback language code to use if the primary language is not available. |
disableDateTimeLocalization | boolean | Disables localization for date and time values, forcing the default format. |
timezone | string | The timezone used for date and time formatting (e.g., "America/New_York" , "Europe/London" ). |
calendarObject | CalendarObject | A custom calendar format using CalendarObject to define localized date and time formatting. |
missingKeyHandler | (key: string) => string | A function that handles missing translation keys, allowing custom error handling or fallbacks. |
CalendarObject
class defines customizable formatting for date and time representation. It allows you to format dates based on whether they are today, yesterday, last week, or other days. It also supports relative time formatting for minutes and hours.
CalendarObject
is provided, it will take higher precedence over the global settings.Property | Type | Description |
---|---|---|
today | string | Custom formatting for dates that fall on the same day. Example: "Today at hh:mm A" |
yesterday | string | Custom formatting for dates that fall on the previous day. Example: "Yesterday at hh:mm A" |
lastWeek | string | Custom formatting for dates within the last 7 days. Example: "Last week on dddd" |
otherDays | string | Custom formatting for dates that do not fit other categories. Example: "DD MMM YYYY, hh:mm A" |
relativeTime | object | Custom formatting for relative time expressions (e.g., “2 hours ago”). |
relativeTime.minute | string | Formatting for a single minute. Example: "%d minute ago" |
relativeTime.minutes | string | Formatting for multiple minutes. Example: "%d minutes ago" |
relativeTime.hour | string | Formatting for a single hour. Example: "%d hour ago" |
relativeTime.hours | string | Formatting for multiple hours. Example: "%d hours ago" |
CometChatLocalize.init()
or pass a CalendarObject
directly to individual components for component-specific customization.
CometChatLocalize.init()
, all UI components will automatically use the configured date/time formats.CalendarObject
is passed to a component, it overrides the global settings and applies only to that specific instance.