Skip to content
This repository was archived by the owner on Apr 6, 2020. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion QBValidator/QBValidator.m
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,13 @@ - (NSString *)errorMessageForRule:(QBValidationRule *)rule name:(NSString *)name
}
key = [key stringByAppendingString:@"Satisfied"];

NSString *errorMessage = NSLocalizedStringFromTable(key, [rule localizationTableName], nil);
// First check bundleForClass:
// This will ensure that we work if packaged in a framework
NSString *errorMessage = NSLocalizedStringFromTableInBundle(key, [rule localizationTableName], [NSBundle bundleForClass:[self class]], nil);
if ([errorMessage isEqualToString:key]) {
// Fall back to main bundle
errorMessage = NSLocalizedStringFromTableInBundle(key, [rule localizationTableName], [NSBundle mainBundle], nil);
}

// Replace patterns
errorMessage = [errorMessage stringByReplacingOccurrencesOfString:@"{name}"
Expand Down