5

当用户的鼠标悬停在 Dock 中的应用程序图标上时,应用程序的名称会出现在应用程序图标上。

根据我刚刚执行的测试,它显示的名称对应于项目目标中定义的“产品名称”(在“构建设置”菜单中)。

问题是:当用户将鼠标放在我的应用程序图标上时,如何本地化这个目标产品名称以便让我的应用程序名称使用正确的语言?

或者是否有任何其他方法可以本地化当用户将鼠标放在我的应用程序图标上时出现的应用程序名称?

谢谢 !

4

2 回答 2

7

这么多年后,这个问题仍然困扰着我(可能还有成千上万的其他程序员)一个多小时。

鉴于 Daij-Djan 上面接受的答案中的链接已经失效(更新的链接现在位于https://kb.applingua.com/2015/10/how-to-localize-app-names/),我'我用我添加的案例写了另一个答案。

确保您已完成以下操作:

  1. Info.plist 没有为您的目标打勾
  2. Info.plist 将“应用程序具有本地化显示名称”设置为 YES
  3. Info.plist 具有“捆绑名称”(CFBundleName),其值为“$(PRODUCT_NAME)”(不要问我为什么。如果我将其设置为其他值,它将不起作用。)
  4. Info.plist has no entry of "Bundle display name" (CFBundleDisplayName)
  5. InfoPlist.strings is ticked for your target
  6. InfoPlist.strings is ticked for all languages (in my case, Base and English only.) at least the Base language.
  7. InfoPlist.strings has both "CFBundleDisplayName" and "CFBundleName" entries

The above worked for me. I was primarily missing the "$(PRODUCT_NAME)" value part for the past hour.

If that still doesn't work, you should try creating a brand new XCode project and try to name the app into something else by following the above guides. Then, compare the Info.plist and your real project's Info.plist and see what's the difference. That's exactly how I find out about the "$(PRODUCT_NAME)" requirement.

于 2016-08-19T10:53:19.027 回答
6

有一个 info InfoPlist.strings 文件,其中您已本地化CFBundleDisplayName,您还可以本地化 NSHumanReadableCopyrigh 等。

确实需要严格遵循本文中提到的步骤:http: //kb.applingua.com/2011/10/how-to-localize-app-names/

于 2012-12-29T18:03:34.113 回答