How do you localize static UIApplicationShortcutItems?

烈酒焚心 提交于 2019-12-03 08:16:38

问题


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.

How do you localize static UIApplicationShortcutItems?


回答1:


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:

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>

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

ADD_ITEM_SHORTCUT_TITLE = "Add Item";



回答2:


Add one new string file and save it with name "InfoPlist.strings"

Enable Localization for this file, and add string with title like below explanation.

Now Open your info.plist file and add title like below.



来源:https://stackoverflow.com/questions/32773149/how-do-you-localize-static-uiapplicationshortcutitems

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!