From 0c303c40066f65fa0739f43b46aecca1172d2ddc Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Wed, 3 Mar 2010 14:29:53 +0000 Subject: Localise SPExtendedTableInfo.m and remove use of multiple comments for localised strings. --- Source/SPExtendedTableInfo.m | 49 ++++++++++++++++++++-------------------- Source/SPFieldMapperController.m | 4 ++-- Source/SPUserManager.m | 12 +++++----- 3 files changed, 33 insertions(+), 32 deletions(-) (limited to 'Source') diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m index e49fb43c..d13de4a7 100644 --- a/Source/SPExtendedTableInfo.m +++ b/Source/SPExtendedTableInfo.m @@ -124,9 +124,7 @@ NSString *newEncoding = [[sender titleOfSelectedItem] stringByMatching:@"^.+\\((.+)\\)$" capture:1L]; // Check if the user selected the same encoding - if ([currentEncoding isEqualToString:newEncoding]) { - return; - } + if ([currentEncoding isEqualToString:newEncoding]) return; // Alter table's character set encoding [connection queryString:[NSString stringWithFormat:@"ALTER TABLE %@ CHARACTER SET = %@", [selectedTable backtickQuotedString], newEncoding]]; @@ -153,9 +151,7 @@ NSString *currentCollation = [tableDataInstance statusValueForKey:@"Collation"]; // Check if the user selected the same collation - if ([currentCollation isEqualToString:newCollation]) { - return; - } + if ([currentCollation isEqualToString:newCollation]) return; // Alter table's character set collation [connection queryString:[NSString stringWithFormat:@"ALTER TABLE %@ COLLATE = %@", [selectedTable backtickQuotedString], newCollation]]; @@ -253,20 +249,20 @@ [tableCreateSyntaxTextView setEditable:NO]; } - [tableCreatedAt setStringValue:@"Created at: "]; - [tableUpdatedAt setStringValue:@"Updated at: "]; + [tableCreatedAt setStringValue:NSLocalizedString(@"Created at: ", @"table info created at label")]; + [tableUpdatedAt setStringValue:NSLocalizedString(@"Updated at: ", @"table info updated at label")]; // Set row values - [tableRowNumber setStringValue:@"Number of rows: "]; - [tableRowFormat setStringValue:@"Row format: "]; - [tableRowAvgLength setStringValue:@"Avg. row length: "]; + [tableRowNumber setStringValue:NSLocalizedString(@"Number of rows: ", @"table info number of rows label")]; + [tableRowFormat setStringValue:NSLocalizedString(@"Row format: ", @"table info row format label")]; + [tableRowAvgLength setStringValue:NSLocalizedString(@"Avg. row length: ", @"table info average row length label")]; [tableRowAutoIncrement setStringValue:@""]; // Set size values - [tableDataSize setStringValue:@"Data size: "]; - [tableMaxDataSize setStringValue:@"Max data size: "]; - [tableIndexSize setStringValue:@"Index size: "]; - [tableSizeFree setStringValue:@"Free data size: "]; + [tableDataSize setStringValue:NSLocalizedString(@"Data size: ", @"table info data size label")]; + [tableMaxDataSize setStringValue:NSLocalizedString(@"Max data size: ", @"table info max data size label")]; + [tableIndexSize setStringValue:NSLocalizedString(@"Index size: ", @"table info index size label")]; + [tableSizeFree setStringValue:NSLocalizedString(@"Free data size: ", @"table info free data size label")]; // Set comments [tableCommentsTextView setEditable:NO]; @@ -292,7 +288,7 @@ [tableTypePopUpButton setEnabled:enableInteraction]; } else { - [tableTypePopUpButton addItemWithTitle:@"Not available"]; + [tableTypePopUpButton addItemWithTitle:NSLocalizedString(@"Not available", @"not available label")]; } if (([encodings count] > 0) && ([tableDataInstance tableEncoding])) { @@ -314,7 +310,7 @@ [tableEncodingPopUpButton setEnabled:enableInteraction]; } else { - [tableEncodingPopUpButton addItemWithTitle:@"Not available"]; + [tableEncodingPopUpButton addItemWithTitle:NSLocalizedString(@"Not available", @"not available label")]; } if (([collations count] > 0) && ([statusFields objectForKey:@"Collation"])) { @@ -328,7 +324,7 @@ [tableCollationPopUpButton setEnabled:enableInteraction]; } else { - [tableCollationPopUpButton addItemWithTitle:@"Not available"]; + [tableCollationPopUpButton addItemWithTitle:NSLocalizedString(@"Not available", @"not available label")]; } [tableCreatedAt setStringValue:[self _formatValueWithKey:@"Create_time" inDictionary:statusFields withLabel:@"Created at"]]; @@ -364,9 +360,9 @@ [tableCreateSyntaxTextView setEditable:NO]; // Validate Reset AUTO_INCREMENT button - if([statusFields objectForKey:@"Auto_increment"] && ![[statusFields objectForKey:@"Auto_increment"] isKindOfClass:[NSNull class]]) + if ([statusFields objectForKey:@"Auto_increment"] && ![[statusFields objectForKey:@"Auto_increment"] isKindOfClass:[NSNull class]]) { [resetAutoIncrementResetButton setHidden:NO]; - + } } /** @@ -507,7 +503,9 @@ else if ([key isEqualToString:@"Rows"] || [key isEqualToString:@"Avg_row_length"] || [key isEqualToString:@"Auto_increment"]) { + NSNumberFormatter *numberFormatter = [[[NSNumberFormatter alloc] init] autorelease]; + [numberFormatter setNumberStyle:NSNumberFormatterDecimalStyle]; value = [numberFormatter stringFromNumber:[NSNumber numberWithLongLong:[value longLongValue]]]; @@ -518,10 +516,13 @@ } } } - if([key isEqualToString:@"Auto_increment"]) - return ([value length] > 0) ? value : @"Not available"; - else - return [NSString stringWithFormat:@"%@: %@", label, ([value length] > 0) ? value : @"Not available"]; + + if ([key isEqualToString:@"Auto_increment"]) { + return ([value length] > 0) ? value : NSLocalizedString(@"Not available", @"not available label"); + } + else { + return [NSString stringWithFormat:@"%@: %@", label, ([value length] > 0) ? value : NSLocalizedString(@"Not available", @"not available label")]; + } } @end diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index a4e75efc..514d031a 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -731,7 +731,7 @@ if([aCell objectValue] == doImport) return NSLocalizedString(@"Import field", @"import field operator tooltip"); else if([aCell objectValue] == doNotImport) - return NSLocalizedString(@"Ignore field", @"ignore field operator tooltip"); + return NSLocalizedString(@"Ignore field", @"ignore field label"); else if([aCell objectValue] == isEqual) return NSLocalizedString(@"Do UPDATE where field contents match", @"do update operator tooltip"); else @@ -778,7 +778,7 @@ [c removeAllItems]; [c addItemsWithTitles:fieldMappingButtonOptions]; [m addItem:[NSMenuItem separatorItem]]; - [c addItemWithTitle:NSLocalizedString(@"Ignore field", @"ignore field menu item")]; + [c addItemWithTitle:NSLocalizedString(@"Ignore field", @"ignore field label")]; [c addItemWithTitle:NSLocalizedString(@"Ignore all fields", @"ignore all fields menu item")]; [c addItemWithTitle:NSLocalizedString(@"Import all fields", @"import all fields menu item")]; [m addItem:[NSMenuItem separatorItem]]; diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m index cc4baae5..fe387422 100644 --- a/Source/SPUserManager.m +++ b/Source/SPUserManager.m @@ -497,7 +497,7 @@ if ([results count] > 1) { NSAlert *alert = [NSAlert alertWithMessageText:@"Duplicate User" - defaultButton:NSLocalizedString(@"OK", @"OK") + defaultButton:NSLocalizedString(@"OK", @"OK button") alternateButton:nil otherButton:nil informativeTextWithFormat:@"A user with that name already exists"]; @@ -514,7 +514,7 @@ if (![selectedObject isEqual:child] && [[child valueForKey:@"host"] isEqualToString:host]) { NSAlert *alert = [NSAlert alertWithMessageText:@"Duplicate Host" - defaultButton:NSLocalizedString(@"OK", @"OK") + defaultButton:NSLocalizedString(@"OK", @"OK button") alternateButton:nil otherButton:nil informativeTextWithFormat:@"A user with that host already exists"]; @@ -678,7 +678,7 @@ if ([[parent valueForKey:@"children"] count] == 0) { NSAlert *alert = [NSAlert alertWithMessageText:@"User doesn't have any hosts." - defaultButton:NSLocalizedString(@"OK", @"OK") + defaultButton:NSLocalizedString(@"OK", @"OK button") alternateButton:nil otherButton:nil informativeTextWithFormat:@"This user doesn't have any hosts associated with it. User will be deleted unless one is added"]; @@ -712,8 +712,8 @@ if ([self.managedObjectContext hasChanges]) { NSAlert *alert = [NSAlert alertWithMessageText:@"Warning!" - defaultButton:NSLocalizedString(@"Continue", @"Continue") - alternateButton:NSLocalizedString(@"Cancel",@"Cancel") + defaultButton:NSLocalizedString(@"Continue", @"continue button") + alternateButton:NSLocalizedString(@"Cancel", @"cancel button") otherButton:nil informativeTextWithFormat:@"Window has changes. All changes will be lost!"]; [alert setAlertStyle:NSWarningAlertStyle]; @@ -1137,7 +1137,7 @@ { if (![[self.mySqlConnection getLastErrorMessage] isEqualToString:@""]) { NSAlert *alert = [NSAlert alertWithMessageText:@"MySQL Error" - defaultButton:NSLocalizedString(@"OK", @"OK") + defaultButton:NSLocalizedString(@"OK", @"OK button") alternateButton:nil otherButton:nil informativeTextWithFormat:[self.mySqlConnection getLastErrorMessage]]; -- cgit v1.2.3