문제

I have setup an OSX service based on an Automator workflow that contains (among others) an Obj-C action.
I have successfully localized the Obj-C action, but I am not able to localize the service menu entry.
The Services implementation guide says one has to create a ServicesMenu.strings file for every localization. Other docs, e.g. this, say the same, and this SO entry suggests in an answer to apply some console commands to refresh a system file, but I am afraid to do so without understanding.
I have created the localized ServicesMenu.strings files in the Xcode project of the Obj-C action (because the Automator does not have an localization function), but these files are surely in the wrong bundle.
The problem is that I don't know where to place these files.
Any help is appreciated.

EDIT: One of the links cited above says:
Adding a Localized ServicesMenu.strings file
To localize this text, you will need to add a UTF-16 encoded strings file named ServicesMenu.strings to your application project or Automator workflow bundle resources (details on how to do this are below). This strings file will contain, for each service menu item you are providing, an entry that uses the default text as the key, and the translated text as the value. For each language you wish to support, you will provide a translated ServicesMenu.strings file in a language-specific project (.lproj) directory in your project resources.
...
If you are providing a service from an Automator created workflow, you will need to manually add the strings files and .lproj resource directories to the workflow bundle. You can find Automator created workflow bundles in your home directory under ~/Library/Services.

I have done exactly this, but the localization does not work.
Below I added my Info.plist content, the folder structure and the ServiceMenu.strings file contents.
Info.plist
Folder
ServiceMenu.strings file

도움이 되었습니까?

해결책

Here is my own solution. Maybe it helps somebody else.

The 1st problem was that I did not read the docs carefully enough. The text cited in my question continues:

Refreshing the Services menu
Once you have provided localized text for your service menu item title, you may need to refresh the Services menu list to see the changes. One way to refresh the list of services shown in the Services menu is by using the services debugging tool pbs. This is a command-line tool located in /System/Library/CoreServices that provides useful services debugging features, such as refreshing the list of services or printing out the current list of registered services. Listing 3 shows an example of a command-line you can enter into the Terminal application to refresh the list of services for English and French.
Listing 3  Example use of pbs to refresh services.
/System/Library/CoreServices/pbs -existing_languages en fr

The 2nd problem was that the command given in Listing 3 above did not work for me. However the command

/System/Library/CoreServices/pbs -update

actually updated the service menu and the localized menu entry was displayed.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top