using System; using System.Collections.Generic; using System.Globalization; using System.Resources; using XP.Common.Localization.Enums; using XP.Common.Localization.Events; namespace XP.Common.Localization.Interfaces { /// /// 本地化服务接口 | Localization service interface /// 提供多语言资源访问和语言切换功能 | Provides multilingual resource access and language switching /// public interface ILocalizationService { /// /// 获取当前语言 | Get current language /// SupportedLanguage CurrentLanguage { get; } /// /// 语言切换事件 | Language changed event /// event EventHandler LanguageChanged; /// /// 获取本地化字符串(使用当前语言)| Get localized string (using current language) /// /// 资源键 | Resource key /// 本地化字符串 | Localized string string GetString(string key); /// /// 获取本地化字符串(指定语言)| Get localized string (specified language) /// /// 资源键 | Resource key /// 文化信息 | Culture info /// 本地化字符串 | Localized string string GetString(string key, CultureInfo culture); /// /// 设置当前语言 | Set current language /// /// 目标语言 | Target language void SetLanguage(SupportedLanguage language); /// /// 获取所有支持的语言 | Get all supported languages /// /// 支持的语言列表 | List of supported languages IEnumerable GetSupportedLanguages(); /// /// 注册模块资源源到 Fallback Chain 末尾(最高优先级) /// Register a module resource source to the end of the Fallback Chain (highest priority) /// /// 资源源名称(如 "XP.Scan"),用于标识和注销 | Resource source name (e.g. "XP.Scan"), used for identification and unregistration /// 模块的 ResourceManager 实例 | The module's ResourceManager instance void RegisterResourceSource(string name, ResourceManager resourceManager); /// /// 从 Fallback Chain 中注销指定资源源 /// Unregister the specified resource source from the Fallback Chain /// /// 资源源名称 | Resource source name void UnregisterResourceSource(string name); } }