多语言切换
更新时间: 2025/04/02 16:36:11
IM UIKit 的默认语言为中文,您可以通过配置组件支持多语言环境。
操作步骤
-
在根组件的
MaterialApp
中将supportedLocales
设置为IMKitClient.supportedLocales
。 -
将使用到的模块多语言
delegate
配置到localizationsDelegates
。
示例代码如下:
dartMaterialApp(
// 1. 添加支持的语言
supportedLocales: IMKitClient.supportedLocales,
// 2. 添加模块支持
localizationsDelegates: [
CommonUILocalizations.delegate,
ConversationKitClient.delegate,
ChatKitClient.delegate,
ContactKitClient.delegate,
TeamKitClient.delegate,
SearchKitClient.delegate,
...GlobalMaterialLocalizations.delegates,
],
);
此文档是否对你有帮助?