Zac Kwan Zac Kwan - 2 months ago 9
Swift Question

Localise App display name that have append suffix

I have a issue with getting app display name to include the appending suffix when adding localisation to

InfoStrings.plist
.

I have add different
scheme
and
User-Defined
attribute. So in my info.plist, i have
App Name $(BUNDLE_DISPLAY_NAME_SUFFIX)
in my
CFBundleDisplayName
. It will append a
-S
to my app name when running on development scheme and normal app name on release scheme that i created. Everything is working well.

However, when I try to translate the app name, it does not work anymore. So in my
infoPlist.strings
, I tried the following:

"CFBundleDisplayName" = "App Name ";
"CFBundleDisplayName" = "App Name $(BUNDLE_DISPLAY_NAME_SUFFIX)";


Both does not append the
-S
anymore when I run on development scheme. Does anyone know how I could still do that? Like maybe how to get the
$(Bundle_DISPLAY_NAME_SUFFIX)
to be read in the
infoPlist.strings
.

More specifically, how do I include a preprocessor in
InfoPlist.strings
?

Answer

I found the answer to your question in another thread, here, but it says you need a scrip for this.

How you create different suffixes (not what was asked for) Here is how you set up different display name of your app based on the your scheme. You can do this by setting up different configurations. Go to the project settings -> select the project (not the target) -> Info tab -> then create as many configurations you would like. Maybe one for Production, Debug and one for Beta releases.

Then select your Target -> Build settings tab -> Enter display in search. Under User defined you can create your own variable, call it e.g. BUNDLE_DISPLAY_NAME_SUFFIX. Give it different values for Production, Debug and Beta.

Open your Info.plist file, under Bundle display name, your see maybe MyApp, append the string ${BUNDLE_DISPLAY_NAME_SUFFIX} so it makes MyApp${BUNDLE_DISPLAY_NAME_SUFFIX}.

Finally configure your schemes to use the correct configuration. You probably want to use Production for Archive and Debug for Debug.

Here is an image of the User defined variable

Comments