When dealing with dictionaries you need to include the <key>
line that precedes <dict>
-- that's the thing that names the dictionary and allows you to target it. But there's only one <key>Goggomobil.xlf</key>
in the plist so it wasn't needed this time.
So your first change is
/usr/libexec/PlistBuddy -c "Set :/:translator/:projectTemplates /Users/hl/Dropbox/CT/User/CT_tpl/abc_pt.xml|" ~/Library/Preferences/com.apple.java.util.prefs.plist
"Set projectTemplates
, whose parent is translator/
, whose parent is /
, to the value /Users/hl/Dropbox/CT/User/CT_tpl/abc_pt.xml|
" (I've included the |
at the end because that was in the previous entry, take it out if not needed).
The second is
/usr/libexec/PlistBuddy -c "Add :/:translator/:templatesMap/:abc.xlf string \"abc_pt.xml\"" ~/Library/Preferences/com.apple.java.util.prefs.plist
"Add a key abc.xlf
with the string
value abc_pt.xml
to dictionary templatesMap/
, whose parent is translator/
, whose parent is /
." I've used escaped double-quotes around the string -- they're more obvious than unescaped singles (you'd end up with '"
) although neither are necessary here because the string contains no spaces or "funky" characters.