Changeset 13458


Ignore:
Timestamp:
Sep 3, 2012, 6:37:18 PM (9 years ago)
Author:
livings124
Message:

use localized strings properly in the quick look plugin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/QuickLookPlugin/GeneratePreviewForURL.m

    r13434 r13458  
    4747        return noErr;
    4848   
    49     NSURL * styleURL = [[NSBundle bundleWithIdentifier: @"org.m0k.transmission.QuickLookPlugin"] URLForResource: @"style" withExtension: @"css"];
     49    NSBundle * bundle = [NSBundle bundleWithIdentifier: @"org.m0k.transmission.QuickLookPlugin"];
     50   
     51    NSURL * styleURL = [bundle URLForResource: @"style" withExtension: @"css"];
    5052    NSString * styleContents = [NSString stringWithContentsOfURL: styleURL encoding: NSUTF8StringEncoding error: NULL];
    5153   
     
    6668        NSString * fileCountString;
    6769        if (inf.fileCount == 1)
    68             fileCountString = NSLocalizedString(@"1 file", "quicklook file count");
     70            fileCountString = NSLocalizedStringFromTableInBundle(@"1 file", nil, bundle, "quicklook file count");
    6971        else
    70             fileCountString= [NSString stringWithFormat: NSLocalizedString(@"%@ files", "quicklook file count"), [NSString formattedUInteger: inf.fileCount]];
     72            fileCountString= [NSString stringWithFormat: NSLocalizedStringFromTableInBundle(@"%@ files", nil, bundle, "quicklook file count"), [NSString formattedUInteger: inf.fileCount]];
    7173        fileSizeString = [NSString stringWithFormat: @"%@, %@", fileCountString, fileSizeString];
    7274    }
     
    7880    NSString * creationString = nil;
    7981    if (dateCreatedString && creatorString)
    80         creationString = [NSString stringWithFormat: NSLocalizedString(@"Created on %@ with %@", "quicklook creation info"), dateCreatedString, creatorString];
     82        creationString = [NSString stringWithFormat: NSLocalizedStringFromTableInBundle(@"Created on %@ with %@", nil, bundle, "quicklook creation info"), dateCreatedString, creatorString];
    8183    else if (dateCreatedString)
    82         creationString = [NSString stringWithFormat: NSLocalizedString(@"Created on %@", "quicklook creation info"), dateCreatedString];
     84        creationString = [NSString stringWithFormat: NSLocalizedStringFromTableInBundle(@"Created on %@", nil, bundle, "quicklook creation info"), dateCreatedString];
    8385    else if (creatorString)
    84         creationString = [NSString stringWithFormat: NSLocalizedString(@"Created with %@", "quicklook creation info"), creatorString];
     86        creationString = [NSString stringWithFormat: NSLocalizedStringFromTableInBundle(@"Created with %@", nil, bundle, "quicklook creation info"), creatorString];
    8587    if (creationString)
    8688        [htmlString appendFormat: @"<p>%@</p>", creationString];
     
    100102        [listSection appendString: @"<table>"];
    101103       
    102         NSString * headerTitleString = inf.webseedCount == 1 ? NSLocalizedString(@"1 Web Seed", "quicklook web seed header") : [NSString stringWithFormat: NSLocalizedString(@"%@ Web Seeds", "quicklook web seed header"), [NSString formattedUInteger: inf.webseedCount]];
     104        NSString * headerTitleString = inf.webseedCount == 1 ? NSLocalizedStringFromTableInBundle(@"1 Web Seed", nil, bundle, "quicklook web seed header") : [NSString stringWithFormat: NSLocalizedStringFromTableInBundle(@"%@ Web Seeds", nil, bundle, "quicklook web seed header"), [NSString formattedUInteger: inf.webseedCount]];
    103105        [listSection appendFormat: @"<tr><th>%@</th></tr>", headerTitleString];
    104106       
     
    116118        [listSection appendString: @"<table>"];
    117119       
    118         NSString * headerTitleString = inf.trackerCount == 1 ? NSLocalizedString(@"1 Tracker", "quicklook tracker header") : [NSString stringWithFormat: NSLocalizedString(@"%@ Trackers", "quicklook tracker header"), [NSString formattedUInteger: inf.trackerCount]];
     120        NSString * headerTitleString = inf.trackerCount == 1 ? NSLocalizedStringFromTableInBundle(@"1 Tracker", nil, bundle, "quicklook tracker header") : [NSString stringWithFormat: NSLocalizedStringFromTableInBundle(@"%@ Trackers", nil, bundle, "quicklook tracker header"), [NSString formattedUInteger: inf.trackerCount]];
    119121        [listSection appendFormat: @"<tr><th>%@</th></tr>", headerTitleString];
    120122       
     
    133135        [listSection appendString: @"<table>"];
    134136       
    135         NSString * fileTitleString = inf.fileCount == 1 ? NSLocalizedString(@"1 File", "quicklook file header") : [NSString stringWithFormat: NSLocalizedString(@"%@ Files", "quicklook file header"), [NSString formattedUInteger: inf.fileCount]];
     137        NSString * fileTitleString = inf.fileCount == 1 ? NSLocalizedStringFromTableInBundle(@"1 File", nil, bundle, "quicklook file header") : [NSString stringWithFormat: NSLocalizedStringFromTableInBundle(@"%@ Files", nil, bundle, "quicklook file header"), [NSString formattedUInteger: inf.fileCount]];
    136138        [listSection appendFormat: @"<tr><th>%@</th></tr>", fileTitleString];
    137139       
Note: See TracChangeset for help on using the changeset viewer.