Skip to content

Commit b6fef34

Browse files
committed
refactor(Xcode): 移除未使用的本地化键收集和Info.plist更新逻辑
清理不再需要的代码,简化本地化处理流程
1 parent 41671f7 commit b6fef34

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Editor/PostProcessBuildHelper.Localization.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private static void RunLocalization(PBXProject project, string projectGuid, stri
2828
string pbxprojPath = Path.Combine(path, "Unity-iPhone.xcodeproj/project.pbxproj");
2929

3030
// 收集所有需要本地化的键,用于更新 Info.plist
31-
HashSet<string> localizationKeys = new HashSet<string>();
31+
// HashSet<string> localizationKeys = new HashSet<string>();
3232

3333
foreach (Hashtable loc in localizations)
3434
{
@@ -68,7 +68,7 @@ private static void RunLocalization(PBXProject project, string projectGuid, stri
6868
sb.Append($"\"{key}\" = \"{value}\";\n");
6969

7070
// 记录需要本地化的键
71-
localizationKeys.Add(key);
71+
// localizationKeys.Add(key);
7272
}
7373
}
7474

@@ -83,14 +83,15 @@ private static void RunLocalization(PBXProject project, string projectGuid, stri
8383
}
8484

8585
// 更新 Info.plist,将本地化键的值设置为 ${KEY} 格式
86-
UpdateInfoPlistForLocalization(path, localizationKeys);
86+
// UpdateInfoPlistForLocalization(path, localizationKeys);
8787

8888
// 使用 PBXProject API 添加本地化文件到项目
8989
AddLocalizationToProject(project, path, localizations);
9090

9191
LogHelper.Log("Setting project [Localization] finished");
9292
}
9393

94+
/*
9495
/// <summary>
9596
/// 更新 Info.plist,将本地化键的值设置为 ${KEY} 格式
9697
/// 这样 iOS 系统会自动从 InfoPlist.strings 中读取对应语言的值
@@ -128,6 +129,7 @@ private static void UpdateInfoPlistForLocalization(string projectPath, HashSet<s
128129
plist.WriteToFile(plistPath);
129130
LogHelper.Log("Info.plist updated with localization references");
130131
}
132+
*/
131133

132134
/// <summary>
133135
/// 添加本地化资源到 Xcode 项目
@@ -182,4 +184,4 @@ private static void AddLocalizationToProject(PBXProject project, string projectP
182184
}
183185
}
184186
}
185-
#endif
187+
#endif

0 commit comments

Comments
 (0)