How do you localize static UIApplicationShortcutItems?

前端 未结 2 1412
悲哀的现实
悲哀的现实 2021-02-02 08:10

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

2条回答
  •  独厮守ぢ
    2021-02-02 08:24

    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:

    UIApplicationShortcutItemTitle
    ADD_ITEM_SHORTCUT_TITLE
    

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

    ADD_ITEM_SHORTCUT_TITLE = "Add Item";
    

提交回复
热议问题