ioslocalization3dtouch

How do I localize static UIApplicationShortcutItems?


With the iPhone 6s, Apple has introduced a new feature called "3D Touch". App developers are able to use this technology by using it within their apps or provide so-called UIApplicationShortcutItems on the home screen which appear when you 3D Touch the corresponding app icon. I've seen quite a few people out there who wanted to know how you would be able to localize those. Here's how.


Solution

  • What you have to do is, if you haven't already, create a new strings file called InfoPlist.strings, then you localize this strings file to the languages you wish via the File Inspector on the right.

    Now, you write down a key (for example: ADD_ITEM_SHORTCUT_TITLE or ADD_ITEM_SHORTCUT_DESCRIPTION) and the correct translation for each localized file. For example:

    English file:

    ADD_ITEM_SHORTCUT_TITLE = "Add";
    ADD_ITEM_SHORTCUT_DESCRIPTION = "a new item";
    

    German file:

    ADD_ITEM_SHORTCUT_TITLE = "Füge hinzu";
    ADD_ITEM_SHORTCUT_DESCRIPTION = "ein neues Item";
    

    Then, go to your Info.plist and enter your key to the corresponding field. For example:

    how your info.plist could look like here

    That way, you get localized UIApplicationShortcutItems. Now, they look like this:

    Phone language English:

    enter image description here

    Phone language German:

    enter image description here