diff options
author | rowanbeentje <rowan@beent.je> | 2011-09-09 00:45:34 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2011-09-09 00:45:34 +0000 |
commit | 752b2b576a307130d5f698beed67ccae5c96b166 (patch) | |
tree | 99604920cc66a503bc53d9af95d96cca09e74374 | |
parent | 0c9edd6ea1939335a86d0b8d9505b6e1a7b0a2b9 (diff) | |
download | sequelpro-752b2b576a307130d5f698beed67ccae5c96b166.tar.gz sequelpro-752b2b576a307130d5f698beed67ccae5c96b166.tar.bz2 sequelpro-752b2b576a307130d5f698beed67ccae5c96b166.zip |
- Make add relation error detail intro localisable
- If the add relation error strongly appears to be a name-already-taken error, add the name to the takenNames list to prevent it being used again and to highlight the error
- Update localisable strings
-rw-r--r-- | Resources/English.lproj/DBView.strings | bin | 101876 -> 102126 bytes | |||
-rw-r--r-- | Resources/English.lproj/Localizable.strings | bin | 223106 -> 223274 bytes | |||
-rw-r--r-- | Source/SPTableRelations.m | 8 |
3 files changed, 7 insertions, 1 deletions
diff --git a/Resources/English.lproj/DBView.strings b/Resources/English.lproj/DBView.strings Binary files differindex d301baa6..be01c95e 100644 --- a/Resources/English.lproj/DBView.strings +++ b/Resources/English.lproj/DBView.strings diff --git a/Resources/English.lproj/Localizable.strings b/Resources/English.lproj/Localizable.strings Binary files differindex 4e7a8c1a..99977ed2 100644 --- a/Resources/English.lproj/Localizable.strings +++ b/Resources/English.lproj/Localizable.strings diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m index f6865d15..5a81e756 100644 --- a/Source/SPTableRelations.m +++ b/Source/SPTableRelations.m @@ -185,7 +185,13 @@ static NSString *SPRelationOnDeleteKey = @"on_delete"; NSString *statusText = [connection getFirstFieldFromQuery:@"SHOW INNODB STATUS"]; NSString *detailErrorString = [statusText stringByMatching:@"latest foreign key error\\s+-----*\\s+[0-9: ]*(.*?)\\s+-----" options:(RKLCaseless | RKLDotAll) inRange:NSMakeRange(0, [statusText length]) capture:1L error:NULL]; if (detailErrorString) { - errorText = [NSString stringWithFormat:@"%@\n\nMySQL detail: %@", errorText, [detailErrorString stringByReplacingOccurrencesOfString:@"\n" withString:@" "]]; + errorText = [NSString stringWithFormat:NSLocalizedString(@"%@\n\nDetail: %@", @"Add relation error detail intro"), errorText, [detailErrorString stringByReplacingOccurrencesOfString:@"\n" withString:@" "]]; + } + + // Detect name duplication if appropriate + if ([errorText isMatchedByRegex:@"errno: 121"] && [errorText isMatchedByRegex:@"already exists"]) { + [takenConstraintNames addObject:[[constraintName stringValue] lowercaseString]]; + [self controlTextDidChange:[NSNotification notificationWithName:@"dummy" object:constraintName]]; } } |