From 2776ee20e178628a7802a0fc603e06b5d1b24d0a Mon Sep 17 00:00:00 2001 From: dmoagx Date: Sat, 23 Jun 2012 22:37:03 +0000 Subject: * Fixes some cases of bad localizability * In Help viewer [HELP\nTOPIC] would not be recognized as link --- Resources/English.lproj/Localizable.strings | Bin 231712 -> 232178 bytes Source/SPConnectionControllerDelegate.m | 4 ++-- Source/SPCustomQuery.m | 21 ++++++++++++++------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Resources/English.lproj/Localizable.strings b/Resources/English.lproj/Localizable.strings index 82ff3be1..ae7913fd 100644 Binary files a/Resources/English.lproj/Localizable.strings and b/Resources/English.lproj/Localizable.strings differ diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m index 567f8e87..905e1a56 100644 --- a/Source/SPConnectionControllerDelegate.m +++ b/Source/SPConnectionControllerDelegate.m @@ -145,10 +145,10 @@ static NSString *SPDatabaseImage = @"database-small"; NSMutableArray *tooltipParts = [NSMutableArray arrayWithCapacity:2]; if (favCount || !groupCount) { - [tooltipParts addObject:[NSString stringWithFormat:@"%d %@", favCount, (favCount == 1) ? NSLocalizedString(@"favorite", @"favorite singular label") : NSLocalizedString(@"favorites", @"favorites plural label")]]; + [tooltipParts addObject:[NSString stringWithFormat:((favCount == 1) ? NSLocalizedString(@"%d favorite", @"favorite singular label (%d == 1)") : NSLocalizedString(@"%d favorites", @"favorites plural label (%d != 1)")), favCount]]; } if (groupCount) { - [tooltipParts addObject:[NSString stringWithFormat:@"%d %@", groupCount, (groupCount == 1) ? NSLocalizedString(@"group", @"favorite group singular label") : NSLocalizedString(@"groups", @"favorite groups plural label")]]; + [tooltipParts addObject:[NSString stringWithFormat:((groupCount == 1) ? NSLocalizedString(@"%d group", @"favorite group singular label (%d == 1)") : NSLocalizedString(@"%d groups", @"favorite groups plural label (%d != 1)")), groupCount]]; } toolTip = [NSString stringWithFormat:@"%@ - %@", [[node representedObject] nodeName], [tooltipParts componentsJoinedByString:@", "]]; diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index e62c6c44..9cd81fe9 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -60,6 +60,7 @@ - (id)_resultDataItemAtRow:(NSInteger)row columnIndex:(NSUInteger)column; - (id)_convertResultDataValueToDisplayableRepresentation:(id)value whilePreservingNULLs:(BOOL)preserveNULLs truncateDataFields:(BOOL)truncate; ++ (NSString *)linkToHelpTopic:(NSString *)aTopic; @end @@ -3080,7 +3081,7 @@ // really nothing found? if (![theResult numberOfRows]) - return [NSString stringWithFormat:@"%@", NSLocalizedString(@"No results found.", @"No results found for a help search")]; + return [NSString stringWithFormat:@"%@", NSLocalizedString(@"No results found.", @"Mysql Help Viewer : Search : No results")]; } // Ensure rows are returned as strings to prevent data problems with older 4.1 servers @@ -3121,10 +3122,11 @@ } // Detect and generate cross-links. First, handle the old-style [HELP ...] text. - [desc replaceOccurrencesOfRegex:@"\\[HELP ([^\\]]*?)\\]" withString:[NSString stringWithFormat:@"[$1]", NSLocalizedString(@"Show MySQL help for", @"show mysql help for")]]; + [desc replaceOccurrencesOfRegex:@"(\\[HELP ([^\\]]*?)\\]" withString:[SPCustomQuery linkToHelpTopic:@"$1"]]; // Handle "see [...]" and "in [...]"-style 5.x links. - [desc replaceOccurrencesOfRegex:@"(See|see|In|in|and)\\s+\\[(?:HELP )?([^\\]]*?)\\]" withString:[NSString stringWithFormat:@"$1 [$2]", NSLocalizedString(@"Show MySQL help for", @"show mysql help for")]]; + //look-behind won't work here because of the \s+ + [desc replaceOccurrencesOfRegex:@"(See|see|In|in|and)\\s+\\[(?:HELP\\s+)?([^\\]]*?)\\]" withString:[NSString stringWithFormat:@"$1 $2",[SPCustomQuery linkToHelpTopic:@"$2"]]]; [theHelp appendFormat:@"
%@
", desc]; } @@ -3132,14 +3134,14 @@ if([tableDetails objectForKey:@"example"]){ NSString *examples = [[[tableDetails objectForKey:@"example"] copy] autorelease]; if([examples length]) - [theHelp appendFormat:@"
Example:
%@
", examples]; + [theHelp appendFormat:@"
%1$@
%2$@
",NSLocalizedString(@"Example:",@"Mysql Help Viewer : Help Topic: Example section title"), examples]; } } else { // list all found topics // check if HELP 'contents' is called if(![searchString isEqualToString:SP_HELP_TOC_SEARCH_STRING]) - [theHelp appendFormat:@"
%@ “%@”
", NSLocalizedString(@"Help topics for", @"help topics for"), searchString]; + [theHelp appendFormat:@"
%@
", [NSString stringWithFormat:NSLocalizedString(@"Help topics for “%@”", @"MySQL Help Viewer : Results list : Page title"), searchString]]; else [theHelp appendFormat:@"
%@:
", NSLocalizedString(@"MySQL Help – Categories", @"mysql help categories"), searchString]; @@ -3148,8 +3150,7 @@ [theResult setDefaultRowReturnType:SPMySQLResultRowAsArray]; for (NSArray *eachRow in theResult) { NSString *topic = [eachRow objectAtIndex:[eachRow count]-2]; - [theHelp appendFormat:@"
  • %@
  • ", - NSLocalizedString(@"Show MySQL help for", @"show mysql help for"), topic, topic, topic]; + [theHelp appendFormat:@"
  • %@
  • ",[SPCustomQuery linkToHelpTopic:topic]]; } [theHelp appendString:@""]; } @@ -3159,6 +3160,12 @@ return [NSString stringWithFormat:helpHTMLTemplate, theHelp]; } ++ (NSString *)linkToHelpTopic:(NSString *)aTopic +{ + NSString *linkTitle = [NSString stringWithFormat:NSLocalizedString(@"Show MySQL help for “%@”", @"MySQL Help Viewer : Results list : Link tooltip"),aTopic]; + return [NSString stringWithFormat:@"%1$@", aTopic, linkTitle]; +} + #pragma mark - #pragma mark WebView delegate methods -- cgit v1.2.3