From 2651cd144615009242c994b087508fef99e9275c Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Wed, 8 Jun 2022 15:47:57 +0700 Subject: [PATCH] Improve compatibility with macOS 13 --- Sources/Preferences/Localization.swift | 82 +++++++++---------- .../SettingsTabViewController.swift | 8 +- readme.md | 2 + 3 files changed, 50 insertions(+), 42 deletions(-) diff --git a/Sources/Preferences/Localization.swift b/Sources/Preferences/Localization.swift index aaffeb9..62188dd 100644 --- a/Sources/Preferences/Localization.swift +++ b/Sources/Preferences/Localization.swift @@ -3,7 +3,7 @@ import Foundation struct Localization { enum Identifier { case preferences - case preferencesEllipsized + case settings } private static let localizedStrings: [Identifier: [String: String]] = [ @@ -48,46 +48,46 @@ struct Localization { "zh-HK": "偏好設定", "zh-TW": "偏好設定" ], - .preferencesEllipsized: [ - "ar": "تفضيلات…", - "ca": "Preferències…", - "cs": "Předvolby…", - "da": "Indstillinger…", - "de": "Einstellungen…", - "el": "Προτιμήσεις…", - "en": "Preferences…", - "en-AU": "Preferences…", - "en-GB": "Preferences…", - "es": "Preferencias…", - "es-419": "Preferencias…", - "fi": "Asetukset…", - "fr": "Préférences…", - "fr-CA": "Préférences…", - "he": "העדפות…", - "hi": "प्राथमिकता…", - "hr": "Postavke…", - "hu": "Beállítások…", - "id": "Preferensi…", - "it": "Preferenze…", - "ja": "環境設定…", - "ko": "환경설정...", - "ms": "Keutamaan…", - "nl": "Voorkeuren…", - "no": "Valg…", - "pl": "Preferencje…", - "pt": "Preferências…", - "pt-PT": "Preferências…", - "ro": "Preferințe…", - "ru": "Настройки…", - "sk": "Nastavenia…", - "sv": "Inställningar…", - "th": "การตั้งค่า…", - "tr": "Tercihler…", - "uk": "Параметри…", - "vi": "Tùy chọn…", - "zh-CN": "偏好设置…", - "zh-HK": "偏好設定⋯", - "zh-TW": "偏好設定⋯" + .settings: [ + "ar": "الإعدادات", + "ca": "Configuració", + "cs": "Nastavení", + "da": "Indstillinger", + "de": "Einstellungen", + "el": "Ρυθμίσεις", + "en": "Settings", + "en-AU": "Settings", + "en-GB": "Settings", + "es": "Ajustes", + "es-419": "Ajustes", + "fi": "Asetukset", + "fr": "Réglages", + "fr-CA": "Réglages", + "he": "הגדרות", + "hi": "समायोजन", + "hr": "Postavke", + "hu": "Beállítások", + "id": "Pengaturan", + "it": "Impostazioni", + "ja": "設定", + "ko": "설정", + "ms": "Tetapan", + "nl": "Instellingen", + "no": "Innstillinger", + "pl": "Ustawienia", + "pt": "Ajustes", + "pt-PT": "Definições", + "ro": "Configurări", + "ru": "Настройки", + "sk": "Nastavenia", + "sv": "Inställningar", + "th": "ค่าติดตั้ง", + "tr": "Ayarlar", + "uk": "Параметри", + "vi": "Cài đặt", + "zh-CN": "设置", + "zh-HK": "設定", + "zh-TW": "設定" ] ] diff --git a/Sources/Preferences/SettingsTabViewController.swift b/Sources/Preferences/SettingsTabViewController.swift index 5b4e15b..9a79b90 100644 --- a/Sources/Preferences/SettingsTabViewController.swift +++ b/Sources/Preferences/SettingsTabViewController.swift @@ -93,7 +93,13 @@ final class SettingsTabViewController: NSViewController, SettingsStyleController if panes.count > 1 { return panes[tabIndex].preferencePaneTitle } else { - let settings = Localization[.preferences] + let settings: String + if #available(macOS 13, *) { + settings = Localization[.settings] + } else { + settings = Localization[.preferences] + } + let appName = Bundle.main.appName return "\(appName) \(settings)" } diff --git a/readme.md b/readme.md index 8f146e5..2fecbcb 100644 --- a/readme.md +++ b/readme.md @@ -6,6 +6,8 @@ Just pass in some view controllers and this package will take care of the rest. Built-in SwiftUI support. +*This package is compatible with macOS 13 and automatically uses `Settings` instead of `Preferences` in the window title on macOS 13 and later.* +
---