From 2410c93607bbce34fc89c6a8ce2ced00fe51cc72 Mon Sep 17 00:00:00 2001 From: NTG Date: Mon, 18 Aug 2025 17:12:01 +0900 Subject: [PATCH] =?UTF-8?q?=ED=98=84=EC=A7=80=ED=99=94=20=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=84=B0=20smart=20string=20=EC=97=B0=EB=8F=99=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Localization/LocalizationImporter.cs | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) 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