Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Name the Music app as macOS names it in each language

Țugui Dragoș275ec8f23035
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 0712e2fc..03f5a49b 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -80043,108 +80043,214 @@
}
}
},
- "It is the folder where the %@ app keeps its media." : {
+ "It is the folder where the Music app keeps its media." : {
"localizations" : {
"cs" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Je to složka, ve které aplikace %@ uchovává svá média."
+ "value" : "Je to složka, ve které aplikace Hudba uchovává svá média."
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Dies ist der Ordner, in dem die App „%@“ ihre Medien aufbewahrt."
+ "value" : "Dies ist der Ordner, in dem die App „Musik“ ihre Medien aufbewahrt."
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Es la carpeta donde la app %@ guarda su contenido."
+ "value" : "Es la carpeta donde la app Música guarda su contenido."
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
- "value" : "C’est le dossier où l’app %@ conserve ses fichiers multimédias."
+ "value" : "C’est le dossier où l’app Musique conserve ses fichiers multimédias."
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
- "value" : "È la cartella in cui l’app %@ conserva i suoi file multimediali."
+ "value" : "È la cartella in cui l’app Musica conserva i suoi file multimediali."
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
- "value" : "“%@”アプリがメディアを保管するフォルダです。"
+ "value" : "ミュージックアプリがメディアを保管するフォルダです。"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
- "value" : "‘%@’ 앱이 미디어를 보관하는 폴더입니다."
+ "value" : "음악 앱이 미디어를 보관하는 폴더입니다."
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Het is de map waarin de app %@ zijn media bewaart."
+ "value" : "Het is de map waarin de app Muziek zijn media bewaart."
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
- "value" : "To folder, w którym aplikacja %@ przechowuje swoje multimedia."
+ "value" : "To folder, w którym aplikacja Muzyka przechowuje swoje multimedia."
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
- "value" : "É a pasta de mídia do app %@."
+ "value" : "É a pasta de mídia do app Música."
}
},
"ro" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Este dosarul în care aplicația %@ își păstrează conținutul multimedia."
+ "value" : "Este dosarul în care aplicația Muzică își păstrează conținutul multimedia."
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Это папка, в которой приложение «%@» хранит свои медиафайлы."
+ "value" : "Это папка, в которой приложение «Музыка» хранит свои медиафайлы."
}
},
"sv" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Det är mappen där appen %@ sparar sina medier."
+ "value" : "Det är mappen där appen Musik sparar sina medier."
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Bu, %@ uygulamasının ortam dosyalarını tuttuğu klasör."
+ "value" : "Bu, Müzik uygulamasının ortam dosyalarını tuttuğu klasör."
}
},
"uk" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Це папка, у якій програма «%@» зберігає свій медіавміст."
+ "value" : "Це папка, у якій програма «Музика» зберігає свій медіавміст."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
- "value" : "它是“%@”App存放媒体的文件夹。"
+ "value" : "它是“音乐”App存放媒体的文件夹。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
- "value" : "這是「%@」App存放媒體的檔案夾。"
+ "value" : "這是「音樂」App存放媒體的檔案夾。"
+ }
+ }
+ }
+ },
+ "It is the folder where the TV app keeps its media." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Je to složka, ve které aplikace TV uchovává svá média."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Dies ist der Ordner, in dem die App „TV“ ihre Medien aufbewahrt."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Es la carpeta donde la app TV guarda su contenido."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "C’est le dossier où l’app TV conserve ses fichiers multimédias."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "È la cartella in cui l’app TV conserva i suoi file multimediali."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "TVアプリがメディアを保管するフォルダです。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "TV 앱이 미디어를 보관하는 폴더입니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Het is de map waarin de app TV zijn media bewaart."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "To folder, w którym aplikacja TV przechowuje swoje multimedia."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "É a pasta de mídia do app TV."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Este dosarul în care aplicația TV își păstrează conținutul multimedia."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Это папка, в которой приложение «TV» хранит свои медиафайлы."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Det är mappen där appen TV sparar sina medier."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Bu, TV uygulamasının ortam dosyalarını tuttuğu klasör."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Це папка, у якій програма «TV» зберігає свій медіавміст."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "它是“TV”App存放媒体的文件夹。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "這是「TV」App存放媒體的檔案夾。"
}
}
}
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
index 196bda4b..390e2cf0 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
@@ -488,7 +488,8 @@ extension DuplicateFinder.Refusal {
switch self {
case .protected: "Peel protects what is there, and never moves it"
case .library: "it is your Library, where apps keep their data"
- case .mediaFolder(let app): "it is the folder where the \(app) app keeps its media"
+ case .mediaFolder(.music): "it is the folder where the Music app keeps its media"
+ case .mediaFolder(.tv): "it is the folder where the TV app keeps its media"
case .readOnlyDisk: "it is on a disk that can only be read, so nothing there could move to the Trash"
case .inAPackage: "it is an app or another package, or inside one, and what is inside belongs to it"
case .outsideTheHome: "it is outside your home folder, /Users/Shared, and the disks in /Volumes"
diff --git a/Packages/PeelCore/Sources/PeelCore/Duplicates/DuplicateFinder.swift b/Packages/PeelCore/Sources/PeelCore/Duplicates/DuplicateFinder.swift
index 6f0665f3..114642cd 100644
--- a/Packages/PeelCore/Sources/PeelCore/Duplicates/DuplicateFinder.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Duplicates/DuplicateFinder.swift
@@ -9,8 +9,8 @@ public struct DuplicateFinder: Sendable {
/// Folders in the home folder that hold app data or files managed by the Music and TV libraries.
/// The folders of the home that apps keep, each with why it isn't scanned.
private static let managedFolders: [(folder: String, refusal: Refusal)] = [
- ("Library", .library), ("Music/Music", .mediaFolder(app: "Music")), ("Music/iTunes", .mediaFolder(app: "Music")),
- ("Movies/TV", .mediaFolder(app: "TV")),
+ ("Library", .library), ("Music/Music", .mediaFolder(.music)), ("Music/iTunes", .mediaFolder(.music)),
+ ("Movies/TV", .mediaFolder(.tv)),
]
@@ -50,6 +50,11 @@ public struct DuplicateFinder: Sendable {
.filter { FileManager.default.fileExists(atPath: $0.path(percentEncoded: false)) }
}
+ /// The apps of macOS that keep their media in a folder of the home.
+ public enum MediaApp: Sendable, Hashable {
+ case music, tv
+ }
+
/// Why a chosen folder is not scanned. `refusal(of:)` answers the first three for any folder, which is what
/// `canScan` refuses; a scan adds the last two for a chosen folder it finds so.
public enum Refusal: Sendable, Hashable {
@@ -57,8 +62,8 @@ public struct DuplicateFinder: Sendable {
case protected
/// The home's Library, where apps keep their data.
case library
- /// The folder where the Music or TV app, named, keeps its media.
- case mediaFolder(app: String)
+ /// The folder where the Music or TV app keeps its media.
+ case mediaFolder(MediaApp)
/// An app or another package, or a folder inside one: what is inside belongs to it.
case inAPackage
/// Outside the home folder, `/Users/Shared`, and the disks in `/Volumes`.
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DuplicateFinderTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DuplicateFinderTests.swift
index 99a26278..4c9e4194 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DuplicateFinderTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DuplicateFinderTests.swift
@@ -814,7 +814,7 @@ struct DuplicateFinderTests {
@Test func saysWhyAFolderIsNotScanned() throws {
let directory = try TemporaryDirectory()
let home = try directory.directory("home")
- for path in ["Documents", "Library", "Music/Music", "Movies/TV", "Pictures/Thing.app", "Synced/.stfolder"] {
+ for path in ["Documents", "Library", "Music/Music", "Music/iTunes", "Movies/TV", "Pictures/Thing.app", "Synced/.stfolder"] {
try directory.directory("home/" + path)
}
let finder = DuplicateFinder(homeDirectory: home)
@@ -825,8 +825,9 @@ struct DuplicateFinderTests {
#expect(finder.refusal(of: home.appending(path: "Library/Mobile Documents/com~apple~CloudDocs")) == nil)
#expect(finder.refusal(of: home.appending(path: "Library/CloudStorage/Dropbox")) == nil)
#expect(finder.refusal(of: home.appending(path: "Library")) == .library)
- #expect(finder.refusal(of: home.appending(path: "Music/Music")) == .mediaFolder(app: "Music"))
- #expect(finder.refusal(of: home.appending(path: "Movies/TV")) == .mediaFolder(app: "TV"))
+ #expect(finder.refusal(of: home.appending(path: "Music/Music")) == .mediaFolder(.music))
+ #expect(finder.refusal(of: home.appending(path: "Music/iTunes")) == .mediaFolder(.music))
+ #expect(finder.refusal(of: home.appending(path: "Movies/TV")) == .mediaFolder(.tv))
#expect(finder.refusal(of: home.appending(path: "Library/Keychains")) == .protected)
#expect(finder.refusal(of: home.appending(path: "Pictures/Thing.app")) == .inAPackage)
#expect(finder.refusal(of: URL(filePath: "/")) == .outsideTheHome)
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/StringCatalogTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/StringCatalogTests.swift
index 37bbd5a5..b27dbe62 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/StringCatalogTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/StringCatalogTests.swift
@@ -70,6 +70,12 @@ import Testing
#expect(checker.problems.isEmpty, "\(checker.problems.map(\.description).joined(separator: "\n"))")
}
+ @Test func appsOfMacOSAreNamedAsTheyNameThemselves() throws {
+ var checker = CatalogChecker(root: Self.repository, required: try Self.declaredLanguages())
+ checker.checkAppNames()
+ #expect(checker.problems.isEmpty, "\(checker.problems.map(\.description).joined(separator: "\n"))")
+ }
+
/// The app quotes the Finder extension's menu item by name, so both catalogs have to agree on it.
@Test func theFinderItemIsQuotedAsTranslated() throws {
var checker = CatalogChecker(root: Self.repository, required: try Self.declaredLanguages())
@@ -468,6 +474,11 @@ struct CatalogChecker {
("Login Items & Extensions", "/System/Library/ExtensionKit/Extensions/LoginItems.appex/Contents/Resources/Localizable.loctable", "Login Items & Extensions"),
("Check the spelling or try a new search.", "/System/Library/Frameworks/SwiftUI.framework/Versions/Current/Resources/Localizable.loctable", "ContentUnavailableView_Search_Secondary_Text"),
]
+ /// The sentences that name an app of macOS, each with the app whose own name it carries.
+ static let appNames: [(key: String, app: String)] = [
+ ("It is the folder where the Music app keeps its media.", "/System/Applications/Music.app"),
+ ("It is the folder where the TV app keeps its media.", "/System/Applications/TV.app"),
+ ]
/// The items Peel puts in menus SwiftUI builds, each with SwiftUI's key. Their words are SwiftUI's, whatever
/// the English says: in Polish, About Peel reads "Peel…".
static let menuWords = ["About Peel": "About %@", "Quit Peel": "Quit %@", "Settings…": "Settings…", "Find": "Find", "Undo": "Undo", "Redo": "Redo", "Copy": "Copy", "Select All": "Select All"]
@@ -900,6 +911,32 @@ struct CatalogChecker {
}
}
+ mutating func checkAppNames() {
+ guard let catalog = load("Localization/Peel/Localizable.xcstrings")?["strings"] as? [String: [String: Any]] else { return }
+ for sentence in Self.appNames {
+ let table = URL(filePath: sentence.app).appending(path: "Contents/Resources/InfoPlist.loctable")
+ guard let data = try? Data(contentsOf: table),
+ let names = try? PropertyListSerialization.propertyList(from: data, format: nil) as? [String: Any]
+ else {
+ fail("Localization/Peel/Localizable.xcstrings", sentence.key, "en", "app name", "\(sentence.app) is not on this Mac")
+ continue
+ }
+ let localizations = catalog[sentence.key]?["localizations"] as? [String: Any] ?? [:]
+ for language in required {
+ // An app's own table writes Brazilian Portuguese as pt, where a system table writes pt_BR.
+ let local = names[Self.appleLanguages[language] ?? language] ?? names[language]
+ guard let name = (local as? [String: Any])?["CFBundleDisplayName"] as? String else {
+ fail("Localization/Peel/Localizable.xcstrings", sentence.key, language, "app name", "the app has no name in this language")
+ continue
+ }
+ let value = leaves(localizations[language] as? [String: Any] ?? [:]).first?.text
+ if value?.contains(name) != true {
+ fail("Localization/Peel/Localizable.xcstrings", sentence.key, language, "app name", "the app calls itself \(name.debugDescription)")
+ }
+ }
+ }
+ }
+
mutating func checkFinderItem() {
guard let finder = load("Localization/PeelFinder/Localizable.xcstrings")?["strings"] as? [String: [String: Any]],
let app = load("Localization/Peel/Localizable.xcstrings")?["strings"] as? [String: [String: Any]],
diff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swift
index d3341a97..f9d75fa8 100644
--- a/Peel/Views/Presentation.swift
+++ b/Peel/Views/Presentation.swift
@@ -427,7 +427,8 @@ extension DuplicateFinder.Refusal {
switch self {
case .protected: String(localized: "Peel protects what is there, and never moves it.")
case .library: String(localized: "It is your Library, where apps keep their data.")
- case .mediaFolder(let app): String(localized: "It is the folder where the \(app) app keeps its media.")
+ case .mediaFolder(.music): String(localized: "It is the folder where the Music app keeps its media.")
+ case .mediaFolder(.tv): String(localized: "It is the folder where the TV app keeps its media.")
case .readOnlyDisk: String(localized: "It is on a disk that can only be read, so nothing there could move to the Trash.")
case .inAPackage: String(localized: "It is an app or another package, or inside one, and what is inside belongs to it.")
case .outsideTheHome: String(localized: "It is outside your home folder, /Users/Shared, and the disks in /Volumes.")