I am creating a macOS app compiled for 10.12. My computer is in english, my region is Portugal.
The app is created in 3 languages: english (the development one, default), portuguese brazil and portuguese portugal.
I want to localize the app name.
I have created a InfoPlist.strings
file with the following keys for english:
"CFBundleDisplayName" = "My App";
"CFBundleName" = "My App";
"CFBundleExecutable" = "My App";
and for portuguese br and pt
"CFBundleDisplayName" = "Minha App";
"CFBundleName" = "Minha App";
"CFBundleExecutable" = "Minha App";
I have added these keys to the Info.plist
CFBundleDisplayName = $(PRODUCT_NAME)
CFBundleExecutable = $(PRODUCT_NAME)
CFBundleName = $(PRODUCT_NAME)
CFBundleIdentifier = $(PRODUCT_BUNDLE_IDENTIFIER)
LSHasLocalizedDisplayName = YES
inside Building Settings I have
Product Name = My App
I go to Product > Scheme > Edit Scheme > Run > Options and I set Application Language
to english and run the app.
Xcode generates an app with the name My App.app
that is correct and expected.
I return to the options and set the language to Portuguese and Xcode continues to generate an app called My App.app
instead of Minha App.app
.
How do I force Xcode to localize the app name shown in Finder.
That's not how localization works on macOS. You don't build a Portuguese-specific version of the app. The one app supports localization for any of its supported languages.
Under the hood, in the file system, your app bundle's directory will always be named "My App.app", never "Minha App.app". Localization occurs only at the point of display in the GUI.
You do not need to rebuild your app.
So, your issue is not with Xcode, it's with the Finder and the system. To see the other localizations in the Finder, you need to switch your account's language setting to use (one of the) Portuguese languages. I don't recall if the Finder switches live or if you need to relaunch it (hold down the Option/Alt key, right-click on its Dock icon, and click Relaunch; alternatively, log out and back in).