fix multiple lines replacement

This commit is contained in:
Zitao Xiong
2013-05-12 22:24:58 -05:00
parent c0b6363272
commit e85fe309c7

View File

@@ -78,9 +78,9 @@ static NSString *stringRegexs = @"@\"[^\"]*\"";
continue;
}
NSString *string = [line substringWithRange:matchedRangeInLine];
// NSLog(@"string index:%d, %@", i, string);
NSString *outputString = [NSString stringWithFormat:@"NSLocalizedString(%@, %@)", string, string];
addedLength = outputString.length - string.length;
addedLength = addedLength + outputString.length - string.length;
if ([textView shouldChangeTextInRange:matchedRangeInDocument replacementString:outputString]) {
[textView.textStorage replaceCharactersInRange:matchedRangeInDocument
withAttributedString:[[[NSAttributedString alloc] initWithString:outputString] autorelease]];