Expand description
国际化(i18n)支持 — Fluent FTL 消息翻译 + ICU4X 本地化格式化。
提供两大能力:
- 消息翻译(
I18nManager+tr):基于 Fluent FTL 消息文件, 支持中英文切换,系统语言环境自动检测。 - 本地化格式化([
I18nFormatter]):ICU4X 驱动的数字/日期/复数/排序格式化。
§启动初始化
在应用启动时调用 I18nManager::init 自动检测系统语言环境:
use trait_kit::i18n::I18nManager;
let mgr = I18nManager::init();或使用指定 locale:
use trait_kit::i18n::I18nManager;
let mgr = I18nManager::init_with_locale("zh-CN").expect("zh-CN locale");Structs§
- I18n
Manager - Fluent 消息翻译管理器。
Enums§
- I18n
Error - 国际化操作返回的错误类型。
Functions§
- tr
- 便捷函数:翻译消息 key。