Jonas Björkert 1 年間 前
コミット
ee22577c8e

+ 30 - 10
Trio/Sources/Modules/Settings/View/SettingsRootView.swift

@@ -44,7 +44,11 @@ extension Settings {
                     let buildDetails = BuildDetails.default
 
                     Section(
-                        header: Text("BRANCH: \(buildDetails.branchAndSha)").textCase(nil),
+                        header: Text(String(
+                            localized: "BRANCH: \(buildDetails.branchAndSha)",
+                            comment: "Displays the current branch and commit SHA"
+                        ))
+                            .textCase(nil),
                         content: {
                             let versionNumber = Bundle.main.releaseVersionNumber ?? "Unknown"
                             let buildNumber = Bundle.main.buildVersionNumber ?? "Unknown"
@@ -58,7 +62,10 @@ extension Settings {
                                         .cornerRadius(10)
                                         .padding(.trailing, 10)
                                     VStack(alignment: .leading, spacing: 4) {
-                                        Text("Trio v\(versionNumber) (\(buildNumber))")
+                                        Text(String(
+                                            localized: "Trio v\(versionNumber) (\(buildNumber))",
+                                            comment: "App version and build number"
+                                        ))
                                             .font(.headline)
                                         if let expirationDate = buildDetails.calculateExpirationDate() {
                                             let formattedDate = DateFormatter.localizedString(
@@ -70,32 +77,44 @@ extension Settings {
                                                 .font(.footnote)
                                                 .foregroundColor(.secondary)
                                         } else {
-                                            Text("Simulator Build has no expiry")
+                                            Text(String(
+                                                localized: "Simulator Build has no expiry",
+                                                comment: "Indicates no expiration for a simulator build"
+                                            ))
                                                 .font(.footnote)
                                                 .foregroundColor(.secondary)
                                         }
                                         if let latest = versionInfo.latestVersion {
                                             HStack {
-                                                Text("Latest version: \(latest)")
+                                                Text(String(
+                                                    localized: "Latest version: \(latest)",
+                                                    comment: "Displays the latest version number"
+                                                ))
                                                     .font(.footnote)
                                                     .foregroundColor(versionInfo.isUpdateAvailable ? .orange : .green)
                                                 Image(
-                                                    systemName: versionInfo
-                                                        .isUpdateAvailable ? "exclamationmark.triangle.fill" :
-                                                        "checkmark.circle.fill"
+                                                    systemName: versionInfo.isUpdateAvailable ?
+                                                        "exclamationmark.triangle.fill" : "checkmark.circle.fill"
                                                 )
                                                 .foregroundColor(versionInfo.isUpdateAvailable ? .orange : .green)
                                             }
                                             if versionInfo.isBlacklisted {
                                                 HStack {
-                                                    Text("Warning: Known issues. Update now.").font(.footnote)
+                                                    Text(String(
+                                                        localized: "Warning: Known issues. Update now.",
+                                                        comment: "Warning message for blacklisted version"
+                                                    ))
+                                                        .font(.footnote)
                                                         .foregroundColor(.red)
                                                     Image(systemName: "exclamationmark.octagon.fill")
                                                         .foregroundColor(.red)
                                                 }
                                             }
                                         } else {
-                                            Text("Latest version: Fetching...")
+                                            Text(String(
+                                                localized: "Latest version: Fetching...",
+                                                comment: "Message shown while fetching latest version"
+                                            ))
                                                 .font(.footnote)
                                                 .foregroundColor(.secondary)
                                         }
@@ -103,7 +122,8 @@ extension Settings {
                                 }
                             }
                         }
-                    ).listRowBackground(Color.chart)
+                    )
+                    .listRowBackground(Color.chart)
 
                     SettingInputSection(
                         decimalValue: $decimalPlaceholder,

+ 11 - 5
Trio/Sources/Services/AppVersionChecker/AppVersionChecker.swift

@@ -81,8 +81,11 @@ final class AppVersionChecker {
                 if now.timeIntervalSince(lastShown) > 86400 { // 24 hours
                     self.showAlert(
                         on: vc,
-                        title: "Update Required",
-                        message: "The current version has a critical issue and should be updated as soon as possible."
+                        title: String(localized: "Update Required", comment: "Title for critical update alert"),
+                        message: String(
+                            localized: "The current version has a critical issue and should be updated as soon as possible.",
+                            comment: "Message for critical update alert"
+                        )
                     )
                     self.lastBlacklistNotificationShown = now
                     self.lastVersionUpdateNotificationShown = now
@@ -92,11 +95,14 @@ final class AppVersionChecker {
             else if isNewer {
                 let lastShown = self.lastVersionUpdateNotificationShown ?? .distantPast
                 if now.timeIntervalSince(lastShown) > 1_209_600 { // 2 weeks
-                    let versionText = latestVersion ?? "Unknown"
+                    let versionText = latestVersion ?? String(localized: "Unknown", comment: "Fallback text for unknown version")
                     self.showAlert(
                         on: vc,
-                        title: "Update Available",
-                        message: "A new version (\(versionText)) is available. It is recommended to update."
+                        title: String(localized: "Update Available", comment: "Title for update available alert"),
+                        message: String(
+                            localized: "A new version (\(versionText)) is available. It is recommended to update.",
+                            comment: "Message for update available alert"
+                        )
                     )
                     self.lastVersionUpdateNotificationShown = now
                 }