Skip to main content
FieldValue
Package@cometchat/chat-uikit-angular
Key classCometChatLocalize (static class for all localization)
Key pipeTranslatePipe (translate pipe in templates)
Required setupCometChatUIKit.init(uiKitSettings)
PurposeMulti-language support with runtime switching and global overrides
Features19 built-in languages, runtime switching, custom translations
RelatedDate/Time Formatting | Theming
CometChat UIKit supports 19 languages out of the box with runtime language switching. You can override translations globally without modifying source files.
CapabilityDescription
Built-in languagesen-US, en-GB, de, fr, es, ja, ko, zh, zh-TW, ru, hi, ms, pt, sv, lt, hu, it, nl, tr
Runtime switchingChange language at any time via setCurrentLanguage
Global overridesReplace any translation key for a language
Custom languagesAdd entirely new languages at runtime

Setting the Language


Global Translation Overrides

Override specific translation keys for any language:
Existing keys are replaced; new keys are added. All other translations remain unchanged.

Using the Translate Pipe

Resolution Priority

When resolving a translation key:
  1. Global translation for current language
  2. Fallback language translation (default: en-US)
  3. Returns the key itself if nothing found

Adding a New Language


Programmatic Translation

In TypeScript code (outside templates):

Initialization Options


Date & Time Localization

CalendarObject

Use CalendarObject to customize how dates and times are displayed throughout the UIKit. Supports relative time formatting for minutes and hours.
Changing this format globally updates the date and time representation wherever it is used. If a component-specific CalendarObject is provided, it takes higher precedence over the global settings.
PropertyTypeDescription
todaystringFormat for dates on the same day. Example: "Today at hh:mm A"
yesterdaystringFormat for dates on the previous day. Example: "Yesterday at hh:mm A"
lastWeekstringFormat for dates within the last 7 days. Example: "Last week on dddd"
otherDaysstringFormat for dates that do not fit other categories. Example: "DD MMM YYYY, hh:mm A"
relativeTimeobjectCustom formatting for relative time expressions
relativeTime.minutestringSingle minute format. Example: "%d minute ago"
relativeTime.minutesstringMultiple minutes format. Example: "%d minutes ago"
relativeTime.hourstringSingle hour format. Example: "%d hour ago"
relativeTime.hoursstringMultiple hours format. Example: "%d hours ago"

Global Configuration

Apply a custom date format globally via CometChatLocalize.init():

Component-Specific Configuration

Pass a CalendarObject directly to a component to override the global format for that component only:

formatDate

Format a Unix timestamp using a CalendarObject directly:
ParameterTypeDescription
timestampnumberUnix timestamp in seconds
calendarObjectCalendarObjectCalendar configuration for formatting
Returns a formatted date string.