How do I localize static UIApplicationShortcutItems?
Asked Answered
E

2

9

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.

Epizoon answered 26/9, 2015 at 15:6 Comment(0)
E
25

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

Epizoon answered 26/9, 2015 at 15:6 Comment(0)
C
0

Based on Sam0711er answer link

If you have a lot of UIApplicationShortcutItems, then just write down the necessary unique names at the end, for example (in InfoPlist.strings):

ADD_ITEM_SHORTCUT_TITLE_SHARE = "Share app";
ADD_ITEM_SHORTCUT_TITLE_SOMETHING = "Something wrong?";

And in Info.plist:

enter image description here

Conditioning answered 19/12, 2023 at 11:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.