How to localize auto capitalization type of UITextField in iOS?

In my iOS app, I show a UITextField that is allowing the users to enter a book title.


However, users from the US would expect UITextAutocapitalizationTypeWords (as each word should be capitalized) while users from Spain would expect UITextAutocapitalizationTypeSentences (as only the first word in a sentence should be capitalized).


Any suggestions how to target this?

There’s no affordance for doing that within the iOS APIs. If you want this feature you’d have to implement the core of it yourself. That is:

  1. maintain a mapping from language to auto-capitalisation mappings

  2. look up the language in the mapping and apply the setting when you load the view

Taking a step back, your example assumes that a Spanish user is mostly entering Spanish book titles, which is reasonable enough but perhaps you could come up with a different approach that works in more cases. For example, after the user has finished entering the title you could look it up in an online book database and fix the capitalisation based on the results. That would automatically work for all combination of languages. You could even extend this to form an autocompletion mechanism.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

WWDC runs Mon, 13 Jun through to Fri, 17 Jun. During that time all of DTS will be at the conference, helping folks out face-to-face. http://developer.apple.com/wwdc/

How to localize auto capitalization type of UITextField in iOS?
 
 
Q