Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
* dev: (64 commits)
  update: project setting for mas target
  bump version
  update: export script
  fix: mismatched carthage dependency
  update LyricsProvider
  add German and Persian language support
  update: menu validation
  New translations Perference.strings (French)
  New translations Main.strings (French)
  New translations InfoPlist.strings (French)
  New translations Localizable.strings (French)
  New translations Localizable.strings (Chinese Traditional)
  New translations Perference.strings (Chinese Traditional)
  New translations Localizable.strings (Chinese Traditional)
  New translations Perference.strings (Chinese Traditional)
  New translations Perference.strings (Chinese Traditional)
  New translations Main.strings (Chinese Traditional)
  New translations InfoPlist.strings (Chinese Traditional)
  fix: can not customize touch bar
  style: clean up
  ...
  • Loading branch information
ddddxxx committed Sep 16, 2019
2 parents d21d788 + b74c686 commit f975414
Show file tree
Hide file tree
Showing 40 changed files with 1,112 additions and 189 deletions.
4 changes: 2 additions & 2 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github "ddddxxx/LyricsProvider" == 0.7.0
github "ddddxxx/LyricsProvider" == 0.7.1

github "ddddxxx/MusicPlayer" "a3ea79b572bb37223da6a2972ff8b5de415a003b"

Expand All @@ -8,7 +8,7 @@ github "ddddxxx/Semver"

github "ddddxxx/SwiftyOpenCC"

github "ddddxxx/TouchBarHelper"
github "ddddxxx/DFRPrivate"

github "SnapKit/SnapKit"

