OSX - 服务不显示本地化的菜单标题字符串 [英] OSX - Service does not show the localized Menu Title string

查看:196
本文介绍了OSX - 服务不显示本地化的菜单标题字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Cocoa应用程序。这将挂接到OSX服务菜单。我为 en.lproj zh-Hans.lproj 创建了三个 ServicesMenu.strings / code>和 hi-IN.lproj 用于本地化服务菜单标题。



Info.plist(相关部分)



 < key> NSServices< / key> 
< array>
< dict>
< key> NSKeyEquivalent< / key>
< key> NSMenuItem< / key>
< dict>
< key>默认< / 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=这里;

在服务菜单上,我可以看到选项 CreateHere 而不是创建文件



更新



如果这有帮助。以下是 / 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;
}

与其他服务c> NSMenuItem 没有任何条目 English 这与我有什么关系, code> English.lproj ,而我有 en.lproj

解决方案

在向我的应用程序添加服务时遇到了同样的问题。




$ b

通过运行这些命令修复了这个问题:

  / System / Library / CoreServices / pbs  - flush 

/ System / Library / CoreServices / pbs -update



.lproj




这与我有什么关系,我没有任何
English.lproj, .lproj?


English.lproj已过时,请改用en.lproj。从Apple文档:


对于语言标识,您可以使用ISO 639-1或ISO 639-2惯例。 ISO 639-1规范使用两个字母的代码来识别语言,并且是识别语言的首选方式。


查看



https://developer.apple.com/library/mac/documentation/MacOSX/ Conceptual / BPInternational / Articles / LanguageDesignations.html#// apple_ref / doc / uid / 20002144-SW1


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:

/System/Library/CoreServices/pbs -flush

/System/Library/CoreServices/pbs -update

According English.lproj

Does this have anything to do with, that I do not have any English.lproj, instead I have en.lproj?

English.lproj is obsolete, use en.lproj instead. From Apple docs:

For language designations, you can use either the ISO 639-1 or ISO 639-2 conventions. The ISO 639-1 specification uses a two-letter code to identify a language and is the preferred way to identify languages.

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

这篇关于OSX - 服务不显示本地化的菜单标题字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