Files
zeling_v2/Assets/_Game/Scripts/Localization/ILocalizationService.cs

25 lines
812 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
namespace BaseGames.Localization
{
/// <summary>
/// 本地化服务接口。通过 ServiceLocator 注册,供 UI 和游戏系统获取本地化文本。
/// </summary>
public interface ILocalizationService
{
/// <summary>当前激活的语言。</summary>
Language CurrentLanguage { get; }
/// <summary>
/// 获取本地化字符串。查找顺序:当前语言 → 回退语言English→ 直接返回 key。
/// </summary>
string Get(string key, string table = "UI");
/// <summary>切换游戏语言并通知所有订阅者刷新文本。</summary>
void SetLanguage(Language language);
/// <summary>语言切换时触发。</summary>
event Action<Language> OnLanguageChanged;
}
}