Expand Down
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
github "SnapKit/SnapKit" "5.0.0"
github "ddddxxx/DFRPrivate" "v1.0.1"
github "ddddxxx/GenericID" "v0.5.0"
github "ddddxxx/LyricsProvider" "v0.7.0"
github "ddddxxx/LyricsProvider" "v0.7.1"
github "ddddxxx/MusicPlayer" "a3ea79b572bb37223da6a2972ff8b5de415a003b"
github "ddddxxx/Semver" "v0.1.2"
github "ddddxxx/SwiftyOpenCC" "v1.0.0"
github "ddddxxx/TouchBarHelper" "v1.0.0"
github "shpakovski/MASShortcut" "2.3.6"
github "sparkle-project/Sparkle" "1.21.3"
25 changes: 25 additions & 0 deletions LyricsX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,16 @@
BB58B0811E82971400598D4F /* UserDefaults.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = UserDefaults.plist; sourceTree = "<group>"; };
BB58B0831E82B82F00598D4F /* OpenCC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenCC.framework; path = Carthage/Build/Mac/OpenCC.framework; sourceTree = "<group>"; };
BB58B0881E82CA9B00598D4F /* Credits.rtf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = "<group>"; };
BB5C552F232B5D1B00448FC0 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Main.strings; sourceTree = "<group>"; };
BB5C5530232B5D1B00448FC0 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Perference.strings; sourceTree = "<group>"; };
BB5C5531232B5D7200448FC0 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; };
BB5C5532232B5D7500448FC0 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
BB5C5533232B5D7800448FC0 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/InfoPlist.strings; sourceTree = "<group>"; };
BB5C5534232B5D7A00448FC0 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/InfoPlist.strings; sourceTree = "<group>"; };
BB5C5535232B5E6B00448FC0 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/Main.strings; sourceTree = "<group>"; };
BB5C5536232B5E6B00448FC0 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/Perference.strings; sourceTree = "<group>"; };
BB5C5537232B5EAA00448FC0 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/Localizable.strings; sourceTree = "<group>"; };
BB5C5538232B5EAE00448FC0 /* fa */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fa; path = fa.lproj/InfoPlist.strings; sourceTree = "<group>"; };
BB5D4B2C2094A1D700844D9F /* FontSelectTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontSelectTextField.swift; sourceTree = "<group>"; };
BB60F3011E889A1B00BA1FD2 /* LyricsXHelper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LyricsXHelper.app; sourceTree = BUILT_PRODUCTS_DIR; };
BB60F3031E889A1B00BA1FD2 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -610,6 +620,7 @@
};
BB50786222014C3900B695C3 = {
DevelopmentTeam = 3665V726AE;
LastSwiftMigration = 1030;
ProvisioningStyle = Automatic;
};
BB60F3001E889A1B00BA1FD2 = {
Expand Down Expand Up @@ -641,6 +652,8 @@
"zh-Hans",
ja,
pl,
de,
fa,
);
mainGroup = BB4141A11E458BA800A51775;
productRefGroup = BB4141AB1E458BA800A51775 /* Products */;
Expand Down Expand Up @@ -959,6 +972,9 @@
BB0BE9591F444CA00068FF67 /* zh-Hans */,
BB0BE95A1F444CAA0068FF67 /* en */,
E9AAA389219565010006EBC2 /* ja */,
BB5C5531232B5D7200448FC0 /* pl */,
BB5C5532232B5D7500448FC0 /* de */,
BB5C5537232B5EAA00448FC0 /* fa */,
);
name = Localizable.strings;
sourceTree = "<group>";
Expand All @@ -971,6 +987,8 @@
BB335B112057BCE3003A69F8 /* en */,
E9AAA38B2195650D0006EBC2 /* ja */,
BBD2E35B22B780FC00410259 /* pl */,
BB5C552F232B5D1B00448FC0 /* de */,
BB5C5535232B5E6B00448FC0 /* fa */,
);
name = Main.storyboard;
sourceTree = "<group>";
Expand All @@ -991,6 +1009,8 @@
BB335B132057BD03003A69F8 /* en */,
E9AAA38A219565080006EBC2 /* ja */,
BBD2E35C22B780FC00410259 /* pl */,
BB5C5530232B5D1B00448FC0 /* de */,
BB5C5536232B5E6B00448FC0 /* fa */,
);
name = Perference.storyboard;
sourceTree = "<group>";
Expand All @@ -1001,6 +1021,9 @@
E97AFB5A215CBF0300AF74CD /* en */,
E97AFB5C215CBF0500AF74CD /* zh-Hans */,
E9AAA388219564F50006EBC2 /* ja */,
BB5C5533232B5D7800448FC0 /* pl */,
BB5C5534232B5D7A00448FC0 /* de */,
BB5C5538232B5EAE00448FC0 /* fa */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
Expand Down Expand Up @@ -1206,6 +1229,7 @@
PRODUCT_NAME = LyricsX;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = IS_FOR_MAS;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand Down Expand Up @@ -1233,6 +1257,7 @@
PRODUCT_NAME = LyricsX;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = IS_FOR_MAS;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion LyricsX.xcodeproj/xcshareddata/xcschemes/LyricsX.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Export App"
scriptText = "EXPORT_OPTION_PATH=$PROJECT_DIR/ExportOptions.plist&#10;EXPORT_PATH=$PROJECT_DIR/Product&#10;&#10;# Redirect the output&#10;exec &gt; /tmp/post_archive_log.txt 2&gt;&amp;1&#10;&#10;rm -rf $EXPORT_PATH&#10;&#10;xcodebuild -exportArchive -archivePath &quot;${ARCHIVE_PATH}&quot; -exportPath &quot;${EXPORT_PATH}&quot; -exportOptionsPlist &quot;${EXPORT_OPTION_PATH}&quot;&#10;&#10;VERSION=$(/usr/libexec/PlistBuddy -c &quot;Print CFBundleShortVersionString&quot; &quot;${SOURCE_ROOT}/${INFOPLIST_FILE}&quot;)&#10;BUILD=$(/usr/libexec/PlistBuddy -c &quot;Print CFBundleVersion&quot; &quot;${SOURCE_ROOT}/${INFOPLIST_FILE}&quot;)&#10;# The build number gets automatically increased by a build phase&#10;BUILD=$((BUILD - 1))&#10;&#10;EXPORT_APP_NAME=${PRODUCT_NAME}.app&#10;EXPORT_ZIP_NAME=${PRODUCT_NAME}_${VERSION}+${BUILD}.zip&#10;&#10;cd $EXPORT_PATH&#10;zip -ry &quot;${EXPORT_ZIP_NAME}&quot; &quot;${EXPORT_APP_NAME}&quot;&#10;&#10;&#10;">
scriptText = "EXPORT_OPTION_PATH=&quot;$PROJECT_DIR/ExportOptions.plist&quot;&#10;EXPORT_PATH=&quot;$PROJECT_DIR/Product&quot;&#10;&#10;# Redirect the output&#10;exec &gt; /tmp/post_archive_log.txt 2&gt;&amp;1&#10;&#10;# Export App&#10;rm -rf $EXPORT_PATH&#10;&#10;xcodebuild -exportArchive -archivePath &quot;$ARCHIVE_PATH&quot; -exportPath &quot;$EXPORT_PATH&quot; -exportOptionsPlist &quot;$EXPORT_OPTION_PATH&quot;&#10;&#10;APP_PATH=&quot;$EXPORT_PATH/$PRODUCT_NAME.app&quot;&#10;&#10;VERSION=$(/usr/libexec/PlistBuddy -c &quot;Print CFBundleShortVersionString&quot; &quot;$APP_PATH/Contents/Info.plist&quot;)&#10;BUILD=$(/usr/libexec/PlistBuddy -c &quot;Print CFBundleVersion&quot; &quot;$APP_PATH/Contents/Info.plist&quot;)&#10;&#10;ZIP_PATH=&quot;$EXPORT_PATH/${PRODUCT_NAME}_$VERSION+$BUILD.zip&quot;&#10;&#10;# Zip and upload to the Notarization Service&#10;/usr/bin/ditto -c -k --keepParent &quot;$APP_PATH&quot; &quot;$ZIP_PATH&quot;&#10;&#10;xcrun altool --notarize-app --primary-bundle-id &quot;ddddxxx.lyricsx&quot; --username &quot;dengxiang2010@gmail.com&quot; --password &quot;@keychain:NOTARIZE_PASSWD&quot; --file &quot;$ZIP_PATH&quot;&#10;&#10;/usr/bin/open &quot;$EXPORT_PATH&quot;&#10;&#10;# xcrun stapler staple &quot;$APP_PATH&quot;&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "mac",
"filename" : "audirvana_plus_icon.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"filename" : "audirvana_plus_icon_@2x.png",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions LyricsX/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -304,7 +304,7 @@
<outlet property="view" destination="LV9-pp-2tz" id="HgV-KT-3h0"/>
</connections>
</menuItem>
<menuItem title="Search Lyrics..." tag="201" id="h6D-jz-GbI">
<menuItem title="Search Lyrics..." tag="201" identifier="MainMenu.SearchLyrics" id="h6D-jz-GbI">
<modifierMask key="keyEquivalentModifierMask"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="isHiddenDuringMASReview" value="YES"/>
Expand All @@ -313,7 +313,7 @@
<action selector="searchLyrics:" target="Ady-hI-5gd" id="RV2-uD-OF7"/>
</connections>
</menuItem>
<menuItem title="Lyrics" identifier="MainMenu.Lyrics" id="hxE-X4-sJh">
<menuItem title="Lyrics" tag="202" identifier="MainMenu.Lyrics" id="hxE-X4-sJh">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Lyrics" id="Wcz-DR-zeg">
<items>
Expand Down Expand Up @@ -1184,10 +1184,10 @@ IA
</scenes>
<resources>
<image name="NSApplicationIcon" width="32" height="32"/>
<image name="donate_alipay" width="200" height="200"/>
<image name="donate_alipay" width="100" height="100"/>
<image name="hud_button_lock_off" width="11" height="11"/>
<image name="hud_button_lock_on" width="11" height="11"/>
<image name="hud_button_sync_button" width="14" height="12"/>
<image name="missing_artwork" width="800" height="800"/>
<image name="missing_artwork" width="400" height="400"/>
</resources>
</document>
10 changes: 5 additions & 5 deletions LyricsX/Component/AppController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AppController: NSObject, MusicPlayerManagerDelegate {
currentLyrics?.recognizeLanguage()
didChangeValue(forKey: "lyricsOffset")
currentLineIndex = nil
NotificationCenter.default.post(name: .currentLyricsChange, object: nil)
postNotification(name: .currentLyricsChange)
timer?.fireDate = Date()
}
}
Expand Down Expand Up @@ -117,7 +117,7 @@ class AppController: NSObject, MusicPlayerManagerDelegate {
}

