Search code examples
ioslocalizationnsarray

Localize an NSArray


I've been localizating my app with this method:

.m file

... initWithTitle:NSLocalizedString(@"CONFIRMACAO_TEL", @"Message")

Localizable.strings file

"CONFIRMACAO_TEL" = "Do you want to call?";

The last data that I've to localize are two NSArray's and, despite all the searching, I still can't figure it out how to do it.

Here's my array:

descricaoServicos = [[NSArray alloc] initWithObjects:@"test 1, test 2", @"test 3", @"test 4", nil];

Solution

  • You can localize like this:

    descricaoServicos = [[NSArray alloc] initWithObjects:NSLocalizedString(@"test 1, test 2",@"test 1, test 2"), NSLocalizedString(@"test 3", @""), NSLocalizedString(@"test 4", @""), nil];