I'm using Apples Photos Framework to load PHAssetCollections into my app. I Always get the english name of the smart collections. For instance I get 'Favorites' instead of 'Favoriter' (Swedish). I thought the localizedTitle property would return the language the Simulator or the iPhone ran. (Running on a iPhone with Swedish language and region).
Has anyone else encountered this? Example code:
NSArray *collectionsFetchResults;
NSMutableArray *localizedTitles = [[NSMutableArray alloc] init];
PHFetchResult *smartAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeSmartAlbum
subtype:PHAssetCollectionSubtypeAlbumRegular options:nil];
PHFetchResult *syncedAlbums = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum
subtype:PHAssetCollectionSubtypeAlbumSyncedAlbum options:nil];
PHFetchResult *userCollections = [PHCollectionList fetchTopLevelUserCollectionsWithOptions:nil];
// Add each PHFetchResult to the array
collectionsFetchResults = @[smartAlbums, userCollections, syncedAlbums];
for (int i = 0; i < collectionsFetchResults.count; i ++) {
PHFetchResult *fetchResult = collectionsFetchResults[i];
for (int x = 0; x < fetchResult.count; x ++) {
PHCollection *collection = fetchResult[x];
localizedTitles[x] = collection.localizedTitle;
NSLog(@"%@", collection.localizedTitle); //<= Always prints english names
}
}
The reason for why collection.localizedTitle
doesn't return any other language because your app has only one Localization that is English
. This is definitely an Apple Bug, but here is a hack follow these steps.
sv.lproj
apart from en.lproj
folder that you already have.Update
If you want to add more languages easily after adding the blank text, you can add like showed in other answer by selecting Project, and in Localization section add language and choose blank file again, as we don't want to localize other files.
Hope it helps, if doubt ask here.
Cheers.
I think you should just make sure you app support Swedish. Add the language you want to support Swedish for example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With