From df925fba3be0209f934e17ed03ebf5fd6da53f72 Mon Sep 17 00:00:00 2001 From: Daniel Eden Date: Sun, 1 Oct 2023 21:30:56 +0100 Subject: [PATCH] Add localizsable keys for notification titles --- Localizable.xcstrings | 24 +++++++++++++++++++ .../xcshareddata/xcschemes/Solstice.xcscheme | 1 + Solstice/Helpers/NotificationManager.swift | 16 ++++++------- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 2db1e14d..5ac579e9 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -636,6 +636,9 @@ } } }, + "December Solstice Today" : { + "comment" : "Notification title for December solstice" + }, "Delete Location" : { "localizations" : { "it" : { @@ -806,6 +809,15 @@ } } }, + "Good Afternoon" : { + "comment" : "Notification title for afternoon notification" + }, + "Good Evening" : { + "comment" : "Notification title for evening notification" + }, + "Good Morning" : { + "comment" : "Notification title for morning notification" + }, "Graphical" : { "localizations" : { "it" : { @@ -856,6 +868,9 @@ } } }, + "June Solstice Today" : { + "comment" : "Notification title for June solstice" + }, "Learn more about the equinox and solstice" : { "localizations" : { "it" : { @@ -987,6 +1002,9 @@ } } }, + "March Equinox Today" : { + "comment" : "Notification title for March equinox" + }, "more" : { "comment" : "More daylight middle of sentence", "localizations" : { @@ -1412,6 +1430,9 @@ } } }, + "September Equinox Today" : { + "comment" : "Notification title for September equinox" + }, "Set Up Location Access" : { "localizations" : { "it" : { @@ -1732,6 +1753,9 @@ } } }, + "Today’s Daylight" : { + "comment" : "Notification title fallback" + }, "Tomorrow" : { "localizations" : { "it" : { diff --git a/Solstice.xcodeproj/xcshareddata/xcschemes/Solstice.xcscheme b/Solstice.xcodeproj/xcshareddata/xcschemes/Solstice.xcscheme index ebaf26c6..bc01e711 100644 --- a/Solstice.xcodeproj/xcshareddata/xcschemes/Solstice.xcscheme +++ b/Solstice.xcodeproj/xcshareddata/xcschemes/Solstice.xcscheme @@ -34,6 +34,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "it" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/Solstice/Helpers/NotificationManager.swift b/Solstice/Helpers/NotificationManager.swift index 334293fd..c04286f1 100644 --- a/Solstice/Helpers/NotificationManager.swift +++ b/Solstice/Helpers/NotificationManager.swift @@ -147,24 +147,24 @@ class NotificationManager: NSObject, UNUserNotificationCenterDelegate, Observabl let septemberEquinox = SolsticeCalculator.septemberEquinox(year: year) if calendar.isDate(date, inSameDayAs: marchEquinox) { - content.title = "March Equinox Today" + content.title = NSLocalizedString("March Equinox Today", comment: "Notification title for March equinox") } else if calendar.isDate(date, inSameDayAs: septemberEquinox) { - content.title = "September Equinox Today" + content.title = NSLocalizedString("September Equinox Today", comment: "Notification title for September equinox") } else if calendar.isDate(date, inSameDayAs: juneSolstice) { - content.title = "June Solstice Today" + content.title = NSLocalizedString("June Solstice Today", comment: "Notification title for June solstice") } else if calendar.isDate(date, inSameDayAs: decemberSolstice) { - content.title = "December Solstice Today" + content.title = NSLocalizedString("December Solstice Today", comment: "Notification title for December solstice") } else { let components = calendar.dateComponents([.hour], from: date) let hour = components.hour ?? 0 if hour >= 18 || hour < 3 { - content.title = "Good Evening" + content.title = NSLocalizedString("Good Evening", comment: "Notification title for evening notification") } else if hour >= 3 && hour < 12 { - content.title = "Good Morning" + content.title = NSLocalizedString("Good Morning", comment: "Notification title for morning notification") } else if hour >= 12 && hour < 18 { - content.title = "Good Afternoon" + content.title = NSLocalizedString("Good Afternoon", comment: "Notification title for afternoon notification") } else { - content.title = "Today’s Daylight" + content.title = NSLocalizedString("Today’s Daylight", comment: "Notification title fallback") } }