我刚刚将我的 Mac OS 更新为 Mavericks 并在我的项目中遇到了一个问题。
我使用苹果脚本在 plist 中更新本地化密钥。但是当我将本地化密钥 plist 文件设置为 0 KB 时。
它在 Mac OS 10.8 中运行。
以下是我更改 plist 键的脚本:
if keyVar as string = "CFBundleLocalizations" then
-- Parse the string for delimiter , and get the array of schemes
set AppleScript's text item delimiters to ","
set theLanguageItems to text items of valVar
-- restore delimiters to previous.if not reset then creats error for below code if we have any property below CFBundleLocalizations propert file.
set AppleScript's text item delimiters to "="
--if there are localization available
if the length of theLanguageItems is greater than 0 then
--create structure for CFBundleLocalizations
tell application "System Events"
set pFile to property list file plistFile
tell pFile
tell contents
--and write to the plist file
--make new property list item with properties {kind:list, value:"theLanguageItems"}
set value of property list item "CFBundleLocalizations" to theLanguageItems
end tell
end tell
end tell
end if