33

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?

Wayne Hartman
  • 18,369
  • 7
  • 84
  • 116

2 Answers2

55

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";
Wayne Hartman
  • 18,369
  • 7
  • 84
  • 116
  • This no longer works on Xcode 8 beta 6 ... Any one else figured out what the alternative is? – shrutim Aug 29 '16 at 20:00
  • @shrutim I am unable to reproduce your issue on Xcode 8 beta 6. Are you sure that you have everything setup correctly? You might consider asking a new question. – Wayne Hartman Aug 30 '16 at 02:29
  • Yes .. it was my bad. Our team did localization and split the files but didnt copy this over. It does work on Xcode 8 beta 6 – shrutim Aug 30 '16 at 18:03
  • Create a new infoPlist.strings file is necessary. I added the localization string another string file :( – TK189 Jun 15 '17 at 06:56
  • Yoiu don't need to write ADD_ITEM_SHORTCUT_TITLE as this also seems to work: "Add Item" = "Add Item"; – Kashif Hisam Jan 17 '18 at 07:15
21

Add one new string file and save it with name "InfoPlist.strings" enter image description here

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

enter image description here

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

enter image description here

Dipen Chudasama
  • 3,063
  • 21
  • 42