> ## Documentation Index
> Fetch the complete documentation index at: https://www.cometchat.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Localize

> The languages the CometChat iOS UI Kit v6 ships, how it picks one, and how to change labels and date formats in SwiftUI and UIKit.

> [accordion] AI Integration Quick Reference
>
> ```json theme={null}
> {
>   "catalog": "CometChatCore's Localizable.xcstrings — one string catalog both toolkits read",
>   "locales": ["ar", "de", "en", "en-GB", "es", "fr", "hi", "hu", "ja", "ko", "lt", "ms", "nl", "pt", "ru", "sv", "tr", "zh", "zh-TW"],
>   "languageSelection": "the language iOS runs your app in — no Kit API sets it; add the languages to your app's localizations",
>   "strings": "CometChatStrings — public, read-only accessors for the Kit's strings",
>   "labels": "per-component text parameters (title, searchPlaceholderText, …)",
>   "dates": "CometChatDateTimeFormatter (nine buckets, each nil = default); SwiftUI dateTimeFormatter: / dateFormat:, UIKit dateTimeFormatter / set(dateFormat:) / set(datePattern:)",
>   "related": ["/ui-kit/ios/v6/theming", "/ui-kit/ios/v6/sound-manager"]
> }
> ```

The UI Kit ships its interface in 19 languages and follows the language your app runs in.

***

## Core Concepts

* **One string catalog.** Every string the Kit draws lives in `CometChatCore`'s
  `Localizable.xcstrings`, so the SwiftUI and UIKit toolkits always say the same thing.
* **iOS picks the language.** The Kit has no language setter: it shows the language iOS runs
  your app in — the device language, or the per-app language the user chose in Settings.
* **`CometChatStrings`** exposes the Kit's strings as read-only properties, so your own views
  can reuse the Kit's wording.

### Supported Languages

| Language | Code | Language | Code |
| - | - | - | - |
| Arabic | `ar` | Korean | `ko` |
| Chinese (Simplified) | `zh` | Lithuanian | `lt` |
| Chinese (Traditional) | `zh-TW` | Malay | `ms` |
| Dutch | `nl` | Portuguese | `pt` |
| English | `en` | Russian | `ru` |
| English (UK) | `en-GB` | Spanish | `es` |
| French | `fr` | Swedish | `sv` |
| German | `de` | Turkish | `tr` |
| Hindi | `hi` | Japanese | `ja` |
| Hungarian | `hu` | | |

> [!NOTE]
>
> In a language the catalog lacks, the Kit falls back to English.

***

## Set the UI Kit Language

iOS runs an app only in the languages the **app** declares, and the Kit follows the app. Add
each language you support to your app target — in Xcode, **Project ▸ Info ▸ Localizations**,
or the `CFBundleLocalizations` key:

```xml Info.plist theme={null}
<key>CFBundleLocalizations</key>
<array>
    <string>en</string>
    <string>fr</string>
    <string>hi</string>
</array>
```

The user then picks the language in **Settings ▸ Your App ▸ Language**, or iOS uses the
device's.

> [tab] SwiftUI
>
> No setup beyond the app's localizations — the toolkit reads the catalog on every render:
>
> ```swift theme={null}
> struct ChatsTab: View {
>     var body: some View {
>         CometChatConversations()   // "Chats", "Discussions", "चैट्स" …
>     }
> }
> ```

> [tab] UIKit
>
> No setup beyond the app's localizations:
>
> ```swift theme={null}
> let conversations = CometChatConversations()   // "Chats", "Discussions", "चैट्स" …
> navigationController?.pushViewController(conversations, animated: true)
> ```

> [!NOTE]
>
> There is no locale setter: the language is the one iOS runs your app in.

***

## Override UI Kit Labels

The catalog cannot be overridden from your app — there is no `strings.xml`-style merge on iOS.
Change a label through the component that shows it:

> [tab] SwiftUI
>
> ```swift theme={null}
> CometChatConversations(
>     title: "Inbox",
>     searchPlaceholderText: "Find a chat"
> )
> ```
>
> State views take your own view — see [State Views](https://www.cometchat.com/docs/ui-kit/ios/v6/customization-state-views.md).

> [tab] UIKit
>
> ```swift theme={null}
> conversations.set(title: "Inbox")
> users.set(title: "People")
> ```

Reuse the Kit's own wording in your views with `CometChatStrings`:

> [tab] SwiftUI
>
> ```swift theme={null}
> Text(CometChatStrings.chats)
> ```

> [tab] UIKit
>
> ```swift theme={null}
> let label = UILabel()
> label.text = CometChatStrings.chats
> ```

***

## Customize Date & Time Labels

`CometChatDateTimeFormatter` has nine buckets — `time`, `today`, `yesterday`, `lastWeek`,
`otherDays`, `minute`, `minutes`, `hour`, `hours`. Each returns `String?`; `nil`, or leaving
the method out, keeps the Kit's text, so you change only the buckets you care about.

```swift theme={null}
struct ShortDates: CometChatDateTimeFormatter {
    func today(_ date: Date) -> String? { "Today" }
    func yesterday(_ date: Date) -> String? { "Yesterday" }
    func otherDays(_ date: Date) -> String? {
        date.formatted(.dateTime.day().month(.abbreviated).year())
    }
    func minutes(_ minutesAgo: Int, _ date: Date) -> String? { "\(minutesAgo) min ago" }
}
```

> [tab] SwiftUI
>
> ```swift theme={null}
> CometChatConversations(dateTimeFormatter: ShortDates())
> CometChatMessageList(user: user, dateTimeFormatter: ShortDates())
> ```
>
> A `DateFormatter` passed as `dateFormat:` replaces the formatter wholesale and wins over it.

> [tab] UIKit
>
> ```swift theme={null}
> messageList.dateTimeFormatter = ShortDates()
> header.dateTimeFormatter = ShortDates()
>
> let formatter = DateFormatter()
> formatter.dateFormat = "HH:mm"
> conversations.set(dateFormat: formatter)
> ```
>
> The conversation list takes a `DateFormatter` through `set(dateFormat:)`, or a
> `set(datePattern:)` closure; the formatter wins.

Which buckets a component asks depends on the toolkit — the SwiftUI message
header asks only `otherDays`, the UIKit one every bucket.

***

## Additional API

| API | Description |
| - | - |
| `CometChatStrings.<name>` | the Kit's string for the current language, read-only |
| `CometChatDateTimeFormatter` | the nine-bucket date protocol, every method optional |
| per-component `title`, `searchPlaceholderText` | replace one label on one component |

The Kit has no locale getters or reset: use `Locale.current` and the view's layout direction.

## Next Steps

> [card] [Sound Manager](https://www.cometchat.com/docs/ui-kit/ios/v6/sound-manager.md)
>
> The incoming-message sound.

> [card] [Theme Introduction](https://www.cometchat.com/docs/ui-kit/ios/v6/theming.md)
>
> Colours, fonts and dark appearance.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.