Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to localize iOS 8 today extensions widget and also the widget name

I can't understand how I can localize today extensions, I want to create the Localize.strings file like a normal xcode project that for example have this string:

.en
    "Apple" = "Apple"

.it
    "Apple" = "Mela"

and I also want to know how I can localize the iOS 8 Today Extensions widget name.

I have tried to create a Strings File in Xcode, and I have tried to insert this:

"CFBundleDisplayName" = "App Name";

but the name doesn't change...

like image 817
Piero Avatar asked Sep 28 '14 23:09

Piero


People also ask

How do I code widgets in IOS?

Open your app project in Xcode and choose File > New > Target. From the Application Extension group, select Widget Extension, and then click Next. Enter the name of your extension. If the widget provides user-configurable properties, check the Include Configuration Intent checkbox.

How do I Localise my IOS app?

Go to the File menu and choose New > File, then select Strings File from the list of file types and click Next. Give this file the name “Localizable. strings”, then click Create to open it for editing.


2 Answers

Add LSHasLocalizedDisplayName = YES to Info.plist file and add your localizations to InfoPlist.strings which you have to place under the language.proj folder per languages, for example de.lproj for German versions.

Before testing: - Clean the project - Remove the application from the simulator. - Add language.proj folder references to extension's Supporting files part - to include them inside Copy bundle resources section in Build Phases of your extension target.

like image 163
frankish Avatar answered Sep 28 '22 14:09

frankish


For strings in your containing app and Today Widget can share the same localization files. You can simply select Localizable.string, and in the File inspector check your today widget target in Target Membership. Then all your NSLocalizedString in the today widget share the same one with the containing localization strings.

For the today widget application name, then just add an InfoPlist.strings file, and

"CFBundleDisplayName" = "Translated Name";
"CFBundleName" = "Translated Name";

Just run your containing app for testing.

like image 44
William Hu Avatar answered Sep 28 '22 15:09

William Hu