I wanted to ask a short question.
Is this possible or do I have to change anything?:
[self.category addObject:NSLocalizedString(@"Accessories", nil)];
This is an object in an tableView that should use the content from a .strings file
I wanted to ask a short question.
Is this possible or do I have to change anything?:
[self.category addObject:NSLocalizedString(@"Accessories", nil)];
This is an object in an tableView that should use the content from a .strings file
the code works ;)
#import <Foundation/Foundation.h>
int main(int argc, char *argv[]) {
@autoreleasepool {
id category = [NSMutableArray array];
[category addObject:NSLocalizedString(@"Accessories", nil)];
NSLog(@"%@", category);
}
}
self.category isn't nil you said and so it must be the strings file:
maybe the file isn't in the target/corrupt or the string isn't there
Of course.. probably the error is somewhere else. NSLocalizedString
is just a macro that at compile time is replace by [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil]
. As you ca see is a simple method that returns a string for a key at runtime.
There is nothing wrong in your code. Check in your localization file for a key that matches perfectly the one you provide.