I have a Cocoa application. This hooks up into OSX Service Menu. I have created three ServicesMenu.strings
for en.lproj
, zh-Hans.lproj
and hi-IN.lproj
for localizing the Service Menu Title. The problem is OSX does seem to be using the localized text at all.
Info.plist (relevant portion)
<key>NSServices</key>
<array>
<dict>
<key>NSKeyEquivalent</key>
<key>NSMenuItem</key>
<dict>
<key>default</key>
<string>CreateHere</string>
</dict>
<key>NSMessage</key>
<string>createHere</string>
<key>NSPortName</key>
<string>CreateHereFilesService</string>
<key>NSRequiredContext</key>
<dict>
<key>NSApplicationIdentifier</key>
<string>com.apple.finder</string>
</dict>
<key>NSSendFileTypes</key>
<array>
<string>public.folder</string>
</array>
<key>NSUserData</key>
<string>create</string>
</dict>
</array>
ServicesMenu.strings (en.lproj)
/*
ServicesMenu.strings
*/
/* default */
"CreateHere" = "Create File Here";
On the Services Menu I can see the option CreateHere
instead of Create File Here
.
Update
If this helps. Here is the output of /System/Library/CoreServices/pbs -dump_pboard
{
CFPrincipalLocalizations = (
English
);
CFVendedServices = (
{
NSBundleIdentifier = "com.applegrew.apple.service.CreateHereFiles";
NSBundlePath = "/Users/applegrew/Library/Services/CreateHereFiles.app";
NSMenuItem = {
default = CreateHere;
};
NSMessage = createHere;
NSPortName = CreateHereFilesService;
NSRequiredContext = {
NSApplicationIdentifier = "com.apple.finder";
};
NSSendFileTypes = (
"public.folder"
);
NSUUID = <199fd7c0 cdd146fb 9a564a93 231b23f9>;
NSUserData = create;
}
);
CFVersion = 2;
}
Unlike for other services (not shown above) NSMenuItem
does does not have any entry English
. Does this have anything to do with, that I do not have any English.lproj
, instead I have en.lproj
?
Faced the same problem today while adding service to my application.
Everything works except the localizations.
Fixed the issue by running these commands:
According English.lproj
English.lproj is obsolete, use en.lproj instead. From Apple docs:
Look at Internationalization Programming Topics (Language and Locale Designations → Language Designations) for more info.
https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPInternational/Articles/LanguageDesignations.html#//apple_ref/doc/uid/20002144-SW1