Re: BundleDisplayName


Gerriet M. Denkmann
 

On 10 Jul 2017, at 01:13, Quincey Morris <quinceymorris@rivergatesoftware.com> wrote:

On Jul 9, 2017, at 07:45 , Gerriet M. Denkmann <g@mdenkmann.de> wrote:

It never reads Base.lproj, even if the system language = Localization native development region = CFBundleDevelopmentRegion

The problem is that Xcode (obviously unaware of this Finder peculiarity) does NOT allow English as an additional localisation (because the development region already is English; so English speaking computers should just use Base.lproj).

What can be done?
I’m not sure I understand completely, but I think you’re missing one point.

As with the base localization, which (as you say) means that Xcode treats it as the “localization” for the development language, and you omit the actual localization for that language (English in your example), the Finder AFAIK uses the “unlocalized” bundle file name as the “base” file name. (Because it’s a bundle, it’s actually a directory name, but the principle is the same.)

If you the developer are on an English system, you can change the “base” file name any time you want, after the app bundle is created, by renaming it in the Finder. I do this all the time for my apps, and the final “base” name is nowhere in my Xcode project settings. Again AFAIK, this has *no* downstream consequences for localized non-English systems — as you’ve seen, the original name is irrelevant when the Finder actually applies localization to the name.

If you want to create the app with the desired English name during archiving, rather than renaming it later, then you must change build settings. AFAIK the one that controls the bundle’s file name is “Product Name”. The default value of this setting is “$(TARGET_NAME)”. If you don’t want the target name, you can put anything you want in there, minus the extension.

So, I assume that if you put the desired English name of your app in the Product Name setting, you’ll get the results you want in all localizations.
Here the result of my investigations so far:

1. The file-system-name (shown by ls command) = PRODUCT_NAME.
The PRODUCT_NAME is initially set to $(TARGET_NAME).
Changing the Target Name to: “New name” changes the Build settings to: PRODUCT_NAME = “New name”.

2. The app-menu and the About Panel show “Bundle name".

3. The Finder shows “Bundle display name" but only if:
3a. Info.plist contains Bundle display name = $(PRODUCT_NAME)
3b. <current language>.lproj exists, contains InfoPlist.strings and this has CFBundleDisplayName
The Finder does NOT fall back to Base.lproj for current language = development region (as everybody else does).

I fixed my problem by creating a copy of Bundle.lproj/InfoPlist.strings, putting it into an en.lproj folder and adding this in Xcode to the resources of my app.

Sure I could also (as you mentioned) change the PRODUCT_NAME (which has the additional advantage of file-system-name = Finder-name).
But I don’t like the asymmetry of it:
Change the Finder name for development region: change PRODUCT_NAME in Build Settings
Change the Finder name for any other language: change CFBundleDisplayName in xx.lproj/InfoPlist.strings

On the other hand, if the Finder name is the same for all languages, then using the PRODUCT_NAME is clearly better.

Thanks for your help!

One more thing:
Main.strings contains:
/* Class = "NSMenuItem"; title = "AppName"; ObjectID = "1Xt-HY-uBw"; */
"1Xt-HY-uBw.title" = "AppName";

/* Class = "NSMenuItem"; title = "Quit AppName"; ObjectID = "4sb-4s-VLi"; */
“4sb-4s-VLi.title” = “Quit AppName";

I tried to change this to:
"1Xt-HY-uBw.title" = "$(PRODUCT_NAME)";
“4sb-4s-VLi.title” = "Quit $(PRODUCT_NAME)";

But of course the last line does not work.
Could this work?
There are quite a few place where the AppName is hardcoded: About, Quit, Help (maybe more).


Kind regards,

Gerriet.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.