1

In my source code I have some lines like NSLocalizedStringFromTable(@"Info", @"en", @"Title of this view"). When I subsequently call genstrings -o en.lproj ./Classes/*.m I would not get the expected file en.strings but Localized.strings, although I've read in the genstrings-manpage that it would generate a table.strings file from NSLocalizedStringFromTable(a, table, c) function. Am I wrong? How would I create a table.strings file then?

juan tendero
  • 11
  • 1
  • 3
  • I am not satisfied with NSLocalizedString behaviour, so I had my own macros loading from other table strings, and a genstrings in python! http://samwize.com/2012/11/06/my-custom-localization-and-genstrings/ – samwize Nov 06 '12 at 14:04

1 Answers1

7

Juan,

Make sure you're NOT using a #define or constant for the table name. Remember, genstrings doesn't look at the compiled code, it just parses the source file. Also, all of the NSLocalizedStrings methods are actually just macros defined in NSBundle.h:

#define NSLocalizedStringFromTable(key, tbl, comment) \
        [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:(tbl)]

Make sure you aren't doing something like:

#define ENSTRINGS @"en"
...
NSString *info = NSLocalizedStringFromTable( @"Info", ENSTRINGS, @"Title of this view" );

Instead, you must specify the table name:

NSString *info = NSLocalizedStringFromTable( @"Info", @"en", @"Title of this view" );
Terry Blanchard
  • 449
  • 6
  • 7