将Feature/XP.Common和Feature/XP.Hardware分支合并至Develop/XP.forHardwareAndCommon,完善XPapp注册和相关硬件类库通用类库功能。
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using XP.Common.Localization.Enums;
|
||||
|
||||
namespace XP.Common.Localization.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// 本地化配置接口 | Localization configuration interface
|
||||
/// 负责语言设置的加载和保存 | Responsible for loading and saving language settings
|
||||
/// </summary>
|
||||
public interface ILocalizationConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取保存的语言设置 | Get saved language setting
|
||||
/// </summary>
|
||||
/// <returns>语言设置,如果未设置则返回 null | Language setting, or null if not set</returns>
|
||||
SupportedLanguage? GetSavedLanguage();
|
||||
|
||||
/// <summary>
|
||||
/// 保存语言设置 | Save language setting
|
||||
/// </summary>
|
||||
/// <param name="language">要保存的语言 | Language to save</param>
|
||||
void SaveLanguage(SupportedLanguage language);
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统默认语言 | Get system default language
|
||||
/// </summary>
|
||||
/// <returns>系统默认语言 | System default language</returns>
|
||||
SupportedLanguage GetSystemDefaultLanguage();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// 本地化服务接口 | Localization service interface
|
||||
/// 提供多语言资源访问和语言切换功能 | Provides multilingual resource access and language switching
|
||||
/// </summary>
|
||||
public interface ILocalizationService
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取当前语言 | Get current language
|
||||
/// </summary>
|
||||
SupportedLanguage CurrentLanguage { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 语言切换事件 | Language changed event
|
||||
/// </summary>
|
||||
event EventHandler<LanguageChangedEventArgs> LanguageChanged;
|
||||
|
||||
/// <summary>
|
||||
/// 获取本地化字符串(使用当前语言)| Get localized string (using current language)
|
||||
/// </summary>
|
||||
/// <param name="key">资源键 | Resource key</param>
|
||||
/// <returns>本地化字符串 | Localized string</returns>
|
||||
string GetString(string key);
|
||||
|
||||
/// <summary>
|
||||
/// 获取本地化字符串(指定语言)| Get localized string (specified language)
|
||||
/// </summary>
|
||||
/// <param name="key">资源键 | Resource key</param>
|
||||
/// <param name="culture">文化信息 | Culture info</param>
|
||||
/// <returns>本地化字符串 | Localized string</returns>
|
||||
string GetString(string key, CultureInfo culture);
|
||||
|
||||
/// <summary>
|
||||
/// 设置当前语言 | Set current language
|
||||
/// </summary>
|
||||
/// <param name="language">目标语言 | Target language</param>
|
||||
void SetLanguage(SupportedLanguage language);
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有支持的语言 | Get all supported languages
|
||||
/// </summary>
|
||||
/// <returns>支持的语言列表 | List of supported languages</returns>
|
||||
IEnumerable<SupportedLanguage> GetSupportedLanguages();
|
||||
|
||||
/// <summary>
|
||||
/// 注册模块资源源到 Fallback Chain 末尾(最高优先级)
|
||||
/// Register a module resource source to the end of the Fallback Chain (highest priority)
|
||||
/// </summary>
|
||||
/// <param name="name">资源源名称(如 "XP.Scan"),用于标识和注销 | Resource source name (e.g. "XP.Scan"), used for identification and unregistration</param>
|
||||
/// <param name="resourceManager">模块的 ResourceManager 实例 | The module's ResourceManager instance</param>
|
||||
void RegisterResourceSource(string name, ResourceManager resourceManager);
|
||||
|
||||
/// <summary>
|
||||
/// 从 Fallback Chain 中注销指定资源源
|
||||
/// Unregister the specified resource source from the Fallback Chain
|
||||
/// </summary>
|
||||
/// <param name="name">资源源名称 | Resource source name</param>
|
||||
void UnregisterResourceSource(string name);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user