.localize
— to fetch localized text dynamically.Method | Description |
---|---|
set(locale:) | Sets the language using Language enum (.english, .french, etc.) |
getLocale() | Returns the currently active locale. By default, it will return the current language from the device/browser. |
CometChatDateTimeFormatter
is a configuration class that exposes customizable closures for various time-related strings. Developers can assign custom behavior to each closure based on their desired formatting logic.
Property | Description | Code |
---|---|---|
time | Called to format a timestamp as a standard time (e.g., “12:30 PM”). | CometChatUIKit.dateTimeFormatter.time = { ... } |
today | Called when rendering messages sent today. | CometChatUIKit.dateTimeFormatter.today = { ... } |
yesterday | Called for yesterday’s messages. | CometChatUIKit.dateTimeFormatter.yesterday = { ... } |
lastweek | Called for messages within the last week. | CometChatUIKit.dateTimeFormatter.lastweek = { ... } |
otherDay | Called for dates older than last week. | CometChatUIKit.dateTimeFormatter.otherDay = { ... } |
minute | Called when referring to “a minute ago”. | CometChatUIKit.dateTimeFormatter.minute = { ... } |
minutes | Called for “x minutes ago”. | CometChatUIKit.dateTimeFormatter.minutes = { ... } |
hour | Called for “an hour ago”. | CometChatUIKit.dateTimeFormatter.hour = { ... } |
hours | Called for “x hours ago”. | CometChatUIKit.dateTimeFormatter.hours = { ... } |
CometChatUIKit.dateTimeFormatter
. Use this to apply formatting across all components in the CometChatUIKit
.CometChatDateTimeFormatter
gives developers fine-grained control over how date and time appear throughout their app. Whether you’re customizing for locale, branding, or clarity, this system ensures your app’s time formatting is as user-friendly and context-aware as possible.