Show localized track names in the document window.
This commit is contained in:
1 parent
dc2d01b321
commit
78f4a7f7af
7 files changed
+22
-23
No files matched your search
+10
-10
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11542" systemVersion="16C48b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11761" systemVersion="16C48b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11542"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11761"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
@@ -216,7 +216,7 @@
|
|||||||
</tableCellView>
|
</tableCellView>
|
||||||
</prototypeCellViews>
|
</prototypeCellViews>
|
||||||
</tableColumn>
|
</tableColumn>
|
||||||
<tableColumn identifier="trackLanguage" width="138" minWidth="130" maxWidth="150" id="100044">
|
<tableColumn identifier="trackLanguage" width="148" minWidth="130" maxWidth="150" id="100044">
|
||||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="Language">
|
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="Language">
|
||||||
<font key="font" metaFont="smallSystem"/>
|
<font key="font" metaFont="smallSystem"/>
|
||||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||||
@@ -230,11 +230,11 @@
|
|||||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||||
<prototypeCellViews>
|
<prototypeCellViews>
|
||||||
<tableCellView identifier="ComboCell" id="Yb8-DO-WWM" customClass="SBComboBoxCellView">
|
<tableCellView identifier="ComboCell" id="Yb8-DO-WWM" customClass="SBComboBoxCellView">
|
||||||
<rect key="frame" x="382" y="1" width="138" height="17"/>
|
<rect key="frame" x="382" y="1" width="148" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<comboBox verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xf4-ll-Tkp">
|
<comboBox verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Xf4-ll-Tkp">
|
||||||
<rect key="frame" x="3" y="-5" width="135" height="26"/>
|
<rect key="frame" x="3" y="-5" width="145" height="26"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES"/>
|
||||||
<comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" alignment="right" buttonBordered="NO" completes="NO" usesDataSource="YES" numberOfVisibleItems="8" id="FqY-5W-MnQ" customClass="SBComboBoxCell">
|
<comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" alignment="right" buttonBordered="NO" completes="NO" usesDataSource="YES" numberOfVisibleItems="8" id="FqY-5W-MnQ" customClass="SBComboBoxCell">
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
@@ -253,7 +253,7 @@
|
|||||||
</tableCellView>
|
</tableCellView>
|
||||||
</prototypeCellViews>
|
</prototypeCellViews>
|
||||||
</tableColumn>
|
</tableColumn>
|
||||||
<tableColumn identifier="trackInfo" editable="NO" width="165" minWidth="80" maxWidth="440" id="100040">
|
<tableColumn identifier="trackInfo" editable="NO" width="155" minWidth="80" maxWidth="440" id="100040">
|
||||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="Format">
|
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="right" title="Format">
|
||||||
<font key="font" metaFont="smallSystem"/>
|
<font key="font" metaFont="smallSystem"/>
|
||||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||||
@@ -267,11 +267,11 @@
|
|||||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||||
<prototypeCellViews>
|
<prototypeCellViews>
|
||||||
<tableCellView identifier="FormatCell" id="lpt-ck-ie2">
|
<tableCellView identifier="FormatCell" id="lpt-ck-ie2">
|
||||||
<rect key="frame" x="523" y="1" width="165" height="17"/>
|
<rect key="frame" x="533" y="1" width="155" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vEq-Qw-35S">
|
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vEq-Qw-35S">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="165" height="17"/>
|
<rect key="frame" x="0.0" y="0.0" width="155" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="right" title="Do not localize" id="4fX-fC-9jF">
|
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="right" title="Do not localize" id="4fX-fC-9jF">
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
@@ -285,11 +285,11 @@
|
|||||||
</connections>
|
</connections>
|
||||||
</tableCellView>
|
</tableCellView>
|
||||||
<tableCellView identifier="DisabledFormatCell" id="cWa-bG-vg7">
|
<tableCellView identifier="DisabledFormatCell" id="cWa-bG-vg7">
|
||||||
<rect key="frame" x="523" y="20" width="165" height="17"/>
|
<rect key="frame" x="533" y="20" width="155" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zF5-nA-gdc">
|
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zF5-nA-gdc">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="165" height="17"/>
|
<rect key="frame" x="0.0" y="0.0" width="155" height="17"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||||
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="right" title="Do not localize" id="B0B-3e-m7b">
|
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="right" title="Do not localize" id="B0B-3e-m7b">
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
|
|||||||
@@ -18,12 +18,12 @@
|
|||||||
|
|
||||||
- (NSArray<NSString *> *)languages
|
- (NSArray<NSString *> *)languages
|
||||||
{
|
{
|
||||||
return [[MP42Languages defaultManager] iso6391languages];
|
return [[MP42Languages defaultManager] ISO_639_1Languages];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSArray<SBMetadataResult *> *)searchMovie:(NSString *)aMovieTitle language:(NSString *)aLanguage
|
- (NSArray<SBMetadataResult *> *)searchMovie:(NSString *)aMovieTitle language:(NSString *)aLanguage
|
||||||
{
|
{
|
||||||
NSString *lang = [MP42Languages iso6391CodeFor:aLanguage];
|
NSString *lang = [MP42Languages ISO_639_1CodeForLang:aLanguage];
|
||||||
|
|
||||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.themoviedb.org/3/search/movie?api_key=%@&query=%@&language=%@",
|
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.themoviedb.org/3/search/movie?api_key=%@&query=%@&language=%@",
|
||||||
API_KEY, [SBMetadataHelper urlEncoded:aMovieTitle], lang]];
|
API_KEY, [SBMetadataHelper urlEncoded:aMovieTitle], lang]];
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
|
|
||||||
- (SBMetadataResult *)loadMovieMetadata:(SBMetadataResult *)aMetadata language:(NSString *)aLanguage
|
- (SBMetadataResult *)loadMovieMetadata:(SBMetadataResult *)aMetadata language:(NSString *)aLanguage
|
||||||
{
|
{
|
||||||
NSString *lang = [MP42Languages iso6391CodeFor:aLanguage];
|
NSString *lang = [MP42Languages ISO_639_1CodeForLang:aLanguage];
|
||||||
NSNumber *theMovieDBID = aMetadata[@"TheMovieDB ID"];
|
NSNumber *theMovieDBID = aMetadata[@"TheMovieDB ID"];
|
||||||
|
|
||||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.themoviedb.org/3/movie/%@?api_key=%@&language=%@&append_to_response=casts,releases,images",
|
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.themoviedb.org/3/movie/%@?api_key=%@&language=%@&append_to_response=casts,releases,images",
|
||||||
|
|||||||
@@ -35,8 +35,7 @@ static NSArray<NSString *> *TVDBlanguages;
|
|||||||
for (NSDictionary *language in languagesArray) {
|
for (NSDictionary *language in languagesArray) {
|
||||||
NSString *lang = [language valueForKeyPath:@"abbreviation.text"];
|
NSString *lang = [language valueForKeyPath:@"abbreviation.text"];
|
||||||
if (lang && [lang isKindOfClass:[NSString class]]) {
|
if (lang && [lang isKindOfClass:[NSString class]]) {
|
||||||
iso639_lang_t *isoLanguage = lang_for_code_s(lang.UTF8String);
|
[languagesResult addObject:[MP42Languages langForISO_639_1Code:lang]];
|
||||||
[languagesResult addObject:@(isoLanguage->eng_name)];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,7 +70,7 @@ static NSArray<NSString *> *TVDBlanguages;
|
|||||||
|
|
||||||
- (NSArray<SBMetadataResult *> *)searchTVSeries:(NSString *)aSeriesName language:(NSString *)aLanguage seasonNum:(NSString *)aSeasonNum episodeNum:(NSString *)aEpisodeNum
|
- (NSArray<SBMetadataResult *> *)searchTVSeries:(NSString *)aSeriesName language:(NSString *)aLanguage seasonNum:(NSString *)aSeasonNum episodeNum:(NSString *)aEpisodeNum
|
||||||
{
|
{
|
||||||
NSString *lang = [MP42Languages iso6391CodeFor:aLanguage];
|
NSString *lang = [MP42Languages ISO_639_1CodeForLang:aLanguage];
|
||||||
if (!lang) { lang = @"en"; }
|
if (!lang) { lang = @"en"; }
|
||||||
|
|
||||||
// search for series
|
// search for series
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
|
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
|
||||||
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"na",
|
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"na",
|
||||||
fileTrack.name,
|
fileTrack.name,
|
||||||
[MP42Languages langForISO_639_2Code:fileTrack.language]]
|
[MP42Languages.defaultManager localizedLangForISO_639_2Code:fileTrack.language]]
|
||||||
action:@selector(setFallbackTrack:)
|
action:@selector(setFallbackTrack:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
newItem.target = self;
|
newItem.target = self;
|
||||||
@@ -85,7 +85,7 @@
|
|||||||
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
|
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
|
||||||
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"na",
|
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"na",
|
||||||
fileTrack.name,
|
fileTrack.name,
|
||||||
[MP42Languages langForISO_639_2Code:fileTrack.language]]
|
[MP42Languages.defaultManager localizedLangForISO_639_2Code:fileTrack.language]]
|
||||||
action:@selector(setFollowsTrack:)
|
action:@selector(setFollowsTrack:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
newItem.target = self;
|
newItem.target = self;
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ static NSString *getLevelName(uint8_t level) {
|
|||||||
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
|
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
|
||||||
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"NA",
|
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"NA",
|
||||||
fileTrack.name,
|
fileTrack.name,
|
||||||
[MP42Languages langForISO_639_2Code:fileTrack.language]]
|
[MP42Languages.defaultManager localizedLangForISO_639_2Code:fileTrack.language]]
|
||||||
action:@selector(setForcedTrack:)
|
action:@selector(setForcedTrack:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
newItem.target = self;
|
newItem.target = self;
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ static NSDictionary *_detailMonospacedAttr;
|
|||||||
+ (void)initialize
|
+ (void)initialize
|
||||||
{
|
{
|
||||||
if (self == [SBDocument class]) {
|
if (self == [SBDocument class]) {
|
||||||
_languages = [[MP42Languages defaultManager] languages];
|
_languages = [[MP42Languages defaultManager] localizedLanguages];
|
||||||
|
|
||||||
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
|
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
|
||||||
NSFont *font = [NSFont monospacedDigitSystemFontOfSize:[NSFont systemFontSize] weight:NSFontWeightRegular];
|
NSFont *font = [NSFont monospacedDigitSystemFontOfSize:[NSFont systemFontSize] weight:NSFontWeightRegular];
|
||||||
@@ -573,7 +573,7 @@ static NSDictionary *_detailMonospacedAttr;
|
|||||||
}
|
}
|
||||||
else if ([tableColumn.identifier isEqualToString:@"trackLanguage"]) {
|
else if ([tableColumn.identifier isEqualToString:@"trackLanguage"]) {
|
||||||
SBComboBoxCellView *comboCell = [tableView makeViewWithIdentifier:@"ComboCell" owner:self];
|
SBComboBoxCellView *comboCell = [tableView makeViewWithIdentifier:@"ComboCell" owner:self];
|
||||||
comboCell.comboBox.stringValue = [MP42Languages langForISO_639_2Code:track.language];
|
comboCell.comboBox.stringValue = [MP42Languages.defaultManager localizedLangForISO_639_2Code:track.language];
|
||||||
cell = comboCell;
|
cell = comboCell;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -648,7 +648,7 @@ static NSDictionary *_detailMonospacedAttr;
|
|||||||
- (IBAction)setTrackLanguage:(NSComboBox *)sender {
|
- (IBAction)setTrackLanguage:(NSComboBox *)sender {
|
||||||
NSInteger row = [self.tracksTable rowForView:sender];
|
NSInteger row = [self.tracksTable rowForView:sender];
|
||||||
MP42Track *track = [self trackAtAtTableRow:row];
|
MP42Track *track = [self trackAtAtTableRow:row];
|
||||||
NSString *language = [MP42Languages ISO_639_2CodeForLang:sender.stringValue];
|
NSString *language = [MP42Languages.defaultManager ISO_639_2CodeForLocalizedLang:sender.stringValue];
|
||||||
|
|
||||||
if (track && ![language isEqualToString:track.language]) {
|
if (track && ![language isEqualToString:track.language]) {
|
||||||
track.language = language;
|
track.language = language;
|
||||||
|
|||||||
@@ -348,7 +348,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ([tableColumn.identifier isEqualToString:@"trackLanguage"]) {
|
if ([tableColumn.identifier isEqualToString:@"trackLanguage"]) {
|
||||||
return [MP42Languages langForISO_639_2Code:track.language];
|
return [MP42Languages.defaultManager localizedLangForISO_639_2Code:track.language];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([tableColumn.identifier isEqualToString:@"trackAction"]) {
|
if ([tableColumn.identifier isEqualToString:@"trackAction"]) {
|
||||||
|
|||||||
Reference in new issue
Block a user