Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Translate the Finder extension's copyright
Țugui Dragoșefb63fe599b0
diff --git a/Localization/PeelFinder/InfoPlist.xcstrings b/Localization/PeelFinder/InfoPlist.xcstringsnew file mode 100644index 00000000..b97ab40e--- /dev/null+++ b/Localization/PeelFinder/InfoPlist.xcstrings@@ -0,0 +1,125 @@+{+ "sourceLanguage" : "en",+ "strings" : {+ "CFBundleDisplayName" : {+ "shouldTranslate" : false+ },+ "CFBundleName" : {+ "shouldTranslate" : false+ },+ "NSHumanReadableCopyright" : {+ "extractionState" : "extracted_with_value",+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. Svobodný software pod licencí GNU GPL verze 3 nebo novější."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. Freie Software unter der GNU GPL, Version 3 oder neuer."+ }+ },+ "en" : {+ "stringUnit" : {+ "state" : "new",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. Free software under the GNU GPL, version 3 or later."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. Software libre bajo la GNU GPL, versión 3 o posterior."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. Logiciel libre sous licence GNU GPL, version 3 ou ultérieure."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. Software libero con licenza GNU GPL, versione 3 o successiva."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. GNU GPLバージョン3以降のもとで提供されるフリーソフトウェアです。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. GNU GPL 버전 3 또는 그 이후 버전에 따른 자유 소프트웨어입니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. Vrije software onder de GNU GPL, versie 3 of later."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. Wolne oprogramowanie na licencji GNU GPL w wersji 3 lub nowszej."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. Software livre sob a GNU GPL, versão 3 ou posterior."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. Software liber sub licența GNU GPL, versiunea 3 sau ulterioară."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. Свободное ПО на условиях лицензии GNU GPL версии 3 или более поздней."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. Fri programvara under GNU GPL, version 3 eller senare."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin. GNU GPL sürüm 3 veya sonrası kapsamında özgür yazılım."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "© 2026 Țugui Dragoș-Constantin. Вільне програмне забезпечення за ліцензією GNU GPL версії 3 або новішої."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin。本软件为自由软件,依据GNU GPL第3版或更高版本授权。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Copyright © 2026 Țugui Dragoș-Constantin。依據GNU GPL第3版或更新版本授權的自由軟體。"+ }+ }+ }+ }+ },+ "version" : "1.0"+}diff --git a/Packages/PeelCore/Tests/PeelCoreTests/StringCatalogTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/StringCatalogTests.swiftindex c6697670..3e735881 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/StringCatalogTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/StringCatalogTests.swift@@ -2,7 +2,7 @@ import AppKitimport Foundationimport Testing-/// Every language the project declares is complete and sound in all four catalogs. The build checks almost+/// Every language the project declares is complete and sound in every catalog. The build checks almost/// none of this: a reordered placeholder without numbers, a plural with no `other`, an empty value and a/// broken `inflect` all compile, and show a wrong number, `(null)`, a crash or raw markup at run time.@Suite struct StringCatalogTests {@@ -10,6 +10,7 @@ import TestingCatalog(path: "Localization/Peel/Localizable.xcstrings", table: .localizable),Catalog(path: "Localization/PeelFinder/Localizable.xcstrings", table: .localizable),Catalog(path: "Localization/Peel/InfoPlist.xcstrings", table: .infoPlist),+ Catalog(path: "Localization/PeelFinder/InfoPlist.xcstrings", table: .infoPlist),Catalog(path: "Localization/Peel/AppShortcuts.xcstrings", table: .appShortcuts),]@@ -20,19 +21,37 @@ import Testing#expect(checker.problems.isEmpty, "\(checker.problems.prefix(40).map(\.description).joined(separator: "\n"))")}- /// Every text of Info.plist that macOS shows, its permission prompts and its copyright, is in the InfoPlist+ /// Every text of an Info.plist that macOS shows, the permission prompts and the copyright, is in its InfoPlist/// catalog, or macOS shows it in English in every language.- @Test func infoPlistTextIsInItsCatalog() throws {- let data = try Data(contentsOf: Self.repository.appending(path: "Support/Peel-Info.plist"))+ @Test(arguments: [+ ("Support/Peel-Info.plist", "Localization/Peel/InfoPlist.xcstrings"),+ ("Support/PeelFinder-Info.plist", "Localization/PeelFinder/InfoPlist.xcstrings"),+ ])+ func infoPlistTextIsInItsCatalog(plist path: String, catalog catalogPath: String) throws {+ let data = try Data(contentsOf: Self.repository.appending(path: path))let plist = try #require(try PropertyListSerialization.propertyList(from: data, format: nil) as? [String: Any])let shown = Set(plist.keys.filter { $0.hasSuffix("UsageDescription") || $0 == "NSHumanReadableCopyright" })let checker = CatalogChecker(root: Self.repository, required: [])- let file = checker.load("Localization/Peel/InfoPlist.xcstrings")+ let file = checker.load(catalogPath)let catalog = try #require(file?["strings"] as? [String: [String: Any]])let translated = Set(catalog.filter { $0.value["shouldTranslate"] as? Bool != false }.keys)#expect(shown == translated)}+ @Test func theFinderExtensionsCopyrightReadsAsTheAppsInEveryLanguage() throws {+ let checker = CatalogChecker(root: Self.repository, required: [])+ func copyright(in path: String) throws -> [String: Any] {+ let strings = try #require(checker.load(path)?["strings"] as? [String: [String: Any]])+ return try #require(strings["NSHumanReadableCopyright"]?["localizations"] as? [String: Any])+ }+ let app = try copyright(in: "Localization/Peel/InfoPlist.xcstrings")+ let finder = try copyright(in: "Localization/PeelFinder/InfoPlist.xcstrings")+ let differing = Set(app.keys).union(finder.keys).sorted().filter {+ app[$0] as? NSDictionary != finder[$0] as? NSDictionary+ }+ #expect(differing.isEmpty, "the extension's copyright differs from the app's in \(differing)")+ }+/// Items Peel puts in menus SwiftUI builds use SwiftUI's own words in each language, or the menu reads as if/// two apps wrote it: German puts a no-break space before its ellipsis, and Traditional Chinese writes ⋯. The/// same goes for the one name SwiftUI looks up in Peel's own strings.diff --git a/Scripts/sync_localizations.py b/Scripts/sync_localizations.pyindex 966a26c8..31355558 100644--- a/Scripts/sync_localizations.py+++ b/Scripts/sync_localizations.py@@ -4,13 +4,14 @@ Run after building the Debug configuration into `build/DerivedData`:python3 Scripts/sync_localizations.py writes the catalogspython3 Scripts/sync_localizations.py --check writes nothing, says what would change, exits 1 if anything would-There are four catalogs in `Localization/`: Localizable for the app and for the Finder extension, AppShortcuts-(the phrases Siri and Spotlight match), and InfoPlist (the text macOS shows from the app's Info.plist, such as-its permission prompts). Apple's `xcstringstool sync` updates the first three from the build's `.stringsdata`-files. It adds new strings. A string that is not in the build output is removed when it has no translations,-and otherwise marked stale with its translations kept. The tool picks the strings table by the catalog's file-name, so each catalog is synced on a copy with the same name. InfoPlist has no `.stringsdata`: its English is-read from `Support/Peel-Info.plist`, and the app's name is marked as never translated.+There are five catalogs in `Localization/`: Localizable and InfoPlist for the app and for the Finder extension,+and AppShortcuts (the phrases Siri and Spotlight match). InfoPlist holds the text macOS shows from an Info.plist,+such as the app's permission prompts and the copyright in Finder's Info window. Apple's `xcstringstool sync`+updates Localizable and AppShortcuts from the build's `.stringsdata` files. It adds new strings. A string that is+not in the build output is removed when it has no translations, and otherwise marked stale with its translations+kept. The tool picks the strings table by the catalog's file name, so each catalog is synced on a copy with the+same name. InfoPlist has no `.stringsdata`: its English is read from the target's Info.plist in `Support/`, and the+bundle's name is marked as never translated.The script stops instead of guessing. It exits when there is no build output, because a sync against nothing wouldtreat every string as gone, and when the build is older than the code, because a sync against it would miss what@@ -29,10 +30,12 @@ SYNCED = [("Peel", LOCALIZATION / "Peel/AppShortcuts.xcstrings"),("PeelFinder", LOCALIZATION / "PeelFinder/Localizable.xcstrings"),]-INFO_PLIST = PROJECT / "Support/Peel-Info.plist"-INFO_CATALOG = LOCALIZATION / "Peel/InfoPlist.xcstrings"+INFO = [+ (PROJECT / "Support/Peel-Info.plist", LOCALIZATION / "Peel/InfoPlist.xcstrings"),+ (PROJECT / "Support/PeelFinder-Info.plist", LOCALIZATION / "PeelFinder/InfoPlist.xcstrings"),+]NAMES = ["CFBundleDisplayName", "CFBundleName"]-# Anything else is refused before a catalog is touched: a mistyped --check would otherwise write all four.+# Anything else is refused before a catalog is touched: a mistyped --check would otherwise write them all.parser = argparse.ArgumentParser(description="Keeps the string catalogs in step with the strings in the code.", allow_abbrev=False)@@ -131,11 +134,11 @@ def synced(target, catalog_path):return json.loads(copy.read_text(encoding="utf-8"))-def info_plist(current):- """Returns the InfoPlist catalog: the English from `INFO_PLIST`, with every existing translation kept. When the- English changed, each translation still says the old text, so it is marked for review, which the catalog tests- refuse until it is translated again."""- plist = plistlib.loads(INFO_PLIST.read_bytes())+def info_plist(path, current):+ """Returns an InfoPlist catalog: the English from the Info.plist at `path`, with every existing translation kept.+ When the English changed, each translation still says the old text, so it is marked for review, which the+ catalog tests refuse until it is translated again."""+ plist = plistlib.loads(path.read_bytes())strings = {}old = keys(current)# The keys whose text macOS shows: the permission prompts, and the copyright in Finder's Info window.@@ -170,9 +173,10 @@ for target, path in SYNCED:before = json.loads(path.read_text(encoding="utf-8")) if path.exists() else empty_catalog()after = synced(target, path)results.append((path, after, report(f"{target} {path.stem}", before, after)))-before = json.loads(INFO_CATALOG.read_text(encoding="utf-8")) if INFO_CATALOG.exists() else empty_catalog()-after = info_plist(before)-results.append((INFO_CATALOG, after, report("Peel InfoPlist", before, after)))+for plist, path in INFO:+ before = json.loads(path.read_text(encoding="utf-8")) if path.exists() else empty_catalog()+ after = info_plist(plist, before)+ results.append((path, after, report(f"{path.parent.name} InfoPlist", before, after)))differs = any(changed for _, _, changed in results)if not CHECK: