From c5bd812620b1c0906ac5fce852159d419bdd1f6a Mon Sep 17 00:00:00 2001 From: Laurent Date: Mon, 27 Feb 2023 11:29:04 +0100 Subject: [PATCH] Improved localizations --- LeCountdown.xcodeproj/project.pbxproj | 2 ++ LeCountdown/Conductor.swift | 3 ++- LeCountdown/CountdownScheduler.swift | 6 ++++-- LeCountdown/fr.lproj/Localizable.strings | 4 ++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/LeCountdown.xcodeproj/project.pbxproj b/LeCountdown.xcodeproj/project.pbxproj index 0e50acd..bbf515b 100644 --- a/LeCountdown.xcodeproj/project.pbxproj +++ b/LeCountdown.xcodeproj/project.pbxproj @@ -79,6 +79,7 @@ C473C31929A926F50056B38A /* LaunchWidget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = C473C31C29A926F50056B38A /* LaunchWidget.intentdefinition */; }; C473C31A29A926F50056B38A /* LaunchWidget.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = C473C31C29A926F50056B38A /* LaunchWidget.intentdefinition */; }; C473C32C29AA330E0056B38A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = C473C32A29AA330E0056B38A /* Localizable.strings */; }; + C473C33029ACADC80056B38A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = C473C32A29AA330E0056B38A /* Localizable.strings */; }; C4742B5729840F6400D5D950 /* CoolPic.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4742B5629840F6400D5D950 /* CoolPic.swift */; }; C4742B59298411E800D5D950 /* CountdownFormView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4742B58298411E800D5D950 /* CountdownFormView.swift */; }; C4742B5B298414B000D5D950 /* ImageSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4742B5A298414B000D5D950 /* ImageSelectionView.swift */; }; @@ -934,6 +935,7 @@ buildActionMask = 2147483647; files = ( C473C30529A91BB90056B38A /* en.xcloc in Resources */, + C473C33029ACADC80056B38A /* Localizable.strings in Resources */, C473C30929A91BCC0056B38A /* fr.xcloc in Resources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/LeCountdown/Conductor.swift b/LeCountdown/Conductor.swift index 6d165dd..e504354 100644 --- a/LeCountdown/Conductor.swift +++ b/LeCountdown/Conductor.swift @@ -235,8 +235,9 @@ class Conductor: ObservableObject { fileprivate func _createTimerIntent(_ timer: AbstractTimer) { let intent = LaunchTimerIntent() - intent.suggestedInvocationPhrase = "\(NSLocalizedString("Launch", comment: "")) \(timer.displayName)" + let invocationPhrase = NSLocalizedString("Launch %@", comment: "") + intent.suggestedInvocationPhrase = String(format: invocationPhrase, timer.displayName) intent.timer = TimerIdentifier(identifier: timer.stringId, display: timer.displayName) let interaction = INInteraction(intent: intent, response: nil) diff --git a/LeCountdown/CountdownScheduler.swift b/LeCountdown/CountdownScheduler.swift index 680d37f..889b7c3 100644 --- a/LeCountdown/CountdownScheduler.swift +++ b/LeCountdown/CountdownScheduler.swift @@ -36,9 +36,11 @@ class CountdownScheduler { let duration = countdown.duration let body: String if let name = countdown.activity?.name { - body = NSLocalizedString("Time's up for \(name)!", comment: "") + let timesup = NSLocalizedString("Time's up for %@!", comment: "") + body = String(format: timesup, name) } else { - body = NSLocalizedString("Your \(duration.minuteSecond) countdown is over!", comment: "") + let timesup = NSLocalizedString("Your %@ countdown is over!", comment: "") + body = String(format: timesup, duration.minuteSecond) } content.body = body diff --git a/LeCountdown/fr.lproj/Localizable.strings b/LeCountdown/fr.lproj/Localizable.strings index 4cd3ae8..9e69dab 100644 --- a/LeCountdown/fr.lproj/Localizable.strings +++ b/LeCountdown/fr.lproj/Localizable.strings @@ -206,7 +206,7 @@ "Time" = "Temps"; /* No comment provided by engineer. */ -"Time's up for (name)!" = "C'est l'heure pour (name) !"; +"Time's up for %@!" = "C'est l'heure pour %@ !"; /* No comment provided by engineer. */ "Tooth brushing" = "Brossage de dent"; @@ -236,7 +236,7 @@ "You need to accept notifications, please check your settings" = "Vous devez accepter les notifications, veuillez vérifier vos réglages"; /* No comment provided by engineer. */ -"Your (duration.minuteSecond) countdown is over!" = "Votre minuteur de (duration.minuteSecond) est terminé !"; +"Your %@ countdown is over!" = "Votre minuteur de %@ est terminé !"; "Launch" = "Démarrer";