From ee9fbc4bb38688f5915ded845e6349eef8641b10 Mon Sep 17 00:00:00 2001 From: ThreeManager785 Date: Sat, 10 Feb 2024 00:41:00 +0800 Subject: [PATCH 1/4] Optimize localizable, added Sleep Time --- .../Bangumi/BangumiDetailView.swift | 2 +- DarockBili Watch App/DarockBiliApp.swift | 20 + .../Live/LiveDetailView.swift | 4 +- DarockBili Watch App/Others/AboutView.swift | 8 +- .../Others/SettingsView.swift | 95 +++- .../PersonalCenter/HistoryView.swift | 2 +- .../Video/VideoDetailView.swift | 2 +- .../Video/VideoDownloadView.swift | 2 +- Localizable.xcstrings | 455 +++++++++++++++++- 9 files changed, 559 insertions(+), 31 deletions(-) diff --git a/DarockBili Watch App/Bangumi/BangumiDetailView.swift b/DarockBili Watch App/Bangumi/BangumiDetailView.swift index 5dfd265f1..e58bd1c6d 100644 --- a/DarockBili Watch App/Bangumi/BangumiDetailView.swift +++ b/DarockBili Watch App/Bangumi/BangumiDetailView.swift @@ -188,7 +188,7 @@ struct BangumiDetailView: View { .tag(2) .navigationTitle("Bangumi.commnets") } - .navigationTitle("番剧") + .navigationTitle("Bangumi") .navigationBarTitleDisplayMode(.inline) .onAppear { let headers: HTTPHeaders = [ diff --git a/DarockBili Watch App/DarockBiliApp.swift b/DarockBili Watch App/DarockBiliApp.swift index 43b69d29a..3042e8380 100644 --- a/DarockBili Watch App/DarockBiliApp.swift +++ b/DarockBili Watch App/DarockBiliApp.swift @@ -106,6 +106,9 @@ struct DarockBili_Watch_AppApp: App { @WKApplicationDelegateAdaptor(AppDelegate.self) var appDelegate @Environment(\.scenePhase) var scenePhase // Screen Time + @AppStorage("isSleepNotificationOn") var isSleepNotificationOn = false + @AppStorage("notifyHour") var notifyHour = 0 + @AppStorage("notifyMinute") var notifyMinute = 0 @AppStorage("IsScreenTimeEnabled") var isScreenTimeEnabled = true @State var screenTimeCaculateTimer: Timer? = nil @State var isMemoryWarningPresented = false @@ -119,6 +122,8 @@ struct DarockBili_Watch_AppApp: App { @State var systemResourceRefreshTimer: Timer? @State var memoryUsage: Float = 0.0 @State var isShowMemoryUsage = false + @State var currentHour = 0 + @State var currentMinute = 0 var body: some Scene { WindowGroup { if UserDefaults.standard.string(forKey: "NewSignalError") ?? "" != "" { @@ -200,6 +205,21 @@ struct DarockBili_Watch_AppApp: App { timer.invalidate() } } + let timer = Timer(timeInterval: 1, repeats: true) { timer in + currentHour = getCurrentTime().hour + currentMinute = getCurrentTime().minute + } + let sleepTimeCheck = Timer(timeInterval: 60, repeats: true) { timer in + if currentHour == notifyHour && currentMinute == notifyMinute { + tipWithText(String(localized: "Sleep.notification"), symbol: "bed.double.fill") + } + } + RunLoop.current.add(timer, forMode: .default) + timer.fire() + if isSleepNotificationOn { + RunLoop.current.add(sleepTimeCheck, forMode: .default) + sleepTimeCheck.fire() + } } .overlay { VStack { diff --git a/DarockBili Watch App/Live/LiveDetailView.swift b/DarockBili Watch App/Live/LiveDetailView.swift index 85671e001..7ff58f7ac 100644 --- a/DarockBili Watch App/Live/LiveDetailView.swift +++ b/DarockBili Watch App/Live/LiveDetailView.swift @@ -116,7 +116,7 @@ struct LiveDetailView: View { .bold() } } - .navigationTitle("直播") + .navigationTitle("Live") .navigationBarTitleDisplayMode(.inline) .sheet(isPresented: $isLivePlayerPresented, content: {LivePlayerView()}) .onAppear { @@ -294,7 +294,7 @@ struct LiveDetailView: View { } HStack { Image(systemName: "clock") - Text("于 \(startTime) 开始") + Text("Live.starting.\(startTime)") Spacer() } .offset(y: publishTimeTextOffset) diff --git a/DarockBili Watch App/Others/AboutView.swift b/DarockBili Watch App/Others/AboutView.swift index 1f6bac16d..102c5dbb5 100644 --- a/DarockBili Watch App/Others/AboutView.swift +++ b/DarockBili Watch App/Others/AboutView.swift @@ -115,7 +115,7 @@ struct AboutCredits: View { if isGenshin { ZStack(alignment: .center) { Color.white - Text("原神") + Text("About.genshin") .font(.system(size: 30, weight: .heavy)) .foregroundColor(.black) .opacity(genshinOverlayTextOpacity) @@ -140,16 +140,16 @@ struct AboutCredits: View { @State var codeInput = "" var body: some View { VStack { - TextField("神秘代码", text: $codeInput) + TextField("About.mystery-code", text: $codeInput) Button(action: { if codeInput == "Genshin" { isGenshin = true dismiss() } else { - codeInput = "输入错误" + codeInput = String(localized: "About.mystery-code.error") } }, label: { - Text("确认") + Text("About.confirm") }) } } diff --git a/DarockBili Watch App/Others/SettingsView.swift b/DarockBili Watch App/Others/SettingsView.swift index f8be7f4e9..d054361da 100644 --- a/DarockBili Watch App/Others/SettingsView.swift +++ b/DarockBili Watch App/Others/SettingsView.swift @@ -91,6 +91,18 @@ struct SettingsView: View { Text("Settings.battery") } }) + NavigationLink(destination: {SleepTimeView().navigationTitle("Settings.sleep")}, label: { + HStack { + ZStack { + Color.cyan + .frame(width: 20, height: 20) + .clipShape(Circle()) + Image(systemName: "bed.double.fill") + .font(.system(size: 12)) + } + Text("Settings.sleep") + } + }) NavigationLink(destination: {FeedbackView().navigationTitle("Settings.feedback")}, label: { HStack { ZStack { @@ -368,20 +380,20 @@ struct ScreenTimeSettingsView: View { Button(role: .destructive, action: { isScreenTimeEnabled = false }, label: { - Text("关闭“屏幕使用时间”") + Text("Screen-time.off") }) } footer: { - Text("将不再记录您的屏幕使用时间, 已记录的数据不会被删除") + Text("Screen-time.description") } } else { Section { Button(action: { isScreenTimeEnabled = true }, label: { - Text("开启屏幕使用时间") + Text("Screen-time.on") }) } footer: { - Text("“屏幕使用时间”会记录您每天使用喵哩喵哩的时间并作出统计") + Text("Screen-time.usage") } } } @@ -454,6 +466,81 @@ struct BatterySettingsView: View { } } +struct SleepTimeView: View { + @AppStorage("isSleepNotificationOn") var isSleepNotificationOn = false + @AppStorage("notifyHour") var notifyHour = 0 + @AppStorage("notifyMinute") var notifyMinute = 0 + @State var currentHour = 0 + @State var currentMinute = 0 + @State var currentSecond = 0 + @State var isEditingTime = false + var body: some View { + List { + Section(content: { + Toggle(isOn: $isSleepNotificationOn, label: { + Text("Sleep") + }) + if isSleepNotificationOn { + Button(action: { + isEditingTime = true + }, label: { + Text("Sleep.edit.\(notifyHour<10 ? "0\(notifyHour)" : "\(notifyHour)").\(notifyMinute<10 ? "0\(notifyMinute)" : "\(notifyMinute)")") + }) + } + }, footer: { + Text("Sleep.discription") + }) + Section { + Text("Sleep.current.\(currentHour<10 ? "0\(currentHour)" : "\(currentHour)").\(currentMinute<10 ? "0\(currentMinute)" : "\(currentMinute)").\(currentSecond<10 ? "0\(currentSecond)" : "\(currentSecond)")") + } + } + .navigationTitle("Sleep") + .onAppear { + let timer = Timer(timeInterval: 0.5, repeats: true) { timer in + currentHour = getCurrentTime().hour + currentMinute = getCurrentTime().minute + currentSecond = getCurrentTime().second + } + RunLoop.current.add(timer, forMode: .default) + timer.fire() + } + .sheet(isPresented: $isEditingTime, content: { + VStack { + Text("Sleep.edit.title") + .bold() + HStack { + Picker("Sleep.edit.hour", selection: $notifyHour) { + ForEach(0..<24) { index in + Text("\(index<10 ? "0\(index)" : "\(index)")").tag(index) + } + } + Text(":") + Picker("Sleep.edit.minute", selection: $notifyMinute) { + ForEach(0..<60) { index in + Text("\(index<10 ? "0\(index)" : "\(index)")").tag(index) + } + } + } + } + }) + } +} + +struct Time { + var hour: Int + var minute: Int + var second: Int +} + +func getCurrentTime() -> Time { + let calendar = Calendar.current + let components = calendar.dateComponents([.hour, .minute, .second], from: Date()) + let currentTime = Time(hour: components.hour ?? 0, minute: components.minute ?? 0, second: components.second ?? 0) + return currentTime +} + + + struct DebugMenuView: View { var body: some View { List { diff --git a/DarockBili Watch App/PersonalCenter/HistoryView.swift b/DarockBili Watch App/PersonalCenter/HistoryView.swift index 168300b3f..0b5348aa5 100644 --- a/DarockBili Watch App/PersonalCenter/HistoryView.swift +++ b/DarockBili Watch App/PersonalCenter/HistoryView.swift @@ -73,7 +73,7 @@ struct HistoryView: View { HStack { Spacer(minLength: 0) Image(systemName: "xmark.bin.fill") - Text("这里空空如也") + Text("History.none") Spacer(minLength: 0) } .padding() diff --git a/DarockBili Watch App/Video/VideoDetailView.swift b/DarockBili Watch App/Video/VideoDetailView.swift index a672f1401..f7dc46827 100644 --- a/DarockBili Watch App/Video/VideoDetailView.swift +++ b/DarockBili Watch App/Video/VideoDetailView.swift @@ -290,7 +290,7 @@ struct VideoDetailView: View { } .accentColor(.white) .animation(.smooth, value: isLoading) - .navigationTitle("视频") + .navigationTitle("Video") .navigationBarTitleDisplayMode(.inline) .onAppear { let headers: HTTPHeaders = [ diff --git a/DarockBili Watch App/Video/VideoDownloadView.swift b/DarockBili Watch App/Video/VideoDownloadView.swift index 34bf3bcf0..ecb488881 100644 --- a/DarockBili Watch App/Video/VideoDownloadView.swift +++ b/DarockBili Watch App/Video/VideoDownloadView.swift @@ -51,7 +51,7 @@ struct VideoDownloadView: View { Section { NavigationLink(destination: {DownloadingListView()}, label: { HStack { - Text("视频下载列表") + Text("Download.title") Spacer() Image(systemName: "chevron.right") .opacity(0.65) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 5d6c221b9..574244e94 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -65,6 +65,22 @@ } } }, + ":" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : ":" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : ":" + } + } + } + }, ".%lld" : { "localizations" : { "en" : { @@ -161,6 +177,23 @@ } } }, + "%lld" : { + "extractionState" : "stale", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "%lld" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "%lld" + } + } + } + }, "%lld / %lld" : { "localizations" : { "en" : { @@ -257,6 +290,22 @@ } } }, + "About.confirm" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Confirm" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "确认" + } + } + } + }, "About.credits" : { "localizations" : { "en" : { @@ -273,6 +322,22 @@ } } }, + "About.genshin" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Genshin" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "原神" + } + } + } + }, "About.meowbili" : { "localizations" : { "en" : { @@ -289,6 +354,38 @@ } } }, + "About.mystery-code" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Mystery Code" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "神秘代码" + } + } + } + }, + "About.mystery-code.error" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Input Error" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "输入错误" + } + } + } + }, "About.open-source" : { "localizations" : { "en" : { @@ -665,6 +762,22 @@ } } }, + "Bangumi" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Bangumi" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "番剧" + } + } + } + }, "Bangumi.comments.select" : { "localizations" : { "en" : { @@ -1109,34 +1222,34 @@ } } }, - "Direct-message.failed" : { + "Dignite" : { "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "Failed Sending" + "value" : "" } }, "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "发送失败" + "value" : "Dignite" } } } }, - "Download.closing-in-3sec" : { + "Direct-message.failed" : { "localizations" : { "en" : { "stringUnit" : { "state" : "translated", - "value" : "Page Auto Closing in 3sec" + "value" : "Failed Sending" } }, "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "页面将于3秒后自动关闭" + "value" : "发送失败" } } } @@ -1269,6 +1382,22 @@ } } }, + "Download.title" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Download" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "视频下载列表" + } + } + } + }, "Error" : { "localizations" : { "en" : { @@ -1765,6 +1894,22 @@ } } }, + "History.none" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Nothing Here" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "这里空空如也" + } + } + } + }, "Home" : { "localizations" : { "en" : { @@ -1941,6 +2086,38 @@ } } }, + "Live" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Live" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "直播" + } + } + } + }, + "Live.starting.%@" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Started at %@" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "于 %@ 开始" + } + } + } + }, "Login.scan" : { "localizations" : { "en" : { @@ -2389,6 +2566,22 @@ } } }, + "Screen-time.description" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Screen Time will not be recorded any more and recorded datas will be cleared" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "将不再记录您的屏幕使用时间, 已记录的数据不会被删除" + } + } + } + }, "Screen-time.minutes.%lld" : { "localizations" : { "en" : { @@ -2417,6 +2610,54 @@ } } }, + "Screen-time.off" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Turn Off Screen Time" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "关闭“屏幕使用时间”" + } + } + } + }, + "Screen-time.on" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Turn One Screen Time" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "开启“屏幕使用时间”" + } + } + } + }, + "Screen-time.usage" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Screen Time will record and count the time you use MeowBili" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "“屏幕使用时间”会记录并统计您每天使用喵哩喵哩的时间" + } + } + } + }, "Search.%@" : { "localizations" : { "en" : { @@ -2529,6 +2770,22 @@ } } }, + "Search.type.live" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Lives" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "直播" + } + } + } + }, "Search.type.user" : { "localizations" : { "en" : { @@ -2785,6 +3042,22 @@ } } }, + "Settings.sleep" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Sleep" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "睡眠" + } + } + } + }, "Settings.update" : { "localizations" : { "en" : { @@ -2913,6 +3186,134 @@ } } }, + "Sleep" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Sleep Time" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "睡眠时间" + } + } + } + }, + "Sleep.current.%@.%@.%@" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "needs_review", + "value" : "It's %1$@:%2$@:%3$@ now" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "现在是%1$@:%2$@:%3$@" + } + } + } + }, + "Sleep.discription" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Sleep Time will notify you too sleep at a specific time" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "“睡眠时间”可以在特定时间内提醒您睡觉" + } + } + } + }, + "Sleep.edit.%@.%@" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Edit Sleep Time %1$@:%2$@" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "编辑睡眠时间 %1$@:%2$@" + } + } + } + }, + "Sleep.edit.hour" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "HOUR" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "小时" + } + } + } + }, + "Sleep.edit.minute" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "MINUTE" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "分钟" + } + } + } + }, + "Sleep.edit.title" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Edit Sleep Time" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "编辑睡眠时间" + } + } + } + }, + "Sleep.notification" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Time to Sleep!" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "该睡觉啦!" + } + } + } + }, "ThreeManager785" : { "localizations" : { "en" : { @@ -3867,12 +4268,28 @@ }, "zh-Hans" : { "stringUnit" : { - "state" : "new", + "state" : "translated", "value" : "v%1$@ Build %2$@" } } } }, + "Video" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Video" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "视频" + } + } + } + }, "Video.action.canceled" : { "localizations" : { "en" : { @@ -4258,10 +4675,20 @@ } }, "令枫" : { - - }, - "原神" : { - + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "令枫" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "令枫" + } + } + } }, "在使用本 App 前,您需要先知晓以下信息:\n· 本 App 由第三方开发者以及部分社区用户贡献,与哔哩哔哩无合作关系,哔哩哔哩是上海宽娱数码科技有限公司的商标。\n· 本 App 并不是哔哩哔哩的替代品,我们建议您在能够使用官方客户端时尽量使用官方客户端。\n· 本 App 均使用来源于网络的公开信息进行开发。\n· 本 App 中和B站相关的功能完全免费\n· 本 App 中所呈现的B站内容来自哔哩哔哩官方。\n· 本 App 的开发者、负责人和实际责任人是%@\n 联系QQ:3245146430" : { "localizations" : { @@ -4278,12 +4705,6 @@ } } } - }, - "确认" : { - - }, - "神秘代码" : { - } }, "version" : "1.0" From 914a2244d5d50325084ee8e378b37073a36911ae Mon Sep 17 00:00:00 2001 From: ThreeManager785 Date: Sat, 10 Feb 2024 00:58:19 +0800 Subject: [PATCH 2/4] fixed potential bug --- DarockBili Watch App/DarockBiliApp.swift | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/DarockBili Watch App/DarockBiliApp.swift b/DarockBili Watch App/DarockBiliApp.swift index 3042e8380..0510dba34 100644 --- a/DarockBili Watch App/DarockBiliApp.swift +++ b/DarockBili Watch App/DarockBiliApp.swift @@ -210,16 +210,14 @@ struct DarockBili_Watch_AppApp: App { currentMinute = getCurrentTime().minute } let sleepTimeCheck = Timer(timeInterval: 60, repeats: true) { timer in - if currentHour == notifyHour && currentMinute == notifyMinute { + if currentHour == notifyHour && currentMinute == notifyMinute && isSleepNotificationOn { tipWithText(String(localized: "Sleep.notification"), symbol: "bed.double.fill") } } RunLoop.current.add(timer, forMode: .default) timer.fire() - if isSleepNotificationOn { RunLoop.current.add(sleepTimeCheck, forMode: .default) sleepTimeCheck.fire() - } } .overlay { VStack { From e677ff8dfa915c44202e1eb9ab980842d33e6fc3 Mon Sep 17 00:00:00 2001 From: ThreeManager785 Date: Sat, 10 Feb 2024 13:19:28 +0800 Subject: [PATCH 3/4] Fixed Capitalization --- Localizable.xcstrings | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 574244e94..148184a32 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -178,21 +178,7 @@ } }, "%lld" : { - "extractionState" : "stale", - "localizations" : { - "en" : { - "stringUnit" : { - "state" : "translated", - "value" : "%lld" - } - }, - "zh-Hans" : { - "stringUnit" : { - "state" : "translated", - "value" : "%lld" - } - } - } + "extractionState" : "stale" }, "%lld / %lld" : { "localizations" : { @@ -2123,7 +2109,7 @@ "en" : { "stringUnit" : { "state" : "translated", - "value" : "Scan to continue" + "value" : "Scan to Continue" } }, "zh-Hans" : { From 670fe5390a5362b35c7f443b42aff9fbe92a76b9 Mon Sep 17 00:00:00 2001 From: ThreeManager785 Date: Sun, 11 Feb 2024 01:39:09 +0800 Subject: [PATCH 4/4] Optimizes Localization --- DarockBili Watch App/Others/AboutView.swift | 2 +- .../PersonalCenter/UserDetailView.swift | 12 +++++++++--- Localizable.xcstrings | 9 +++------ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/DarockBili Watch App/Others/AboutView.swift b/DarockBili Watch App/Others/AboutView.swift index 102c5dbb5..aaecace0a 100644 --- a/DarockBili Watch App/Others/AboutView.swift +++ b/DarockBili Watch App/Others/AboutView.swift @@ -142,7 +142,7 @@ struct AboutCredits: View { VStack { TextField("About.mystery-code", text: $codeInput) Button(action: { - if codeInput == "Genshin" { + if codeInput.lowercased().contains("genshin") { isGenshin = true dismiss() } else { diff --git a/DarockBili Watch App/PersonalCenter/UserDetailView.swift b/DarockBili Watch App/PersonalCenter/UserDetailView.swift index 58c139d9a..2b9437acb 100644 --- a/DarockBili Watch App/PersonalCenter/UserDetailView.swift +++ b/DarockBili Watch App/PersonalCenter/UserDetailView.swift @@ -332,9 +332,15 @@ struct UserDetailView: View { } if !vipLabel.isEmpty { HStack { - WebImage(url: URL(string: "https://s1.hdslb.com/bfs/seed/jinkela/short/user-avatar/big-vip.svg")) - .resizable() - .frame(width: 20, height: 20) + if true { + WebImage(url: URL(string: "https://s1.hdslb.com/bfs/seed/jinkela/short/user-avatar/big-vip.svg")) + .resizable() + .frame(width: 20, height: 20) + } else { + Image(systemName: "dollarsign.circle") + .foregroundColor(Color(red: 236/255, green: 99/255, blue: 141/255)) + .frame(width: 20, height: 20) + } Text(vipLabel) .font(.system(size: 15)) .bold() diff --git a/Localizable.xcstrings b/Localizable.xcstrings index 148184a32..8adb767d0 100644 --- a/Localizable.xcstrings +++ b/Localizable.xcstrings @@ -177,9 +177,6 @@ } } }, - "%lld" : { - "extractionState" : "stale" - }, "%lld / %lld" : { "localizations" : { "en" : { @@ -2681,7 +2678,7 @@ "en" : { "stringUnit" : { "state" : "translated", - "value" : "Histories" + "value" : "History" } }, "zh-Hans" : { @@ -3192,7 +3189,7 @@ "localizations" : { "en" : { "stringUnit" : { - "state" : "needs_review", + "state" : "translated", "value" : "It's %1$@:%2$@:%3$@ now" } }, @@ -4089,7 +4086,7 @@ "en" : { "stringUnit" : { "state" : "translated", - "value" : "Histories" + "value" : "History" } }, "zh-Hans" : {