Translating NSLocationAlwaysUsageDescription

iOS 8 introduces 2 new Info.plist keys to explain the user why you (even in background) need access to his location. From iOS 4 through 7, this was done in run-time using the Ti.Geolocation.purpose property.

Multilingual apps

Now this has moved to the static Info.plist – which in Titanium you’d normally set in the tiapp.xml‘s ios > plist section – you might wonder how to set a specific text for each language your multilingual app supports. I’ll show you how.

Translating the properties

If you take a look at the Internationalizing your app’s name section of the Internationalization guide, you’ll learn about files called app.xml, similar to the more familiar strings.xml ones. The only difference is that for iOS the second compiles to Localizable.strings and the other to InfoPlist.strings. And that’s exactly how you localise Info.plist values on iOS.

So to localise my app’s name and NSLocationAlwaysUsageDescription for Dutch, I’d create the following file:


    <string name="appname">Mijn app</string>
    <string name="NSLocationAlwaysUsageDescription">Klik gewoon OK!</string>

Code strong!

App imagineer: Imagining, Engineering & Speaking about Native mobile Apps with Appcelerator Titanium & Alloy • Meetup organizer • Certified Expert • Titan