Skip to content

Commit

Permalink
Improve compatibility with macOS 13
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jun 8, 2022
1 parent 5203148 commit 2651cd1
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 42 deletions.
82 changes: 41 additions & 41 deletions Sources/Preferences/Localization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Foundation
struct Localization {
enum Identifier {
case preferences
case preferencesEllipsized
case settings
}

private static let localizedStrings: [Identifier: [String: String]] = [
Expand Down Expand Up @@ -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": "設定"
]
]

Expand Down
8 changes: 7 additions & 1 deletion Sources/Preferences/SettingsTabViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
}
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.*

<br>

---
Expand Down

0 comments on commit 2651cd1

Please sign in to comment.