diff --git a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationImporter.cs b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationImporter.cs index 6a92b0568..9ea7bd810 100644 --- a/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationImporter.cs +++ b/Assets/_DDD/_Scripts/GameFramework/Localization/LocalizationImporter.cs @@ -2,9 +2,11 @@ using UnityEngine; using UnityEditor; using UnityEngine.Localization.Tables; +using UnityEngine.Localization.Metadata; using System.Collections.Generic; using Newtonsoft.Json; using UnityEditor.Localization; +using System.Linq; namespace DDD { @@ -59,7 +61,16 @@ public static async void ImportAllFromSheet(string webAppUrl) continue; } - table.AddEntry(sharedEntry.Id, row[localeCode]); + // Smart String 처리 정책 + // 값에 SmartFormat 구문(중괄호)이 포함되어 있는 경우에만 Smart로 간주 + string value = row[localeCode]; + bool containsSmartSyntax = ContainsSmartFormatSyntax(value); + + var entry = table.AddEntry(sharedEntry.Id, value); + if (entry != null) + { + entry.IsSmart = containsSmartSyntax; + } EditorUtility.SetDirty(table); } } @@ -69,6 +80,19 @@ public static async void ImportAllFromSheet(string webAppUrl) Debug.Log("[Localization Import] 완료: Google Sheet → Unity"); } + + /// + /// SmartFormat 사용 여부를 간단히 추정합니다. + /// 대부분의 SmartFormat 구문은 중괄호를 포함하므로 값에 '{'와 '}'가 모두 존재하는 경우 Smart로 판단합니다. + /// + private static bool ContainsSmartFormatSyntax(string value) + { + if (string.IsNullOrEmpty(value)) return false; + int openIdx = value.IndexOf('{'); + if (openIdx < 0) return false; + int closeIdx = value.IndexOf('}', openIdx + 1); + return closeIdx >= 0; + } } } #endif \ No newline at end of file