Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UILocalizedIndexedCollation only returns an English collation

I'm trying to get a localized index like Contacts by using UILocalizedIndexedCollation. In Contacts when I change the language the index changes to match the language. However sectionIndexTitles always returns an english index.

I have tried this with a demo app I created and with 3_SimpleIndexedTableView, which is a demo app from Apple and neither app have a localized index.

I have tried creating a localization folder for the current locale (I used [[NSLocale autoupdatingCurrentLocale] localeIdentifier] to determine the current locale). This does not affect the index.

I've had a look for relevant plist settings by found nothing.

Am I missing something or does UILocalizedIndexedCollation only return an English collation?

like image 911
Benedict Cohen Avatar asked Jan 24 '26 22:01

Benedict Cohen


2 Answers

You can also set Localized resources can be mixed = YES in Info.plist. If the key is missing right click and choose Add Row.

like image 156
emreberge Avatar answered Jan 26 '26 14:01

emreberge


Solved!

I didn't have a localization folder in my app bundle for the target language. I added sv.lproj (Swedish) and the collation worked as expected. The folder is empty, it's presence is all that's required for it to work.

like image 37
Benedict Cohen Avatar answered Jan 26 '26 13:01

Benedict Cohen