Hi all,
I am trying to localise the purpose strings in my Info.plist file, for that I am using the InfoPlist.xcstrings file. In my app I have multiple targets, each with a different display name, the problem that I am facing is that when the InfoPlist.xcstrings file is automatically updated in each build the CFBundleDisplayName is always added to the file which forces me to have just one name for every target. So, I would like to know how others approach this problem and how can I resolve my situation. The ideal solution was that there was a way for me to disable this automatic generation (or at least trigger it by hand) once I have added all the purpose strings that I want to localise in multiple languages. If not, having one InfoPlist.xcstrings per target will also so it, although it will be a little harder to maintain. AFAIK, there's no documentation on the InfoPlist.xcstrings generation, so any help will be very much appreciated.
Thank you all in advance
The recommended approach here is to have separate InfoPlist.xcstrings files per target. Otherwise you would not be able to effectively translate the app name without every target having the same name.
There is no setting for disabling extraction of CFBundleDisplayName from the Info.plist. Even if it wasn't in the String Catalog, Xcode would generate it again when exporting localizations to allow translators to translate it.
The naming convention of InfoPlist.xcstrings is as follows:
- The Info.plist file (if you have one) should not be added to any targets but referenced by the "Info.plist File" build setting in the relevant target. The corresponding .xcstrings file should be added to the target.
- "InfoPlist.xcstrings" always works to refer to the strings for the Info plist (regardless of the name of the Info plist file and even if it is fully generated at build time).
- If a target's Info plist file is named "CustomName.plist", then the xcstrings file may be named "CustomName-InfoPlist.xcstrings".
- If a target's Info plist file is named "CustomNameInfo.plist", then the xcstrings file may be named "CustomNameInfoPlist.xcstrings".
- If no explicit Info.plist file is in the project but you are using auto-generation via the "Generate Info.plist File" build setting, then you can name your xcstrings file "TargetName-InfoPlist.xcstrings".