0

I tried to use ABUnknownPersonViewController in my app, but it's only in english. I think it would be better if AddressBookUI shows it automatically in system language. Is there any way to show it in other languages or I need to make my own controller?

update: code

    ABRecordRef aContact = ABPersonCreate();

    ABMutableMultiValueRef phoneNumbers = ABMultiValueCreateMutable(kABMultiStringPropertyType);

    ABMultiValueAddValueAndLabel(phoneNumbers, (__bridge CFStringRef)labelNumber.text, kABPersonPhoneMainLabel, NULL);


    ABRecordSetValue(aContact, kABPersonPhoneProperty, phoneNumbers, nil);

    ABUnknownPersonViewController *picker = [[ABUnknownPersonViewController alloc] init];
    picker.unknownPersonViewDelegate = nil;
    picker.displayedPerson = aContact;
    picker.allowsAddingToAddressBook = YES;
    picker.allowsActions = YES;

    [self.navigationController pushViewController:picker animated:YES];

    [picker release];

    CFRelease(phoneNumbers);
    CFRelease(aContact);

Edit: I just forgot to add language in project localizations

aterite
  • 135
  • 7

1 Answers1

0

it is shown in the language that is supported by the app based on the user's preferred system language.

to localise the view apple uses NSLocalizedString and that uses:

    NSArray* preferredLanguages = [NSLocale preferredLanguages];
    NSString* languageCode = preferredLanguages[0];

You can change it before using NSLocalizedString the first time but It can't be changed on the fly. Note that it would change the language for ALL NSLocalizedString calls

Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
  • but I checked it both in simulator and device: set some other language in system settings, but ABUnknownPersonViewController still appears in english – aterite Jul 16 '14 at 18:43
  • ok, got it, I've added localization to the project and it worked – aterite Jul 17 '14 at 08:31