Last batch of localisation work.
This commit is contained in:
1 parent
a2e48e9895
commit
fbb7392ccc
8 files changed
+61
-12
No files matched your search
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11535.1" systemVersion="16B2553a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16B2555" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11535.1"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -64,7 +64,7 @@
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<binding destination="vYq-3Z-IEz" name="value" keyPath="objectValue.key" id="0fC-Hm-woV"/>
|
||||
<binding destination="vYq-3Z-IEz" name="value" keyPath="objectValue.localizedKeyDisplayName" id="I2x-pk-tAp"/>
|
||||
</connections>
|
||||
</textField>
|
||||
</subviews>
|
||||
@@ -290,7 +290,7 @@
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="120" id="MKe-YL-gx8"/>
|
||||
</constraints>
|
||||
<buttonCell key="cell" type="smallSquare" title="Restore Defaults" bezelStyle="smallSquare" image="98F34B08-C401-4D88-9834-997E20828E3D" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="nBh-jv-KDG">
|
||||
<buttonCell key="cell" type="smallSquare" title="Restore Defaults" bezelStyle="smallSquare" image="3F203880-73DA-4353-8FB7-57C000BB850F" imagePosition="overlaps" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="nBh-jv-KDG">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
@@ -342,7 +342,7 @@
|
||||
<userDefaultsController representsSharedInstance="YES" id="LQR-UU-5Gl"/>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="98F34B08-C401-4D88-9834-997E20828E3D" width="1" height="1">
|
||||
<image name="3F203880-73DA-4353-8FB7-57C000BB850F" width="1" height="1">
|
||||
<mutableData key="keyedArchiveRepresentation">
|
||||
YnBsaXN0MDDUAQIDBAUGPT5YJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoK4HCBMU
|
||||
GR4fIyQrLjE3OlUkbnVsbNUJCgsMDQ4PEBESVk5TU2l6ZVYkY2xhc3NcTlNJbWFnZUZsYWdzVk5TUmVw
|
||||
|
||||
@@ -51,6 +51,7 @@ extern NSString *const SBMetadataResultNetwork;
|
||||
|
||||
+ (NSArray<NSString *> *)movieKeys;
|
||||
+ (NSArray<NSString *> *)tvShowKeys;
|
||||
+ (NSString *)localizedDisplayNameForKey:(NSString *)key;
|
||||
|
||||
- (void)merge:(SBMetadataResult *)aObject;
|
||||
|
||||
|
||||
@@ -109,6 +109,50 @@ NSString *const SBMetadataResultNetwork = @"{Network}";
|
||||
SBMetadataResultITunesCountry];
|
||||
}
|
||||
|
||||
static NSDictionary<NSString *, NSString *> *localizedKeys;
|
||||
|
||||
+ (NSString *)localizedDisplayNameForKey:(NSString *)key
|
||||
{
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
localizedKeys = @{
|
||||
SBMetadataResultName: NSLocalizedString(@"Name", nil),
|
||||
SBMetadataResultComposer: NSLocalizedString(@"Composer", nil),
|
||||
SBMetadataResultGenre: NSLocalizedString(@"Genre", nil),
|
||||
SBMetadataResultReleaseDate: NSLocalizedString(@"Release Date", nil),
|
||||
SBMetadataResultDescription: NSLocalizedString(@"Description", nil),
|
||||
SBMetadataResultLongDescription: NSLocalizedString(@"Long Description", nil),
|
||||
SBMetadataResultRating: NSLocalizedString(@"Rating", nil),
|
||||
SBMetadataResultStudio: NSLocalizedString(@"Studio", nil),
|
||||
SBMetadataResultCast: NSLocalizedString(@"Cast", nil),
|
||||
SBMetadataResultDirector: NSLocalizedString(@"Director", nil),
|
||||
SBMetadataResultProducers: NSLocalizedString(@"Producers", nil),
|
||||
SBMetadataResultScreenwriters: NSLocalizedString(@"Screenwriters", nil),
|
||||
SBMetadataResultExecutiveProducer: NSLocalizedString(@"Executive Producer", nil),
|
||||
SBMetadataResultCopyright: NSLocalizedString(@"Copyright", nil),
|
||||
|
||||
SBMetadataResultContentID: NSLocalizedString(@"contentID", nil),
|
||||
SBMetadataResultArtistID: NSLocalizedString(@"artistID", nil),
|
||||
SBMetadataResultPlaylistID: NSLocalizedString(@"playlistID", nil),
|
||||
SBMetadataResultITunesCountry: NSLocalizedString(@"iTunes Country", nil),
|
||||
SBMetadataResultITunesURL: NSLocalizedString(@"iTunes URL", nil),
|
||||
|
||||
SBMetadataResultSeriesName: NSLocalizedString(@"Series Name", nil),
|
||||
SBMetadataResultSeriesDescription: NSLocalizedString(@"Series Description", nil),
|
||||
SBMetadataResultTrackNumber: NSLocalizedString(@"Track #", nil),
|
||||
SBMetadataResultDiskNumber: NSLocalizedString(@"Disk #", nil),
|
||||
SBMetadataResultEpisodeNumber: NSLocalizedString(@"Episode #", nil),
|
||||
SBMetadataResultEpisodeID: NSLocalizedString(@"Episode ID", nil),
|
||||
SBMetadataResultSeason: NSLocalizedString(@"Season", nil),
|
||||
SBMetadataResultNetwork: NSLocalizedString(@"Network", nil),
|
||||
};
|
||||
});
|
||||
|
||||
NSString *localizedString = localizedKeys[key];
|
||||
return localizedString ? localizedString : key;
|
||||
|
||||
}
|
||||
|
||||
- (void)merge:(SBMetadataResult *)metadata
|
||||
{
|
||||
[_tags addEntriesFromDictionary:metadata.tags];
|
||||
|
||||
@@ -167,7 +167,7 @@ static void *SBMetadataPrefsViewControllerContex = &SBMetadataPrefsViewControlle
|
||||
- (NSString *)tokenField:(NSTokenField *)tokenField displayStringForRepresentedObject:(id)representedObject
|
||||
{
|
||||
if ([representedObject rangeOfString: @"{"].location == 0) {
|
||||
return [(NSString *)representedObject substringWithRange:NSMakeRange(1, [(NSString *)representedObject length]-2)];
|
||||
return [SBMetadataResult localizedDisplayNameForKey:representedObject];
|
||||
}
|
||||
|
||||
return representedObject;
|
||||
|
||||
@@ -18,6 +18,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, readonly) NSString *key;
|
||||
@property (nonatomic, readwrite, copy) NSArray<NSString *> *value;
|
||||
|
||||
@property (nonatomic, readonly) NSString *localizedKeyDisplayName;
|
||||
|
||||
@end
|
||||
|
||||
typedef NS_ENUM(NSUInteger, SBMetadataResultMapType) {
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
return [[self alloc] initWithKey:key value:value];
|
||||
}
|
||||
|
||||
- (NSString *)localizedKeyDisplayName
|
||||
{
|
||||
return localizedMetadataKeyName(self.key);
|
||||
}
|
||||
|
||||
#pragma mark - NSSecureCoding
|
||||
|
||||
+ (BOOL)supportsSecureCoding
|
||||
|
||||
@@ -577,10 +577,7 @@
|
||||
} else if (tableView == (NSTableView *) metadataTable) {
|
||||
if (self.selectedResult != nil) {
|
||||
if ([tableColumn.identifier isEqualToString:@"name"]) {
|
||||
NSString *key = self.selectedResultTagsArray[rowIndex];
|
||||
key = [key stringByReplacingOccurrencesOfString:@"{" withString:@""];
|
||||
key = [key stringByReplacingOccurrencesOfString:@"}" withString:@""];
|
||||
return [self boldString:key];
|
||||
return [self boldString:[SBMetadataResult localizedDisplayNameForKey:self.selectedResultTagsArray[rowIndex]]];
|
||||
}
|
||||
if ([tableColumn.identifier isEqualToString:@"value"]) {
|
||||
return (self.selectedResultTags)[(self.selectedResultTagsArray)[rowIndex]];
|
||||
|
||||
Reference in new issue
Block a user