I'm working on the localization of my app and am intersted if it is a good idea to "centralize" all localizable strings in my app to be provided from some static method: [AppStrings stringWithType:type].
On one hand, it seems like a centralized method would make editing the localizable strings easier in the future, but on the other hand, the string itself is no longer readable, and I will have to define a lot of enumerated types.
What is the proper way to do localization of strings in a large project (100+ strings to be localized)? Do I embed NSLocalizedString() in code, or should I try to somehow centralize providing these strings?
typedef enum : NSUInteger {
ksCheckingCredentials,
ksError
} kStringType;
+(NSString*)stringWithType:(int)type
{
switch (type) {
case ksCheckingCredentials:
return NSLocalizedString(@"Checking Credentials",
@"Inform the user that credentials check is being performed");
break;
case ksError:
return NSLocalizedString(@"Error",
@"Generic error message to display to the user");
break;
default:
break;
}
}
-- OR-- Do I just use the code below at a 100 different places in my app?
self.errorLabel.text = NSLocalizedString(@"Error",@"Generic error message to display to the user");