From 2f1b5d848cedf510941738f6f94ab6d8a0f53d04 Mon Sep 17 00:00:00 2001 From: fus1ondev Date: Sat, 19 Aug 2023 22:43:38 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20Localize=20untranslated?= =?UTF-8?q?=20strings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EjectKey/Commands.swift | 8 +-- EjectKey/MenuBar/MenuView.swift | 6 +-- EjectKey/MenuBar/VolumeList.swift | 20 +++---- EjectKey/Objects/VolumeType.swift | 38 +++++++------- EjectKey/Settings/AboutView.swift | 2 +- EjectKey/Settings/GeneralView.swift | 4 +- EjectKey/en.lproj/Localizable.strings | 75 ++++++++++++++++++++++++++ EjectKey/ja.lproj/Localizable.strings | 76 ++++++++++++++++++++++++++- 8 files changed, 188 insertions(+), 41 deletions(-) diff --git a/EjectKey/Commands.swift b/EjectKey/Commands.swift index 1467d41..2563d79 100644 --- a/EjectKey/Commands.swift +++ b/EjectKey/Commands.swift @@ -23,7 +23,7 @@ extension AppModel { // Succeeded if Defaults[.sendWhenVolumeIsEjected] { self.sendNotification( - title: L10n.volWasSuccessfullyEjected(volume.name ?? "Unknown"), + title: L10n.volWasSuccessfullyEjected(volume.name ?? L10n.unknown), body: device.isVirtual ? L10n.thisVolumeIsAVirtualInterface : L10n.safelyRemoved, sound: .default, identifier: UUID().uuidString @@ -33,7 +33,7 @@ extension AppModel { // Failed if Defaults[.sendWhenVolumeIsEjected] { self.sendNotification( - title: L10n.failedToEjectVol(volume.name ?? "Unknown"), + title: L10n.failedToEjectVol(volume.name ?? L10n.unknown), body: error!.localizedDescription, sound: .defaultCritical, identifier: UUID().uuidString @@ -62,7 +62,7 @@ extension AppModel { DispatchQueue.main.async { self.alert( alertStyle: .warning, - messageText: L10n.theFollowingApplicationsAreUsingVol(volume.name ?? "Unknown"), + messageText: L10n.theFollowingApplicationsAreUsingVol(volume.name ?? L10n.unknown), informativeText: infoText, buttonTitle: L10n.quit, showCancelButton: true, @@ -141,7 +141,7 @@ extension AppModel { DispatchQueue.main.async { self.sendNotification( title: L10n.volumeConnected, - body: device.isVirtual ? L10n.volIsAVirtualInterface(volume.name ?? "Unknown") : L10n.volIsAPhysicalDevice(volume.name ?? "Unknown"), + body: device.isVirtual ? L10n.volIsAVirtualInterface(volume.name ?? L10n.unknown) : L10n.volIsAPhysicalDevice(volume.name ?? L10n.unknown), sound: .default, identifier: UUID().uuidString ) diff --git a/EjectKey/MenuBar/MenuView.swift b/EjectKey/MenuBar/MenuView.swift index af7a5e0..1b4ed2f 100644 --- a/EjectKey/MenuBar/MenuView.swift +++ b/EjectKey/MenuBar/MenuView.swift @@ -36,7 +36,7 @@ struct MenuView: View { Menu { ForEach(device.units.sorted(by: { $0.number < $1.number }), id: \.number) { unit in if !unit.isApfs { - Text("\(unit.name ?? "Unknown") (\(unit.bsdName))") + Text("\(unit.name ?? L10n.unknown) (\(unit.bsdName))") Button(L10n.ejectNumVolumes(unit.volumes.count)) { model.ejectAllVolumeInDisk(unit) } @@ -47,14 +47,14 @@ struct MenuView: View { } if showDetailedInformation { Divider() - Text("Protocol: \(device.deviceProtocol ?? "Unknown")") + Text("\(L10n.connection): \(device.deviceProtocol ?? L10n.unknown)") } } label: { // if showDetailedInformation { if device.isDiskImage { Text(L10n.diskImage) } else { - Text("\(device.vendor ?? "Unknown") \(device.model ?? "Unknown")") + Text("\(device.vendor ?? L10n.unknown) \(device.model ?? L10n.unknown)") } /*} else { let numbersStr = device.units.map({ String($0.number) }).joined(separator: ", ") diff --git a/EjectKey/MenuBar/VolumeList.swift b/EjectKey/MenuBar/VolumeList.swift index e9a238f..c3b1bb2 100644 --- a/EjectKey/MenuBar/VolumeList.swift +++ b/EjectKey/MenuBar/VolumeList.swift @@ -35,12 +35,12 @@ struct VolumeList: View { if showDetailedInformation { Divider() Text(volume.type.displayName()) - Text("\(L10n.size): \(volume.size?.formatted(.byteCount(style: .file)) ?? "Unknown")") - Text("Physical Store: \(volume.bsdName)") + Text("\(L10n.size): \(volume.size?.formatted(.byteCount(style: .file)) ?? L10n.unknown)") + Text("\(L10n.physicalStores): \(volume.bsdName)") } } label: { Image(systemSymbol: .shippingbox) - Text("APFS Container (\(contentUnit.bsdName))") + Text("\(L10n.container) (\(contentUnit.bsdName))") } } } @@ -52,7 +52,7 @@ struct VolumeList: View { model.eject(volume) } } else { - Button("Mount") { + Button(L10n.mount) { // model.eject(volume) } } @@ -65,12 +65,12 @@ struct VolumeList: View { Divider() Text(volume.type.displayName()) if unit.isApfs { - Text("\(L10n.size): \(volume.size?.formatted(.byteCount(style: .file)) ?? "Unknown") (Shared)") + Text("\(L10n.size): \(volume.size?.formatted(.byteCount(style: .file)) ?? L10n.unknown)\(L10n.shared)") } else { - Text("\(L10n.size): \(volume.size?.formatted(.byteCount(style: .file)) ?? "Unknown")") + Text("\(L10n.size): \(volume.size?.formatted(.byteCount(style: .file)) ?? L10n.unknown)") } - Text("ID: \(volume.bsdName)") - Text(volume.isMounted ? "Mounted" : "Not Mounted") + Text("\(L10n.device): \(volume.bsdName)") + Text(volume.isMounted ? L10n.mounted : L10n.notMounted) } } label: { if let icon = volume.icon { @@ -78,7 +78,7 @@ struct VolumeList: View { } else { Image(systemSymbol: .externaldrive) } - Text(volume.name ?? "Unknown") + Text(volume.name ?? L10n.unknown) } } } @@ -91,7 +91,7 @@ struct VolumeList: View { } else { Image(systemSymbol: .externaldrive) } - Text(volume.name ?? "Unknown") + Text(volume.name ?? L10n.unknown) } }*/ } diff --git a/EjectKey/Objects/VolumeType.swift b/EjectKey/Objects/VolumeType.swift index 231dd3d..433cb16 100644 --- a/EjectKey/Objects/VolumeType.swift +++ b/EjectKey/Objects/VolumeType.swift @@ -9,7 +9,7 @@ import Foundation enum VolumeType { case efi - case apfsContainer, apfs, apfsSnapshot, apfsCaseSensitive, apfsEncrypted, apfsCaseSensitiveEncrypted + case apfsContainer, apfs, apfsSnapshot, apfsEncrypted, apfsCaseSensitive, apfsCaseSensitiveEncrypted case hfsPlus, hfsPlusCaseSensitive, hfsPlusJournaled, hfsPlusCaseSensitiveJournaled case linuxFilesystem, linuxSwap case windowsBasicData, windowsRecovery @@ -29,10 +29,10 @@ enum VolumeType { case "41504653-0000-11AA-AA11-00306543ECAC": // APFS switch type { - case "APFS (Case-sensitive)": - self = .apfsCaseSensitive case "APFS (Encrypted)": self = .apfsEncrypted + case "APFS (Case-sensitive)": + self = .apfsCaseSensitive case "APFS (Case-sensitive, Encrypted)": self = .apfsCaseSensitiveEncrypted case nil: @@ -78,39 +78,39 @@ enum VolumeType { case .efi: return "EFI" case .apfsContainer: - return "APFS Container" + return L10n.apfsContainer case .apfs: return "APFS" case .apfsSnapshot: - return "APFS Snapshot" - case .apfsCaseSensitive: - return "APFS (Case-sensitive)" + return L10n.apfsSnapshot case .apfsEncrypted: - return "APFS (Encrypted)" + return L10n.apfsEncrypted + case .apfsCaseSensitive: + return L10n.apfsCaseSensitive case .apfsCaseSensitiveEncrypted: - return "APFS (Case-sensitive, Encrypted)" + return L10n.apfsCaseSensitiveEncrypted case .hfsPlus: - return "Mac OS Extended" + return L10n.macOsExtended case .hfsPlusCaseSensitive: - return "Mac OS Extended (Case-sensitive)" + return L10n.macOsExtendedCaseSensitive case .hfsPlusJournaled: - return "Mac OS Extended (Journaled)" + return L10n.macOsExtendedJournaled case .hfsPlusCaseSensitiveJournaled: - return "Mac OS Extended (Case-sensitive, Journaled)" + return L10n.macOsExtendedCaseSensitiveJournaled case .linuxFilesystem: - return "Linux Filesystem" + return L10n.linuxFilesystem case .linuxSwap: - return "Linux Swap" + return L10n.linuxSwap case .windowsBasicData: - return "Windows Basic Data" + return L10n.windowsBasicData case .windowsRecovery: - return "Windows Recovery" + return L10n.windowsRecovery case .dosFat32: return "MS-DOS (FAT32)" case .partitionMap: - return "Partition Map" + return L10n.partitionMap case .unknown: - return "Unknown" + return L10n.unknown } } // swiftlint:enable cyclomatic_complexity diff --git a/EjectKey/Settings/AboutView.swift b/EjectKey/Settings/AboutView.swift index 8106911..1f925ad 100644 --- a/EjectKey/Settings/AboutView.swift +++ b/EjectKey/Settings/AboutView.swift @@ -25,7 +25,7 @@ struct AboutView: View { .font(.largeTitle) Spacer() .frame(height: 0.4) - Text("\(L10n.version) \(version ?? "unknown") (\(build ?? "unknown"))") + Text("\(L10n.version) \(version ?? L10n.unknown) (\(build ?? L10n.unknown))") .foregroundColor(Color.secondary) .textSelection(.enabled) Spacer() diff --git a/EjectKey/Settings/GeneralView.swift b/EjectKey/Settings/GeneralView.swift index 98c333f..3afab3b 100644 --- a/EjectKey/Settings/GeneralView.swift +++ b/EjectKey/Settings/GeneralView.swift @@ -40,8 +40,8 @@ struct GeneralView: View { Section { Defaults.Toggle(L10n.showEjectAllVolumesButton, key: .showEjectAllVolumesButton) Defaults.Toggle(L10n.showEjectAllVolumesInDiskButtons, key: .showEjectAllVolumesInDiskButtons) - Defaults.Toggle("Show Internal Volumes", key: .showInternalVolumes) - Defaults.Toggle("Show Unmounted Volumes", key: .showUnmountedVolumes) + Defaults.Toggle(L10n.showInternalVolumes, key: .showInternalVolumes) + Defaults.Toggle(L10n.showUnmountedVolumes, key: .showUnmountedVolumes) Defaults.Toggle(L10n.showActionMenu, key: .showActionMenu) Defaults.Toggle(L10n.showDetailedInformation, key: .showDetailedInformation) } diff --git a/EjectKey/en.lproj/Localizable.strings b/EjectKey/en.lproj/Localizable.strings index 6d0cc2c..6dece82 100644 --- a/EjectKey/en.lproj/Localizable.strings +++ b/EjectKey/en.lproj/Localizable.strings @@ -15,6 +15,21 @@ "action_when_button_is_pressed" = "Action when button is pressed"; +"apfs_case_sensitive" = "\"APFS (Case-sensitive)\""; + + +"apfs_case_sensitive_encrypted" = "APFS (Case-sensitive, Encrypted)"; + + +"apfs_container" = "APFS Container"; + + +"apfs_encrypted" = "APFS (Encrypted)"; + + +"apfs_snapshot" = "APFS Snapshot"; + + "cancel" = "Cancel"; @@ -27,6 +42,15 @@ "check_prerelease_versions" = "Check prerelease versions"; +"connection" = "Connection"; + + +"container" = "Container"; + + +"device" = "Device"; + + "disk_image" = "Disk Image"; @@ -78,15 +102,42 @@ "license" = "License"; +"linux_filesystem" = "Linux Filesystem"; + + +"linux_swap" = "Linux Swap"; + + +"mac_os_extended" = "Mac OS Extended"; + + +"mac_os_extended_case_sensitive" = "Mac OS Extended (Case-sensitive)"; + + +"mac_os_extended_case_sensitive_journaled" = "Mac OS Extended (Case-sensitive, Journaled)"; + + +"mac_os_extended_journaled" = "Mac OS Extended (Journaled)"; + + "menu_bar" = "Menu Bar"; +"mount" = "Mount"; + + +"mounted" = "Mounted"; + + "move_to_trash" = "Move to Trash"; "no_external_volume_connected" = "No external volume connected"; +"not_mounted" = "Not mounted"; + + "notifications" = "Notifications"; @@ -96,6 +147,12 @@ "open_settings" = "Open Settings..."; +"partition_map" = "Partition Map"; + + +"physical_stores" = "Physical stores"; + + "quit" = "Quit"; @@ -108,6 +165,9 @@ "settings" = "Settings..."; +"shared" = " (Shared)"; + + "shortcuts" = "Shortcuts"; @@ -129,6 +189,9 @@ "show_in_finder" = "Show in Finder"; +"show_internal_volumes" = "Show internal volumes"; + + "show_move_to_trash_dialog" = "Show \"Move to Trash\" dialog when ejecting a virtual disk image if associated .dmg files exist in the Downloads folder"; @@ -138,6 +201,9 @@ "show_quit_dialog_when_ejection_fails" = "Show a dialog to quit applications using the volume when ejection fails"; +"show_unmounted_volumes" = "Show unmounted volumes"; + + "size" = "Size"; @@ -153,6 +219,9 @@ "touch_bar" = "Touch Bar"; +"unknown" = "Unknown"; + + "version" = "Version"; @@ -172,3 +241,9 @@ "when_volume_is_ejected" = "When volume is ejected"; + + +"windows_basic_data" = "Windows Basic Data"; + + +"windows_recovery" = "Windows Recovery"; diff --git a/EjectKey/ja.lproj/Localizable.strings b/EjectKey/ja.lproj/Localizable.strings index 52c6903..e8571a7 100644 --- a/EjectKey/ja.lproj/Localizable.strings +++ b/EjectKey/ja.lproj/Localizable.strings @@ -15,6 +15,21 @@ "action_when_button_is_pressed" = "ボタンを押した時の動作"; +"apfs_case_sensitive" = "APFS(大文字/小文字を区別)"; + + +"apfs_case_sensitive_encrypted" = "APFS(大文字/小文字を区別、暗号化)"; + + +"apfs_container" = "APFSコンテナ"; + + +"apfs_encrypted" = "APFS(暗号化)"; + + +"apfs_snapshot" = "APFSスナップショット"; + + "cancel" = "キャンセル"; @@ -24,7 +39,13 @@ "check_for_updates_automatically" = "アップデートを自動的に確認"; -"check_prerelease_versions" = "プレリリースされたバージョンも確認する"; +"connection" = "接続"; + + +"container" = "コンテナ"; + + +"device" = "装置"; "disk_image" = "ディスクイメージ"; @@ -78,15 +99,42 @@ "license" = "ライセンス"; +"linux_filesystem" = "Linuxファイルシステム"; + + +"linux_swap" = "Linuxスワップ"; + + +"mac_os_extended" = "Mac OS拡張"; + + +"mac_os_extended_case_sensitive" = "Mac OS拡張(大文字/小文字を区別)"; + + +"mac_os_extended_case_sensitive_journaled" = "Mac OS拡張(大文字/小文字を区別、ジャーナリング)"; + + +"mac_os_extended_journaled" = "Mac OS拡張(ジャーナリング)"; + + "menu_bar" = "メニューバー"; +"mount" = "マウント"; + + +"mounted" = "マウント済み"; + + "move_to_trash" = "ゴミ箱に入れる"; "no_external_volume_connected" = "接続された外部ボリュームはありません"; +"not_mounted" = "未マウント"; + + "notifications" = "通知"; @@ -96,6 +144,12 @@ "open_settings" = "設定を開く..."; +"partition_map" = "パーティションマップ"; + + +"physical_stores" = "物理ストア"; + + "quit" = "終了"; @@ -108,6 +162,9 @@ "settings" = "設定..."; +"shared" = "(共有中)"; + + "shortcuts" = "ショートカット"; @@ -126,7 +183,10 @@ "show_eject_all_volumes_in_disk_buttons" = "「ディスク内のすべてのボリュームを取り出す」ボタンを表示"; -"show_in_finder" = "Finderで表示"; +"show_in_finder" = "Finderに表示"; + + +"show_internal_volumes" = "内部ボリュームを表示"; "show_move_to_trash_dialog" = "ディスクイメージの取り出し時にダウンロードフォルダ内に関連する.dmgファイルが存在した場合、「ゴミ箱に入れる」ダイアログを表示"; @@ -138,6 +198,9 @@ "show_quit_dialog_when_ejection_fails" = "取り出し失敗時にボリュームを使用中のアプリケーションを終了するダイアログを表示"; +"show_unmounted_volumes" = "マウントされていないボリュームを表示"; + + "size" = "容量"; @@ -153,6 +216,9 @@ "touch_bar" = "Touch Bar"; +"unknown" = "不明"; + + "version" = "バージョン"; @@ -172,3 +238,9 @@ "when_volume_is_ejected" = "ボリュームが取り出された時"; + + +"windows_basic_data" = "Windowsベーシックデータ"; + + +"windows_recovery" = "Windowsリカバリ";