I would like to localize my constants. Constants are defined and declared the usual way:
extern NSString * const kStringName;
NSString * const kStringName = @\"
I've created a PHP script that takes a correctly formatted Localizable.strings file as input and produced a Localizable.h file as output containing appropriate #define-commands for each String-Key. You can modify it as you see fit.
The script expects all string keys to be formatted with sub-words split by uppercase letters, so a line should look like this in your Localizable.strings file:
"SectionSomeString" = "This is my string.";
which would then be converted to
#define SECTION_SOME_STRING NSLocalizedString(@"SectionSomeString", nil)
The PHP script looks as follows: