diff --git a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs index 6dab72e88..e7dcb31b2 100644 --- a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs +++ b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationManager.cs @@ -3,6 +3,7 @@ using System.Linq; using System.Threading.Tasks; using UnityEngine; +using UnityEngine.Localization; namespace DDD { @@ -16,7 +17,7 @@ public enum TableName public class LocalizationManager : Singleton, IManager { - private readonly Dictionary _localizedCache = new(); + private readonly Dictionary _localizedCache = new(); private string _currentLocaleCode; private bool _isInitialized; @@ -40,11 +41,16 @@ public void PreInit() foreach (var entry in stringTable.Values) { - if (entry == null || string.IsNullOrEmpty(entry.KeyId.ToString())) continue; + if (entry == null || string.IsNullOrEmpty(entry.Key)) continue; if (!_localizedCache.ContainsKey(entry.Key)) { - _localizedCache.Add(entry.Key, entry.GetLocalizedString()); + var localizedString = new LocalizedString + { + TableReference = tableName, + TableEntryReference = entry.Key + }; + _localizedCache.Add(entry.Key, localizedString); } } } @@ -65,12 +71,12 @@ public void PostInit() /// /// 현재 선택된 로케일 기준으로 로컬라이징 텍스트를 가져옵니다. /// - public string GetString(string key) + public LocalizedString GetLocalizedString(string key) { if (!_isInitialized) { Debug.LogWarning("[LocalizationManager] 호출 전에 초기화되지 않았습니다."); - return $"[Uninitialized:{key}]"; + return null; } if (_localizedCache.TryGetValue(key, out var value)) return value; @@ -79,6 +85,12 @@ public string GetString(string key) return null; } + public string GetString(string key) + { + var localizedString = GetLocalizedString(key); + return LocalizationSettings.StringDatabase.GetLocalizedString(localizedString.TableReference, key, LocalizationSettings.SelectedLocale); + } + /// /// 현재 사용 중인 로케일 코드 반환 (예: "ko", "en", "ja") ///