func playbackStateChanged(state: MusicPlaybackState) {
NotificationCenter.default.post(name: .lyricsShouldDisplay, object: nil)
postNotification(name: .lyricsShouldDisplay)
if state == .playing {
timer?.fireDate = Date()
} else {
Expand All @@ -126,7 +126,7 @@ class AppController: NSObject, MusicPlayerManagerDelegate {
}

func currentTrackChanged(track: MusicTrack?) {
NotificationCenter.default.post(name: .currentTrackChange, object: nil)
postNotification(name: .currentTrackChange)
if currentLyrics?.metadata.needsPersist == true {
currentLyrics?.persist()
}
Expand Down Expand Up @@ -214,14 +214,14 @@ class AppController: NSObject, MusicPlayerManagerDelegate {

func playerPositionMutated(position: TimeInterval) {
guard let lyrics = currentLyrics else {
NotificationCenter.default.post(name: .lyricsShouldDisplay, object: nil)
postNotification(name: .lyricsShouldDisplay)
timer?.fireDate = .distantFuture
return
}
let (index, next) = lyrics[position + lyrics.adjustedTimeDelay]
if currentLineIndex != index {
currentLineIndex = index
NotificationCenter.default.post(name: .lyricsShouldDisplay, object: nil)
postNotification(name: .lyricsShouldDisplay)
}
if let next = next {
timer?.fireDate = Date() + lyrics.lines[next].position - lyrics.adjustedTimeDelay - position
Expand Down
53 changes: 20 additions & 33 deletions LyricsX/Component/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import Sparkle
#endif

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate, NSTouchBarProvider {
class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation, NSMenuDelegate {

static var shared: AppDelegate? {
return NSApplication.shared.delegate as? AppDelegate
Expand All @@ -43,15 +43,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate, NSTouchBarPr

var desktopLyrics: KaraokeLyricsWindowController?

var touchBarLyrics: Any?
var _touchBarLyrics: Any?

@available(OSX 10.12.2, *)
var touchBar: NSTouchBar? {
#if IS_FOR_MAS
return (self.touchBarLyrics as! TouchBarLyrics?)?.touchBar
#else
return nil
#endif
var touchBarLyrics: TouchBarLyrics? {
return self._touchBarLyrics as! TouchBarLyrics?
}

lazy var searchLyricsWC: NSWindowController = {
Expand Down Expand Up @@ -104,9 +100,9 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate, NSTouchBarPr
if #available(OSX 10.12.2, *) {
observeDefaults(key: .TouchBarLyricsEnabled, options: [.new, .initial]) { [unowned self] _, change in
if change.newValue, self.touchBarLyrics == nil {
self.touchBarLyrics = TouchBarLyrics()
self._touchBarLyrics = TouchBarLyrics()
} else if !change.newValue, self.touchBarLyrics != nil {
self.touchBarLyrics = nil
self._touchBarLyrics = nil
}
}
}
Expand Down Expand Up @@ -143,20 +139,23 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate, NSTouchBarPr

// MARK: - NSMenuDelegate

func menuNeedsUpdate(_ menu: NSMenu) {
menu.iterateItem { item in
guard let identifier = item.identifier else { return }
switch identifier {
case .WriteToiTunes:
item.isEnabled = AppController.shared.playerManager.player is iTunes && AppController.shared.currentLyrics != nil
case .LyricsMenu:
item.isEnabled = AppController.shared.currentLyrics != nil
default:
break
}
func validateMenuItem(_ menuItem: NSMenuItem) -> Bool {
switch menuItem.action {
case #selector(writeToiTunes(_:))?:
return AppController.shared.playerManager.player is iTunes && AppController.shared.currentLyrics != nil
case #selector(searchLyrics(_:))?:
let track = AppController.shared.playerManager.player?.currentTrack
let enabled = track != nil
return enabled
default:
return true
}
}

func menuNeedsUpdate(_ menu: NSMenu) {
menu.item(withTag: 202)?.isEnabled = AppController.shared.currentLyrics != nil
}

// MARK: - Menubar Action

var lyricsHUD: NSWindowController?
Expand Down Expand Up @@ -261,18 +260,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate, NSTouchBarPr
}
}

extension NSMenu {

func iterateItem(recursive: Bool = true, _ block: (NSMenuItem) -> Void) {
for item in items {
block(item)
if recursive, item.hasSubmenu {
item.submenu?.iterateItem(block)
}
}
}
}

extension MASShortcutBinder {

func bindShortcut<T>(_ defaultsKay: UserDefaults.DefaultsKey<T>, to action: @escaping () -> Void) {
Expand Down
6 changes: 4 additions & 2 deletions LyricsX/Component/TouchBarArtworkViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ class TouchBarArtworkViewController: NSViewController {

override func viewDidLoad() {
reloadImage()
NotificationCenter.default.addObserver(self, selector: #selector(reloadImage), name: .currentTrackChange, object: nil)
observeNotification(name: .currentTrackChange) { [unowned self] _ in
self.reloadImage()
}
}

@objc func reloadImage() {
func reloadImage() {
guard let player = AppController.shared.playerManager.player else {
artworkView.image = nil
return
Expand Down
4 changes: 2 additions & 2 deletions LyricsX/Component/TouchBarLyricsItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class TouchBarLyricsItem: NSCustomTouchBarItem {
view = lyricsTextField
customizationLabel = "Lyrics"
handleLyricsDisplay()
NotificationCenter.default.addObserver(self, selector: #selector(self.handleLyricsDisplay), name: .lyricsShouldDisplay, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(self.handleLyricsDisplay), name: .currentLyricsChange, object: nil)
defaultNC.addObserver(self, selector: #selector(self.handleLyricsDisplay), name: .lyricsShouldDisplay, object: nil)
defaultNC.addObserver(self, selector: #selector(self.handleLyricsDisplay), name: .currentLyricsChange, object: nil)
}

@objc func handleLyricsDisplay() {
Expand Down
10 changes: 8 additions & 2 deletions LyricsX/Controller/KaraokeLyricsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,23 @@ class KaraokeLyricsWindowController: NSWindowController {

var firstLine = lrc.content
var secondLine: String
var secondLineIsTranslation = false
if defaults[.DesktopLyricsOneLineMode] {
secondLine = ""
} else if defaults[.PreferBilingualLyrics] {
secondLine = lrc.attachments.translation(languageCode: languageCode) ?? next?.content ?? ""
} else if defaults[.PreferBilingualLyrics],
let translation = lrc.attachments.translation(languageCode: languageCode) {
secondLine = translation
secondLineIsTranslation = true
} else {
secondLine = next?.content ?? ""
}

if let converter = ChineseConverter.shared {
if lyrics.metadata.language?.hasPrefix("zh") == true {
firstLine = converter.convert(firstLine)
if !secondLineIsTranslation {
secondLine = converter.convert(secondLine)
}
}
if languageCode?.hasPrefix("zh") == true {
secondLine = converter.convert(secondLine)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,6 @@ let supportedLanguages = [
"zh-Hans",
"ja",
"pl",
"de",
"fa",
]
Loading

0 comments on commit f975414

Please sign in to comment.