Localization of the variable Info.plist with the added string

I am trying to localize the application name while still being able to add a string depending on the assembly configuration. Therefore, it is currently configured as:

<key>CFBundleDisplayName</key> <string>${PRODUCT_NAME}${BUNDLE_DISPLAY_NAME_SUFFIX}</string> 

This setting is defined as:

Build setting

Thus, we can add a suffix to the application for different beta versions. The problem is that when we try to localize the display name of the application in the localized InfoPlist.strings so that

 CFBundleDisplayName = "Localized App Name"; 

We overwrite the value stored in Info.plist and lose the suffix symbol. Is there a good way around this? We would like to avoid having multiple Info.plist files.

+8
source share
1 answer

For this you need a custom script. Here is one that works for me.

 PREFIX_IDENTIFIER="=com.mycompany.bundlenameprefix=" PREFIX="" if [ $CONFIGURATION == "Debug" ] then PREFIX="α " fi if [ $CONFIGURATION == "Enterprise" ] then PREFIX="β " fi for i in `dirname "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"`/*.lproj/InfoPlist.strings do plutil -convert json "$i" sed -i -e "s/${PREFIX_IDENTIFIER}/${PREFIX}/g" "$i" plutil -convert binary1 "$i" done 

Then in your InfoPlist.strings add a prefix to the package name, e.g.

 CFBundleDisplayName = "=com.mycompany.bundlenameprefix=My App"; 
+7
source

Source: https://habr.com/ru/post/1210472/


All Articles