Show localized track names in the document window.

This commit is contained in:
Damiano Galassi committed 2016-11-23 11:40:21 +01:00
1 parent dc2d01b321
commit 78f4a7f7af
7 files changed
+22 -23

No files matched your search

+10 -10
View File
@@ -1,8 +1,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>
<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"/>
</dependencies>
<objects>
@@ -216,7 +216,7 @@
</tableCellView>
</prototypeCellViews>
</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">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -230,11 +230,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<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"/>
<subviews>
<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"/>
<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"/>
@@ -253,7 +253,7 @@
</tableCellView>
</prototypeCellViews>
</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">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -267,11 +267,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<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"/>
<subviews>
<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"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="right" title="Do not localize" id="4fX-fC-9jF">
<font key="font" metaFont="system"/>
@@ -285,11 +285,11 @@
</connections>
</tableCellView>
<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"/>
<subviews>
<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"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" alignment="right" title="Do not localize" id="B0B-3e-m7b">
<font key="font" metaFont="system"/>
+3 -3
View File
@@ -18,12 +18,12 @@
- (NSArray<NSString *> *)languages
{
return [[MP42Languages defaultManager] iso6391languages];
return [[MP42Languages defaultManager] ISO_639_1Languages];
}
- (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=%@",
API_KEY, [SBMetadataHelper urlEncoded:aMovieTitle], lang]];
@@ -101,7 +101,7 @@
- (SBMetadataResult *)loadMovieMetadata:(SBMetadataResult *)aMetadata language:(NSString *)aLanguage
{
NSString *lang = [MP42Languages iso6391CodeFor:aLanguage];
NSString *lang = [MP42Languages ISO_639_1CodeForLang:aLanguage];
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",
+2 -3
View File
@@ -35,8 +35,7 @@ static NSArray<NSString *> *TVDBlanguages;
for (NSDictionary *language in languagesArray) {
NSString *lang = [language valueForKeyPath:@"abbreviation.text"];
if (lang && [lang isKindOfClass:[NSString class]]) {
iso639_lang_t *isoLanguage = lang_for_code_s(lang.UTF8String);
[languagesResult addObject:@(isoLanguage->eng_name)];
[languagesResult addObject:[MP42Languages langForISO_639_1Code:lang]];
}
}
}
@@ -71,7 +70,7 @@ static NSArray<NSString *> *TVDBlanguages;
- (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"; }
// search for series
+2 -2
View File
@@ -55,7 +55,7 @@
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"na",
fileTrack.name,
[MP42Languages langForISO_639_2Code:fileTrack.language]]
[MP42Languages.defaultManager localizedLangForISO_639_2Code:fileTrack.language]]
action:@selector(setFallbackTrack:)
keyEquivalent:@""];
newItem.target = self;
@@ -85,7 +85,7 @@
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"na",
fileTrack.name,
[MP42Languages langForISO_639_2Code:fileTrack.language]]
[MP42Languages.defaultManager localizedLangForISO_639_2Code:fileTrack.language]]
action:@selector(setFollowsTrack:)
keyEquivalent:@""];
newItem.target = self;
+1 -1
View File
@@ -167,7 +167,7 @@ static NSString *getLevelName(uint8_t level) {
NSMenuItem *newItem = [[NSMenuItem alloc] initWithTitle:[NSString stringWithFormat:@"%@ - %@ - %@",
fileTrack.trackId ? [NSString stringWithFormat:@"%d", fileTrack.trackId] : @"NA",
fileTrack.name,
[MP42Languages langForISO_639_2Code:fileTrack.language]]
[MP42Languages.defaultManager localizedLangForISO_639_2Code:fileTrack.language]]
action:@selector(setForcedTrack:)
keyEquivalent:@""];
newItem.target = self;
+3 -3
View File
@@ -89,7 +89,7 @@ static NSDictionary *_detailMonospacedAttr;
+ (void)initialize
{
if (self == [SBDocument class]) {
_languages = [[MP42Languages defaultManager] languages];
_languages = [[MP42Languages defaultManager] localizedLanguages];
if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) {
NSFont *font = [NSFont monospacedDigitSystemFontOfSize:[NSFont systemFontSize] weight:NSFontWeightRegular];
@@ -573,7 +573,7 @@ static NSDictionary *_detailMonospacedAttr;
}
else if ([tableColumn.identifier isEqualToString:@"trackLanguage"]) {
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;
}
}
@@ -648,7 +648,7 @@ static NSDictionary *_detailMonospacedAttr;
- (IBAction)setTrackLanguage:(NSComboBox *)sender {
NSInteger row = [self.tracksTable rowForView:sender];
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]) {
track.language = language;
+1 -1
View File
@@ -348,7 +348,7 @@
}
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"]) {