您如何本地化静态UIApplicationShortcutItems? [英] How do you localize static UIApplicationShortcutItems?

查看:237
本文介绍了您如何本地化静态UIApplicationShortcutItems?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,我想添加静态和动态应用程序快捷方式项的组合.使用NSLocalizedString可以对动态项目进行本地化非常简单,但对于info.plist中的项目则没有那么多.我已经有一个InfoPlist.strings文件用于本地化应用程序的名称,但是由于这些项没有唯一键,因此我不太确定静态UIApplicationShortcutItems是如何工作的.

I have an application and I want to add a mix of static and dynamic app shortcut items. Localizing for dynamic items is pretty straightforward, using NSLocalizedString, but not so much with the items in your info.plist. I already have an InfoPlist.strings file for localizing the name of my application, but I am less sure about how static UIApplicationShortcutItems would work since these items do not have a unique key.

如何本地化静态UIApplicationShortcutItem?

推荐答案

事实证明,该应用程序将在InfoPlist.strings文件中搜索与Info.plist中的值匹配的对应键.这听起来可能有些混乱,所以这里有个例子:

Turns out that the app will search the InfoPlist.strings file for a corresponding key matching the value in the Info.plist. That might sound a little confusing, so here's an example:

对于info.plist中的UIApplicationShortcutItemTitle键,添加一个值,例如ADD_ITEM_SHORTCUT_TITLE:

For the UIApplicationShortcutItemTitle key in the info.plist, add a value of, say, ADD_ITEM_SHORTCUT_TITLE:

<key>UIApplicationShortcutItemTitle</key>
<string>ADD_ITEM_SHORTCUT_TITLE</string>

此值将在InfoPlist.strings文件中需要一个相应的条目:

This value will then need a corresponding entry in your InfoPlist.strings file:

ADD_ITEM_SHORTCUT_TITLE = "Add Item";

这篇关于您如何本地化静态UIApplicationShortcutItems?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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