I'm attempting to add localizations to values that appear in my Info.plist file. I'm having no trouble doing this for top-level keys using an InfoPlist.strings
file. But, I cannot figure out how to get it to work for non-top-level values.
For example, the CFBundleDocumentTypes
is an array of dictionaries. I need to localize each array's CFBundleTypeName
key differently. A similar situation exists for UTExportedTypeDeclarations
/UTImportedTypeDeclarations
, with the UTTypeDescription
key.
Apple's documentation on UTTypeDescription
specifically says that it can be localized with an InfoPlist.strings files. And I've tried, but have not been successful.
As reference, I tried to refer to Apple's own apps. The only one I was able to find that uses any non-root keys was Xcode, and Xcode isn't actually localized to anything other than English. I cannot be sure if its approach actually works. And, there's at least some strangeness within Xcode's bundle, because there are keys that appear in its InfoPlist.strings file that aren't actually in the Info.plist itself.
Does anyone know how (or if) this can be done?
Real life example with my own app. If you have an exported type with this:
<key>UTTypeDescription</key>
<string>CreaPhoto document</string>
My French translation in InfoPlist.strings
is:
"CreaPhoto document" = "Document CréaPhoto";
It seems so dumb a "duh yeah of course" moment, but this is totally different from everything else in the info.plist
translations, where you are expected to put the key when it's in root. No donut to Apple for not explaining this in their page.
Things to add in macOS: you must increment your Bundle ID each time you modify this (38 to 39 to 40 to 41 to 42 ...), you must build your new version, execute it in debugger (or release), and you must logout and logon so it gets taken into account.
There are ways with less steps, but this is the safest sure-fire way I found to get it applied in Finder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With