修改本地化方法

This commit is contained in:
Fin 2025-09-05 11:47:32 +08:00
parent 91bc905628
commit 1e340c6578
36 changed files with 247 additions and 334 deletions

View File

@ -104,7 +104,6 @@
066E0C8C2BB6AC9A00873838 /* AddSoundCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 066E0C8B2BB6AC9A00873838 /* AddSoundCell.swift */; };
0672CB06256903F700570C9D /* MessageListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0672CB05256903F700570C9D /* MessageListViewModel.swift */; };
06787C392A710568008ABDD7 /* GesturePassTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06787C382A710568008ABDD7 /* GesturePassTextView.swift */; };
06787C3B2AB82BDB008ABDD7 /* CrashReportViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06787C3A2AB82BDB008ABDD7 /* CrashReportViewController.swift */; };
067AFB1C2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067AFB1B2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift */; };
067AFB1D2E5D8BED00AE78E7 /* UNNotificationContent+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067AFB1B2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift */; };
067B2EB525693E38008B6BE1 /* MessageSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 067B2EB425693E38008B6BE1 /* MessageSection.swift */; };
@ -119,6 +118,8 @@
068EC15827ED99C900D5D11E /* ServerListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 068EC15727ED99C900D5D11E /* ServerListViewController.swift */; };
068EC15A27ED99E700D5D11E /* ServerListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 068EC15927ED99E700D5D11E /* ServerListViewModel.swift */; };
068F66B3247BD84C00DAD25A /* MessageListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 068F66B2247BD84C00DAD25A /* MessageListViewController.swift */; };
069332222E6A8E3100F9387F /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0603706A20E20A7C00F4CA05 /* String+Extension.swift */; };
069332232E6A8E3100F9387F /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0603706A20E20A7C00F4CA05 /* String+Extension.swift */; };
0699473D2D223094008D5E40 /* CustomTapTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0699473C2D223094008D5E40 /* CustomTapTextView.swift */; };
06B1158D247BA6D5006D91FB /* CloudKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 06B1158C247BA6D5006D91FB /* CloudKit.framework */; };
06B1158F247BB1FB006D91FB /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06B1158E247BB1FB006D91FB /* Message.swift */; };
@ -199,8 +200,6 @@
06F08EA529B1DDA7006AB9CA /* Algorithm.swift in Sources */ = {isa = PBXBuildFile; fileRef = 061894C629A75BEA00E001C2 /* Algorithm.swift */; };
06F08EA729B1DDFE006AB9CA /* Error+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F08EA629B1DDFE006AB9CA /* Error+Extension.swift */; };
06F08EA829B1DE0A006AB9CA /* Error+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F08EA629B1DDFE006AB9CA /* Error+Extension.swift */; };
06F08EAC29B1DECD006AB9CA /* NSLocalizedString+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F08EAB29B1DECD006AB9CA /* NSLocalizedString+Extension.swift */; };
06F08EAD29B1DED6006AB9CA /* NSLocalizedString+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F08EAB29B1DECD006AB9CA /* NSLocalizedString+Extension.swift */; };
06F08EAF29B5D9FF006AB9CA /* HUD.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F08EAE29B5D9FF006AB9CA /* HUD.swift */; };
06F11E7727D9D5FB00F00298 /* QRScannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06F11E7627D9D5FB00F00298 /* QRScannerViewController.swift */; };
06FB04042C53575400F3A213 /* SharedDefines.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06FB04032C53575400F3A213 /* SharedDefines.swift */; };
@ -351,7 +350,6 @@
066E0C8B2BB6AC9A00873838 /* AddSoundCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddSoundCell.swift; sourceTree = "<group>"; };
0672CB05256903F700570C9D /* MessageListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageListViewModel.swift; sourceTree = "<group>"; };
06787C382A710568008ABDD7 /* GesturePassTextView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GesturePassTextView.swift; sourceTree = "<group>"; };
06787C3A2AB82BDB008ABDD7 /* CrashReportViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrashReportViewController.swift; sourceTree = "<group>"; };
067AFB1B2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "UNNotificationContent+Extension.swift"; path = "notificationContentExtension/UNNotificationContent+Extension.swift"; sourceTree = SOURCE_ROOT; };
067B2EB425693E38008B6BE1 /* MessageSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageSection.swift; sourceTree = "<group>"; };
0683486A2050F1310024B6DA /* Bark.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Bark.entitlements; sourceTree = "<group>"; };
@ -411,7 +409,6 @@
06EF49182D682B34008B91D2 /* PushToOtherIntent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PushToOtherIntent.swift; sourceTree = "<group>"; };
06F08EA329B098DD006AB9CA /* CryptoSettingManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CryptoSettingManager.swift; sourceTree = "<group>"; };
06F08EA629B1DDFE006AB9CA /* Error+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Error+Extension.swift"; sourceTree = "<group>"; };
06F08EAB29B1DECD006AB9CA /* NSLocalizedString+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSLocalizedString+Extension.swift"; sourceTree = "<group>"; };
06F08EAE29B5D9FF006AB9CA /* HUD.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUD.swift; sourceTree = "<group>"; };
06F11E7627D9D5FB00F00298 /* QRScannerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRScannerViewController.swift; sourceTree = "<group>"; };
06FB04032C53575400F3A213 /* SharedDefines.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharedDefines.swift; sourceTree = "<group>"; };
@ -492,7 +489,6 @@
068EC15927ED99E700D5D11E /* ServerListViewModel.swift */,
06EEF332291CCFF400CA228A /* CryptoSettingController.swift */,
06EEF334291CD00000CA228A /* CryptoSettingViewModel.swift */,
06787C3A2AB82BDB008ABDD7 /* CrashReportViewController.swift */,
1E73F99D2C282822002BF649 /* SectionViewController-iPad.swift */,
1EFB545E2C32514000B8E51B /* SectionViewModel-iPad.swift */,
1EFB545C2C314A6800B8E51B /* BarkSplitViewController.swift */,
@ -625,7 +621,6 @@
06F08EA329B098DD006AB9CA /* CryptoSettingManager.swift */,
0653677729B727A60038BDB8 /* CryptoSettingRelay.swift */,
06F08EA629B1DDFE006AB9CA /* Error+Extension.swift */,
06F08EAB29B1DECD006AB9CA /* NSLocalizedString+Extension.swift */,
06E944742C07012E00AC86AB /* RealmConfiguration.swift */,
0687F2A72CCB791A00B2A52F /* UIFont+Extension.swift */,
06BCAE552CDB19260092867A /* GroupMuteSettingManager.swift */,
@ -1232,6 +1227,7 @@
067AFB1C2E5D8BE300AE78E7 /* UNNotificationContent+Extension.swift in Sources */,
0687F2AA2CCB7FA500B2A52F /* UIFont+Extension.swift in Sources */,
0632CE2320EC9098003FDF46 /* NotificationViewController.swift in Sources */,
069332222E6A8E3100F9387F /* String+Extension.swift in Sources */,
06BCAE572CDB19420092867A /* GroupMuteSettingManager.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -1298,7 +1294,6 @@
06E944762C07013000AC86AB /* RealmConfiguration.swift in Sources */,
06EF49152D682A99008B91D2 /* PushResponse.swift in Sources */,
0603706720E1E31600F4CA05 /* Defines.swift in Sources */,
06787C3B2AB82BDB008ABDD7 /* CrashReportViewController.swift in Sources */,
064CAB9E256BE9090018155C /* PreviewCardCellViewModel.swift in Sources */,
065BE4552565055F002A8CA4 /* HomeViewModel.swift in Sources */,
062B98C3251B2762004562E7 /* BKButton.swift in Sources */,
@ -1333,7 +1328,6 @@
06EF49172D682AC4008B91D2 /* OptionsProvider.swift in Sources */,
06F08EAF29B5D9FF006AB9CA /* HUD.swift in Sources */,
065AE76B2987777F00323230 /* ArchiveSettingRelay.swift in Sources */,
06F08EAC29B1DECD006AB9CA /* NSLocalizedString+Extension.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1346,7 +1340,6 @@
06E9447A2C0704E500AC86AB /* ImageDownloader.swift in Sources */,
06CF784C21C7A51200A052D7 /* NotificationService.swift in Sources */,
06FB04052C53575400F3A213 /* SharedDefines.swift in Sources */,
06F08EAD29B1DED6006AB9CA /* NSLocalizedString+Extension.swift in Sources */,
067AFB1D2E5D8BED00AE78E7 /* UNNotificationContent+Extension.swift in Sources */,
0653677629B719BC0038BDB8 /* CryptoSettingManager.swift in Sources */,
06E9446F2C06FF1E00AC86AB /* BadgeProcessor.swift in Sources */,
@ -1357,6 +1350,7 @@
06F08EA529B1DDA7006AB9CA /* Algorithm.swift in Sources */,
06E944782C0701F300AC86AB /* IconProcessor.swift in Sources */,
06BBB89125650CCF0076F63E /* ArchiveSettingManager.swift in Sources */,
069332232E6A8E3100F9387F /* String+Extension.swift in Sources */,
06D69E412C11983E00161A35 /* CallProcessor.swift in Sources */,
06B11591247BC132006D91FB /* Message.swift in Sources */,
06E9447C2C07052F00AC86AB /* ImageProcessor.swift in Sources */,

View File

@ -53,10 +53,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
UNUserNotificationCenter.current().delegate = self
var actions = [
UNNotificationAction(identifier: "copy", title: NSLocalizedString("Copy2"), options: UNNotificationActionOptions.foreground)
UNNotificationAction(identifier: "copy", title: "Copy2".localized, options: UNNotificationActionOptions.foreground)
]
if #available(iOSApplicationExtension 15.0, *) {
actions.append(UNNotificationAction(identifier: "mute", title: NSLocalizedString("muteGroup1Hour"), options: UNNotificationActionOptions.foreground))
actions.append(UNNotificationAction(identifier: "mute", title: "muteGroup1Hour".localized, options: UNNotificationActionOptions.foreground))
}
UNUserNotificationCenter.current().setNotificationCategories([
// customDismissAction clear APP便 DeviceToken
@ -171,7 +171,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
ServerManager.shared.addServer(server: server)
ServerManager.shared.setCurrentServer(serverId: server.id)
ServerManager.shared.syncAllServers()
HUDSuccess(NSLocalizedString("AddedSuccessfully"))
HUDSuccess("AddedSuccessfully".localized)
}
return true
}
@ -188,14 +188,14 @@ extension AppDelegate {
let url = try? (userInfo["url"] as? String)?.asURL()
let alertController = UIAlertController(title: title, message: body, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: NSLocalizedString("CopyContent"), style: .default, handler: { _ in
alertController.addAction(UIAlertAction(title: "CopyContent".localized, style: .default, handler: { _ in
if let copy = userInfo["copy"] as? String {
UIPasteboard.general.string = copy
} else {
UIPasteboard.general.string = body
}
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("MoreActions"), style: .default, handler: { _ in
alertController.addAction(UIAlertAction(title: "MoreActions".localized, style: .default, handler: { _ in
var shareContent = ""
if let title = title {
shareContent += "\(title)\n"
@ -226,7 +226,7 @@ extension AppDelegate {
}
controller?.present(activityController, animated: true, completion: nil)
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
let viewController = Client.shared.currentSnackbarController

View File

@ -814,6 +814,7 @@
}
},
"Copy" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {

View File

@ -33,14 +33,14 @@ extension Date {
}
if hour > 0 {
if minute > 0 {
return String(format: NSLocalizedString("timeMinHourAgo"), hour, minute)
return "timeMinHourAgo".localized(with: hour, minute)
}
return String(format: NSLocalizedString("timeHourAgo"), hour)
return "timeHourAgo".localized(with: hour)
}
if minute > 1 {
return String(format: NSLocalizedString("timeMinAgo"), minute)
return "timeMinAgo".localized(with: minute)
}
return NSLocalizedString("timeJustNow")
return "timeJustNow".localized
}
}

View File

@ -1,13 +0,0 @@
//
// NSLocalizedString+Extension.swift
// Bark
//
// Created by huangfeng on 2023/3/3.
// Copyright © 2023 Fin. All rights reserved.
//
import Foundation
func NSLocalizedString(_ key: String) -> String {
return NSLocalizedString(key, comment: "")
}

View File

@ -53,3 +53,13 @@ extension String {
return String(format: self, arguments)
}
}
extension String {
var localized: String {
return NSLocalizedString(self, comment: "")
}
func localized(with arguments: CVarArg...) -> String {
return String(format: NSLocalizedString(self, comment: ""), arguments: arguments)
}
}

View File

@ -20,9 +20,9 @@ class BarkTabBarController: StateStorageTabBarController {
BarkNavigationController(rootViewController: MessageSettingsViewController(viewModel: MessageSettingsViewModel()))
]
let tabBarItems = [UITabBarItem(title: NSLocalizedString("service"), image: UIImage(named: "baseline_gite_black_24pt"), tag: 0),
UITabBarItem(title: NSLocalizedString("historyMessage"), image: Icon.history, tag: 1),
UITabBarItem(title: NSLocalizedString("settings"), image: UIImage(named: "baseline_manage_accounts_black_24pt"), tag: 2)]
let tabBarItems = [UITabBarItem(title: "service".localized, image: UIImage(named: "baseline_gite_black_24pt"), tag: 0),
UITabBarItem(title: "historyMessage".localized, image: Icon.history, tag: 1),
UITabBarItem(title: "settings".localized, image: UIImage(named: "baseline_manage_accounts_black_24pt"), tag: 2)]
for (index, viewController) in self.viewControllers!.enumerated() {
viewController.tabBarItem = tabBarItems[index]
}

View File

@ -1,76 +0,0 @@
//
// CrashReportViewController.swift
// Bark
//
// Created by huangfeng on 2023/9/18.
// Copyright © 2023 Fin. All rights reserved.
//
import UIKit
class CrashReportViewController: UIViewController {
var crashLog = ""
override func viewDidLoad() {
super.viewDidLoad()
self.overrideUserInterfaceStyle = .light
self.view.backgroundColor = UIColor.white
let warningIcon = UIImageView(image: UIImage(named: "warning"))
self.view.addSubview(warningIcon)
let crashedTitle = UILabel()
crashedTitle.text = NSLocalizedString("crashed")
crashedTitle.font = UIFont.preferredFont(ofSize: 30, weight: .bold)
crashedTitle.adjustsFontForContentSizeCategory = true
crashedTitle.textColor = UIColor(r255: 239, g255: 77, b255: 77)
self.view.addSubview(crashedTitle)
let contentlabel = UITextView()
contentlabel.backgroundColor = UIColor.clear
contentlabel.isEditable = false
contentlabel.dataDetectorTypes = [.link]
contentlabel.isScrollEnabled = false
contentlabel.textContainerInset = .zero
contentlabel.textContainer.lineFragmentPadding = 0
contentlabel.font = UIFont.preferredFont(ofSize: 14)
contentlabel.adjustsFontForContentSizeCategory = true
contentlabel.textColor = UIColor(r255: 51, g255: 51, b255: 51)
contentlabel.text = NSLocalizedString("crashContent")
self.view.addSubview(contentlabel)
let copyButton = UIButton()
copyButton.titleLabel?.font = UIFont.preferredFont(ofSize: 16, weight: .bold)
copyButton.titleLabel?.adjustsFontForContentSizeCategory = true
copyButton.setTitleColor(UIColor.white, for: .normal)
copyButton.setTitle(NSLocalizedString("copyCrashLog"), for: .normal)
copyButton.backgroundColor = UIColor(r255: 239, g255: 77, b255: 77)
copyButton.clipsToBounds = true
copyButton.layer.cornerRadius = 6
self.view.addSubview(copyButton)
warningIcon.snp.makeConstraints { make in
make.top.equalTo(kSafeAreaInsets.top + 60)
make.left.equalTo(15)
make.width.height.equalTo(42)
}
crashedTitle.snp.makeConstraints { make in
make.left.equalTo(warningIcon.snp.right).offset(10)
make.centerY.equalTo(warningIcon)
}
contentlabel.snp.makeConstraints { make in
make.left.equalTo(20)
make.right.equalTo(-20)
make.top.equalTo(warningIcon.snp.bottom).offset(40)
}
copyButton.snp.makeConstraints { make in
make.left.right.equalTo(contentlabel)
make.top.equalTo(contentlabel.snp.bottom).offset(40)
make.height.equalTo(44)
}
copyButton.rx.tap.subscribe { [weak self] _ in
UIPasteboard.general.string = self?.crashLog
ProgressHUD.inform(NSLocalizedString("Copy"))
}.disposed(by: rx.disposeBag)
}
}

View File

@ -18,7 +18,7 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
let textField = BorderTextField(title: "Key")
textField.font = UIFont.preferredFont(ofSize: 14)
textField.adjustsFontForContentSizeCategory = true
textField.placeholder = String(format: NSLocalizedString("enterKey"), 16)
textField.placeholder = "enterKey".localized(with: 16)
return textField
}()
@ -31,7 +31,7 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
let doneButton: BKButton = {
let btn = BKButton()
btn.setTitle(NSLocalizedString("done"), for: .normal)
btn.setTitle("done".localized, for: .normal)
btn.setTitleColor(BKColor.lightBlue.darken3, for: .normal)
btn.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
btn.fontSize = 14
@ -40,7 +40,7 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
let copyButton: UIButton = {
let btn = GradientButton()
btn.setTitle(NSLocalizedString("copyExample"), for: .normal)
btn.setTitle("copyExample".localized, for: .normal)
btn.setTitleColor(UIColor.white, for: .normal)
btn.titleLabel?.font = UIFont.preferredFont(ofSize: 14, weight: .medium)
btn.titleLabel?.adjustsFontForContentSizeCategory = true
@ -62,7 +62,7 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
}
override func makeUI() {
self.title = NSLocalizedString("encryptionSettings")
self.title = "encryptionSettings".localized
self.navigationItem.setRightBarButtonItem(item: UIBarButtonItem(customView: doneButton))
self.view.addSubview(scrollView)
@ -79,8 +79,8 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
return label
}
let algorithmLabel = getTitleLabel(title: NSLocalizedString("algorithm"))
let modeLabel = getTitleLabel(title: NSLocalizedString("mode"))
let algorithmLabel = getTitleLabel(title: "algorithm".localized)
let modeLabel = getTitleLabel(title: "mode".localized)
let paddingLabel = getTitleLabel(title: "Padding")
let keyLabel = getTitleLabel(title: "Key")
let ivLabel = getTitleLabel(title: "Iv")
@ -226,7 +226,7 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
.disposed(by: rx.disposeBag)
output.keyLengthChanged.drive(onNext: { [weak self] keyLength in
self?.keyTextField.placeholder = String(format: NSLocalizedString("enterKey"), keyLength)
self?.keyTextField.placeholder = "enterKey".localized(with: keyLength)
}).disposed(by: rx.disposeBag)
self.modeFeild
@ -246,7 +246,7 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
output.copy.drive(onNext: { text in
UIPasteboard.general.string = text
HUDSuccess(NSLocalizedString("Copy"))
HUDSuccess("Copy".localized)
}).disposed(by: rx.disposeBag)
}
@ -255,7 +255,7 @@ class CryptoSettingController: BaseViewController<CryptoSettingViewModel> {
return
}
if let length = ["CBC": 16, "GCM": 12][mode] {
self.ivTextField.placeholder = String(format: NSLocalizedString("enterIv"), length)
self.ivTextField.placeholder = "enterIv".localized(with: length)
} else {
self.ivTextField.placeholder = ""
}

View File

@ -96,7 +96,7 @@ class CryptoSettingViewModel: ViewModel, ViewModelType {
let copy = Driver.combineLatest(copyScript, dependencies.deviceKey, dependencies.serverAddress)
.compactMap { fields, deviceKey, serverAddress -> String? in
guard fields.mode != "GCM" else {
showSnackbar.accept(NSLocalizedString("gcmNotSupported"))
showSnackbar.accept("gcmNotSupported".localized)
return nil
}
let key = fields.key ?? ""
@ -105,7 +105,7 @@ class CryptoSettingViewModel: ViewModel, ViewModelType {
"""
#!/usr/bin/env bash
# Documentation: \(NSLocalizedString("encryptionUrl"))
# Documentation: \("encryptionUrl".localized)
set -e
@ -114,22 +114,22 @@ class CryptoSettingViewModel: ViewModel, ViewModelType {
# push payload
json='{"body": "test", "sound": "birdsong"}'
# \(String(format: NSLocalizedString("keyComment"), Int(fields.algorithm.suffix(3))! / 8))
# \("keyComment".localized(with: Int(fields.algorithm.suffix(3))! / 8)) )
key='\(key)'
# \(NSLocalizedString("ivComment"))
# \("ivComment".localized)
iv='\(iv)'
# \(NSLocalizedString("opensslEncodingComment"))
# \("opensslEncodingComment".localized)
key=$(printf $key | xxd -ps -c 200)
iv=$(printf $iv | xxd -ps -c 200)
# \(NSLocalizedString("base64Notice"))
# \("base64Notice".localized)
ciphertext=$(echo -n $json | openssl enc -aes-\(fields.algorithm.suffix(3))-\(fields.mode.lowercased()) -K $key \(iv.count > 0 ? "-iv $iv " : "")| base64)
# \(NSLocalizedString("consoleComment")) "\((try? AESCryptoModel(cryptoFields: fields).encrypt(text: "{\"body\": \"test\", \"sound\": \"birdsong\"}")) ?? "")"
# \("consoleComment".localized) "\((try? AESCryptoModel(cryptoFields: fields).encrypt(text: "{\"body\": \"test\", \"sound\": \"birdsong\"}")) ?? "")"
echo $ciphertext
# \(NSLocalizedString("ciphertextComment"))
# \("ciphertextComment".localized)
curl --data-urlencode "ciphertext=$ciphertext"\(iv.count == 0 ? "" : " --data-urlencode \"iv=\(iv)\"") \(serverAddress)/$deviceKey
"""
}

View File

@ -1,5 +1,5 @@
//
// ViewController.swift
// HomeViewController.swift
// Bark
//
// Created by huangfeng on 2018/3/7.
@ -19,7 +19,7 @@ class HomeViewController: BaseViewController<HomeViewModel> {
btn.setImage(Icon.add, for: .normal)
btn.imageView?.tintColor = BKColor.grey.darken4
btn.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
btn.accessibilityIdentifier = NSLocalizedString("AddServer")
btn.accessibilityIdentifier = "AddServer".localized
return btn
}()
@ -28,12 +28,12 @@ class HomeViewController: BaseViewController<HomeViewModel> {
btn.setImage(UIImage(named: "baseline_filter_drama_black_24pt"), for: .normal)
btn.imageView?.tintColor = BKColor.grey.darken4
btn.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
btn.accessibilityIdentifier = NSLocalizedString("serverList")
btn.accessibilityIdentifier = "serverList".localized
return btn
}()
let startButton: FABButton = {
let button = FABButton(title: NSLocalizedString("RegisterDevice"))
let button = FABButton(title: "RegisterDevice".localized)
button.backgroundColor = BKColor.grey.lighten5
button.transition([.scale(0.75), .opacity(0)])
return button
@ -184,7 +184,7 @@ class HomeViewController: BaseViewController<HomeViewModel> {
output.copy
.drive(onNext: { [weak self] text in
UIPasteboard.general.string = text
self?.showSnackbar(text: NSLocalizedString("Copy"))
self?.showSnackbar(text: "Copy".localized)
})
.disposed(by: rx.disposeBag)
@ -228,14 +228,14 @@ class HomeViewController: BaseViewController<HomeViewModel> {
}
func alertServerError(error: String) {
let alertController = UIAlertController(title: NSLocalizedString("ServerError"), message: error, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: NSLocalizedString("faq"), style: .default, handler: { [weak self] _ in
guard let url = try? NSLocalizedString("faqUrl").asURL() else {
let alertController = UIAlertController(title: "ServerError".localized, message: error, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "faq".localized, style: .default, handler: { [weak self] _ in
guard let url = try? "faqUrl".localized.asURL() else {
return
}
self?.navigationController?.present(BarkSFSafariViewController(url: url), animated: true, completion: nil)
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
self.present(alertController, animated: true, completion: nil)
}
}

View File

@ -42,85 +42,85 @@ class HomeViewModel: ViewModel, ViewModelType {
let previews: [PreviewModel] = [
PreviewModel(
body: NSLocalizedString("CustomedNotificationContent"),
notice: NSLocalizedString("Notice1")
body: "CustomedNotificationContent".localized,
notice: "Notice1".localized
),
PreviewModel(
title: NSLocalizedString("CustomedNotificationTitle"),
body: NSLocalizedString("CustomedNotificationContent"),
notice: NSLocalizedString("Notice2")
title: "CustomedNotificationTitle".localized,
body: "CustomedNotificationContent".localized,
notice: "Notice2".localized
),
PreviewModel(
body: NSLocalizedString("notificationSound"),
notice: NSLocalizedString("setSounds"),
body: "notificationSound".localized,
notice: "setSounds".localized,
queryParameter: "sound=minuet",
moreInfo: NSLocalizedString("viewAllSounds"),
moreInfo: "viewAllSounds".localized,
moreViewModel: SoundsViewModel()
),
PreviewModel(
body: NSLocalizedString("ringtone"),
notice: NSLocalizedString("ringtoneNotice"),
body: "ringtone".localized,
notice: "ringtoneNotice".localized,
queryParameter: "call=1"
),
PreviewModel(
body: NSLocalizedString("archiveNotificationMessageTitle"),
notice: NSLocalizedString("archiveNotificationMessage"),
body: "archiveNotificationMessageTitle".localized,
notice: "archiveNotificationMessage".localized,
queryParameter: "isArchive=1"
),
PreviewModel(
body: NSLocalizedString("notificationIcon"),
notice: NSLocalizedString("notificationIconNotice"),
body: "notificationIcon".localized,
notice: "notificationIconNotice".localized,
queryParameter: "icon=https://day.app/assets/images/avatar.jpg",
image: UIImage(named: "icon")
),
PreviewModel(
body: NSLocalizedString("messageGroup"),
notice: NSLocalizedString("groupMessagesNotice"),
body: "messageGroup".localized,
notice: "groupMessagesNotice".localized,
queryParameter: "group=groupName",
image: UIImage(named: "group")
),
PreviewModel(
body: NSLocalizedString("pushNotificationEncryption"),
notice: NSLocalizedString("encryptionNotice"),
body: "pushNotificationEncryption".localized,
notice: "encryptionNotice".localized,
queryParameter: "ciphertext=ciphertext",
moreInfo: NSLocalizedString("encryptionSettings"),
moreInfo: "encryptionSettings".localized,
moreViewModel: CryptoSettingViewModel()
),
PreviewModel(
body: NSLocalizedString("criticalAlert"),
notice: NSLocalizedString("criticalAlertNotice"),
body: "criticalAlert".localized,
notice: "criticalAlertNotice".localized,
queryParameter: "level=critical&volume=5",
image: UIImage(named: "criticalAlert")
),
PreviewModel(
body: NSLocalizedString("interruptionLevel"),
notice: NSLocalizedString("interruptionLevelNotice"),
body: "interruptionLevel".localized,
notice: "interruptionLevelNotice".localized,
queryParameter: "level=timeSensitive"
),
PreviewModel(
body: "URL Test",
notice: NSLocalizedString("urlParameter"),
notice: "urlParameter".localized,
queryParameter: "url=https://www.baidu.com"
),
PreviewModel(
body: NSLocalizedString("imagePushNotification"),
notice: NSLocalizedString("imageParameter"),
body: "imagePushNotification".localized,
notice: "imageParameter".localized,
queryParameter: "image=https://day.app/assets/images/avatar.jpg"
),
PreviewModel(
body: "Copy Test",
notice: NSLocalizedString("copyParameter"),
notice: "copyParameter".localized,
queryParameter: "copy=test",
image: UIImage(named: "copyTest")
),
PreviewModel(
body: NSLocalizedString("badge"),
notice: NSLocalizedString("badgeNotice"),
body: "badge".localized,
notice: "badgeNotice".localized,
queryParameter: "badge=1"
),
PreviewModel(
body: NSLocalizedString("automaticallyCopyTitle"),
notice: NSLocalizedString("automaticallyCopy"),
body: "automaticallyCopyTitle".localized,
notice: "automaticallyCopy".localized,
queryParameter: "autoCopy=1&copy=optional"
)
]
@ -182,7 +182,7 @@ class HomeViewModel: ViewModel, ViewModelType {
.skip(1)
.compactMap { granted -> String? in
if !granted {
return NSLocalizedString("AllowNotifications")
return "AllowNotifications".localized
}
return nil
}
@ -204,7 +204,7 @@ class HomeViewModel: ViewModel, ViewModelType {
case .ok: break
case .serverError(let error):
if serverErrorCount < 2 {
showSnackbar.accept("\(NSLocalizedString("ServerError")): \(error.rawString())")
showSnackbar.accept("\("ServerError".localized): \(error.rawString())")
} else {
alertServerError.accept(error.rawString())
}

View File

@ -33,20 +33,20 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
}
subMenuElements.append(action)
}
menuElements.append(UIMenu(title: NSLocalizedString("more"), children: subMenuElements))
menuElements.append(UIMenu(title: "more".localized, children: subMenuElements))
let addNewMenu = UIMenu(
title: NSLocalizedString("clearFrom"),
title: "clearFrom".localized,
children: menuElements
)
let item = UIBarButtonItem(image: UIImage(named: "baseline_delete_outline_black_24pt"), menu: addNewMenu)
item.accessibilityLabel = NSLocalizedString("clear")
item.accessibilityLabel = "clear".localized
return item
} else {
let btn = BKButton()
btn.setImage(UIImage(named: "baseline_delete_outline_black_24pt"), for: .normal)
btn.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
btn.accessibilityLabel = NSLocalizedString("clear")
btn.accessibilityLabel = "clear".localized
return UIBarButtonItem(customView: btn)
}
@ -246,10 +246,10 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
output.errorAlert
.drive(onNext: { [weak self] error in
let alertController = UIAlertController(title: "Error", message: error, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: NSLocalizedString("Copy2"), style: .default, handler: { _ in
alertController.addAction(UIAlertAction(title: "Copy2".localized, style: .default, handler: { _ in
UIPasteboard.general.string = error
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
self?.present(alertController, animated: true, completion: nil)
}).disposed(by: rx.disposeBag)
@ -264,20 +264,20 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
deleteBtn.rx.tap.subscribe(onNext: { [weak self] _ in
guard let self else { return }
let alertController = UIAlertController(title: nil, message: NSLocalizedString("clearFrom"), preferredStyle: .actionSheet)
alertController.addAction(UIAlertAction(title: NSLocalizedString("lastHour"), style: .default, handler: { [weak self] _ in
let alertController = UIAlertController(title: nil, message: "clearFrom".localized, preferredStyle: .actionSheet)
alertController.addAction(UIAlertAction(title: "lastHour".localized, style: .default, handler: { [weak self] _ in
self?.clearAlert(.lastHour)
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("today"), style: .default, handler: { [weak self] _ in
alertController.addAction(UIAlertAction(title: "today".localized, style: .default, handler: { [weak self] _ in
self?.clearAlert(.today)
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("todayAndYesterday"), style: .default, handler: { [weak self] _ in
alertController.addAction(UIAlertAction(title: "todayAndYesterday".localized, style: .default, handler: { [weak self] _ in
self?.clearAlert(.todayAndYesterday)
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("allTime"), style: .default, handler: { [weak self] _ in
alertController.addAction(UIAlertAction(title: "allTime".localized, style: .default, handler: { [weak self] _ in
self?.clearAlert(.allTime)
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
if UIDevice.current.userInterfaceIdiom == .pad {
alertController.modalPresentationStyle = .popover
if #available(iOS 16.0, *) {
@ -291,11 +291,11 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
}
func clearAlert(_ range: MessageDeleteTimeRange) {
let alertController = UIAlertController(title: nil, message: "\(NSLocalizedString("clearFrom"))\n\(range.string)", preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: NSLocalizedString("clear"), style: .destructive, handler: { [weak self] _ in
let alertController = UIAlertController(title: nil, message: "\("clearFrom".localized)\n\(range.string)", preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "clear".localized, style: .destructive, handler: { [weak self] _ in
self?.clearRelay.accept(range)
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
self.navigationController?.present(alertController, animated: true, completion: nil)
}
@ -303,7 +303,7 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
//
alertController.addAction(UIAlertAction(title: NSLocalizedString("Copy2"), style: .default, handler: { [weak self]
alertController.addAction(UIAlertAction(title: "Copy2".localized, style: .default, handler: { [weak self]
(_: UIAlertAction) in
if #available(iOS 14.0, *) {
var items = [[String: Any]]()
@ -315,10 +315,10 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
} else {
UIPasteboard.general.string = message.attributedText?.string ?? ""
}
self?.showSnackbar(text: NSLocalizedString("Copy"))
self?.showSnackbar(text: "Copy".localized)
}))
//
alertController.addAction(UIAlertAction(title: NSLocalizedString("removeMessage"), style: .destructive, handler: { [weak self]
alertController.addAction(UIAlertAction(title: "removeMessage".localized, style: .destructive, handler: { [weak self]
(_: UIAlertAction) in
guard let self, let indexPath = self.tableView.indexPath(for: sourceCell) else { return }
if sourceCell is MessageTableViewCell {
@ -330,7 +330,7 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
}
}))
//
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: { _ in }))
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: { _ in }))
if UIDevice.current.userInterfaceIdiom == .pad {
alertController.popoverPresentationController?.sourceView = sourceView.superview
@ -350,7 +350,7 @@ class MessageListViewController: BaseViewController<MessageListViewModel> {
extension MessageListViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
let action = UIContextualAction(style: .destructive, title: NSLocalizedString("removeMessage")) { [weak self] _, _, actionPerformed in
let action = UIContextualAction(style: .destructive, title: "removeMessage".localized) { [weak self] _, _, actionPerformed in
guard let self else { return }
if self.tableView.cellForRow(at: indexPath) is MessageTableViewCell {
@ -361,12 +361,12 @@ extension MessageListViewController: UITableViewDelegate {
}
//
let alertView = UIAlertController(title: nil, message: NSLocalizedString("removeNotice"), preferredStyle: .alert)
alertView.addAction(UIAlertAction(title: NSLocalizedString("removeMessage"), style: .destructive, handler: { _ in
let alertView = UIAlertController(title: nil, message: "removeNotice".localized, preferredStyle: .alert)
alertView.addAction(UIAlertAction(title: "removeMessage".localized, style: .destructive, handler: { _ in
self.tableView.dataSource?.tableView?(self.tableView, commit: .delete, forRowAt: indexPath)
actionPerformed(true)
}))
alertView.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: { _ in
alertView.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: { _ in
actionPerformed(false)
}))
self.present(alertView, animated: true, completion: nil)

View File

@ -176,7 +176,7 @@ class MessageListViewModel: ViewModel, ViewModelType {
items.append(.message(model: messages[0]))
} else if messages.count > 0 {
//
items.append(.messageGroup(name: group ?? NSLocalizedString("default"), totalCount: messageResult.count, messages: messages))
items.append(.messageGroup(name: group ?? "default".localized, totalCount: messageResult.count, messages: messages))
}
}
return items
@ -212,7 +212,7 @@ class MessageListViewModel: ViewModel, ViewModelType {
func transform(input: Input) -> Output {
//
let titleRelay = BehaviorRelay<String>(value: NSLocalizedString("historyMessage"))
let titleRelay = BehaviorRelay<String>(value: "historyMessage".localized)
//
let messagesRelay = BehaviorRelay<[MessageSection]>(value: [])
//
@ -232,9 +232,9 @@ class MessageListViewModel: ViewModel, ViewModelType {
filterGroups
.subscribe(onNext: { filterGroups in
if filterGroups.count <= 0 {
titleRelay.accept(NSLocalizedString("historyMessage"))
titleRelay.accept("historyMessage".localized)
} else {
titleRelay.accept(filterGroups.map { $0 ?? NSLocalizedString("default") }.joined(separator: " , "))
titleRelay.accept(filterGroups.map { $0 ?? "default".localized }.joined(separator: " , "))
}
}).disposed(by: rx.disposeBag)

View File

@ -45,7 +45,7 @@ class MessageSettingsViewController: BaseViewController<MessageSettingsViewModel
private var footers: [String?] = []
override func makeUI() {
self.title = NSLocalizedString("settings")
self.title = "settings".localized
self.view.addSubview(tableView)
tableView.snp.makeConstraints { make in
@ -63,8 +63,8 @@ class MessageSettingsViewController: BaseViewController<MessageSettingsViewModel
SwiftyStoreKit.purchaseProduct(productId) { result in
SVProgressHUD.dismiss()
if case .success = result {
let alert = UIAlertController(title: NSLocalizedString("successfulDonation"), message: NSLocalizedString("thankYouSupport"), preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("donateOK"), style: .default, handler: nil))
let alert = UIAlertController(title: "successfulDonation".localized, message: "thankYouSupport".localized, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "donateOK".localized, style: .default, handler: nil))
self?.present(alert, animated: true)
}
}
@ -115,11 +115,11 @@ class MessageSettingsViewController: BaseViewController<MessageSettingsViewModel
}
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
alertController.addAction(UIAlertAction(title: NSLocalizedString("export"), style: .default, handler: { _ in
alertController.addAction(UIAlertAction(title: "export".localized, style: .default, handler: { _ in
strongSelf.backupOrRestoreActionRelay.accept(.export)
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("import"), style: .default, handler: { [weak self] _ in
alertController.addAction(UIAlertAction(title: "import".localized, style: .default, handler: { [weak self] _ in
if #available(iOS 14.0, *) {
let supportedType: [UTType] = [UTType.json]
let pickerViewController = UIDocumentPickerViewController(forOpeningContentTypes: supportedType, asCopy: false)
@ -128,7 +128,7 @@ class MessageSettingsViewController: BaseViewController<MessageSettingsViewModel
}
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
if UIDevice.current.userInterfaceIdiom == .pad {
if let cell = strongSelf.tableView.cellForRow(at: indexPath) {
alertController.popoverPresentationController?.sourceView = strongSelf.tableView
@ -246,7 +246,7 @@ class MessageSettingsViewController: BaseViewController<MessageSettingsViewModel
// deviceToken
output.copyDeviceToken.drive { [weak self] deviceToken in
UIPasteboard.general.string = deviceToken
self?.showSnackbar(text: NSLocalizedString("Copy"))
self?.showSnackbar(text: "Copy".localized)
}.disposed(by: rx.disposeBag)
//
@ -292,7 +292,7 @@ class MessageSettingsViewController: BaseViewController<MessageSettingsViewModel
), animated: true, completion: nil)
case "restoreSubscription":
SwiftyStoreKit.restorePurchases { [weak self] _ in
self?.showSnackbar(text: NSLocalizedString("done"))
self?.showSnackbar(text: "done".localized)
}
default: break
}

View File

@ -74,7 +74,7 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
//
var messageSettings = [MessageSettingItem]()
messageSettings.append(.backup(viewModel: MutableTextCellViewModel(
title: "\(NSLocalizedString("export"))/\(NSLocalizedString("import"))",
title: "\("export".localized)/\("import".localized)",
text: Observable.merge([restoreSuccess, input.viewDidAppear])
.map { _ in
if let realm = try? Realm() {
@ -84,7 +84,7 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
return 0
}
.map { count in
"\(count) \(NSLocalizedString("items"))"
"\(count) \("items".localized)"
}
.asDriver(onErrorDriveWith: .empty())
)
@ -94,7 +94,7 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
settings.append(
SectionModel(
model: MessageSettingSection(header: NSLocalizedString("historyMessage"), footer: NSLocalizedString("archiveNote")),
model: MessageSettingSection(header: "historyMessage".localized, footer: "archiveNote".localized),
items: messageSettings
)
)
@ -111,7 +111,7 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
if let deviceToken = deviceToken {
return "\(deviceToken.prefix(2))****\(deviceToken.suffix(4))"
}
return NSLocalizedString("unknown")
return "unknown".localized
}
)
))
@ -128,7 +128,7 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
}
settings.append(
SectionModel(
model: MessageSettingSection(header: NSLocalizedString("info"), footer: NSLocalizedString("buildDesc")),
model: MessageSettingSection(header: "info".localized, footer: "buildDesc".localized),
items: infosettings
)
)
@ -136,20 +136,20 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
//
var otherSettings = [MessageSettingItem]()
otherSettings.append(.detail(
title: NSLocalizedString("faq"),
title: "faq".localized,
text: nil,
textColor: nil,
url: URL(string: NSLocalizedString("faqUrl"))
url: URL(string: "faqUrl".localized)
))
otherSettings.append(.detail(
title: NSLocalizedString("documentation"),
title: "documentation".localized,
text: nil,
textColor: nil,
url: URL(string: NSLocalizedString("docUrl"))
url: URL(string: "docUrl".localized)
))
otherSettings.append(.detail(
title: NSLocalizedString("sourceCode"),
title: "sourceCode".localized,
text: nil,
textColor: nil,
url: URL(string: "https://github.com/Finb/Bark")
@ -157,19 +157,19 @@ class MessageSettingsViewModel: ViewModel, ViewModelType {
settings.append(
SectionModel(
model: MessageSettingSection(header: NSLocalizedString("other")),
model: MessageSettingSection(header: "other".localized),
items: otherSettings
)
)
//
var donateSettings = [MessageSettingItem]()
donateSettings.append(.donate(title: NSLocalizedString("oneTimeDonation"), productId: "bark.oneTimeDonation.18"))
donateSettings.append(.donate(title: NSLocalizedString("continuousSupport"), productId: "bark.continuousSupport.18"))
donateSettings.append(.donate(title: "oneTimeDonation".localized, productId: "bark.oneTimeDonation.18"))
donateSettings.append(.donate(title: "continuousSupport".localized, productId: "bark.continuousSupport.18"))
settings.append(
SectionModel(
model: MessageSettingSection(
header: NSLocalizedString("donate"),
header: "donate".localized,
footer: nil
),
items: donateSettings

View File

@ -27,8 +27,8 @@ class NewServerViewController: BaseViewController<NewServerViewModel> {
lazy var addressTextField: TextField = {
let textField = TextField()
textField.keyboardType = .URL
textField.placeholder = NSLocalizedString("ServerAddress")
textField.detail = NSLocalizedString("ServerExample")
textField.placeholder = "ServerAddress".localized
textField.detail = "ServerExample".localized
textField.transition([.scale(0.85), .opacity(0)])
textField.detailLabel.transition([.scale(0.85), .opacity(0)])
textField.textColor = BKColor.grey.darken4
@ -42,7 +42,7 @@ class NewServerViewController: BaseViewController<NewServerViewModel> {
let noticeLabel: UILabel = {
let label = UILabel()
label.text = NSLocalizedString("DeploymentDocuments")
label.text = "DeploymentDocuments".localized
label.textColor = BKColor.blue.base
label.font = UIFont.preferredFont(ofSize: 12)
label.adjustsFontForContentSizeCategory = true
@ -63,7 +63,7 @@ class NewServerViewController: BaseViewController<NewServerViewModel> {
override func makeUI() {
self.navigationItem.largeTitleDisplayMode = .never
navigationItem.title = NSLocalizedString("AddServer")
navigationItem.title = "AddServer".localized
self.view.layout(addressTextField)
.top(kNavigationHeight + 40).left(10).right(10)
@ -79,7 +79,7 @@ class NewServerViewController: BaseViewController<NewServerViewModel> {
//
let noticeTap = noticeLabel.gestureRecognizers!.first!.rx
.event
.map { _ -> () in
.map { _ in
()
}
.asDriver(onErrorJustReturn: ())
@ -98,7 +98,7 @@ class NewServerViewController: BaseViewController<NewServerViewModel> {
.asDriver(onErrorDriveWith: .empty())
//
let scannerDidScan = self.scanButton.rx.tap.flatMapLatest {[weak self] _ -> Observable<String> in
let scannerDidScan = self.scanButton.rx.tap.flatMapLatest { [weak self] _ -> Observable<String> in
let controller = QRScannerViewController()
self?.navigationController?.present(controller, animated: true, completion: nil)
return controller.scannerDidSuccess
@ -116,8 +116,7 @@ class NewServerViewController: BaseViewController<NewServerViewModel> {
output.showKeyboard.drive(onNext: { [weak self] show in
if show {
_ = self?.addressTextField.becomeFirstResponder()
}
else {
} else {
self?.addressTextField.resignFirstResponder()
}
}).disposed(by: rx.disposeBag)

View File

@ -38,7 +38,7 @@ class NewServerViewModel: ViewModel, ViewModelType {
let showSnackbar = PublishRelay<String>()
let notice = input.noticeClick
.map { URL(string: NSLocalizedString("deployUrl"))! }
.map { URL(string: "deployUrl".localized)! }
.asDriver()
input.viewDidAppear
@ -66,9 +66,8 @@ class NewServerViewModel: ViewModel, ViewModelType {
return BarkApi.provider
.request(.ping(baseURL: url))
.filterResponseError()
}
else {
showSnackbar.accept(NSLocalizedString("InvalidURL"))
} else {
showSnackbar.accept("InvalidURL".localized)
return .empty()
}
}
@ -82,9 +81,9 @@ class NewServerViewModel: ViewModel, ViewModelType {
ServerManager.shared.syncAllServers()
strongSelf.pop.accept(URL(string: strongSelf.url)?.host ?? "")
showSnackbar.accept(NSLocalizedString("AddedSuccessfully"))
showSnackbar.accept("AddedSuccessfully".localized)
case .failure(let error):
showSnackbar.accept("\(NSLocalizedString("InvalidServer"))\(error.rawString())")
showSnackbar.accept("\("InvalidServer".localized)\(error.rawString())")
}
}).disposed(by: rx.disposeBag)

View File

@ -7,10 +7,10 @@
//
import Foundation
import Material
import RxCocoa
import RxDataSources
import RxSwift
import Material
struct SectionItem {
let image: UIImage?
@ -29,9 +29,9 @@ class SectionViewModel: ViewModel, ViewModelType {
func initSectionItems() -> Observable<[SectionModel<String, SectionItem>]> {
let sectionItems = [
SectionItem(image: UIImage(named: "baseline_gite_black_24pt"), title: NSLocalizedString("service")),
SectionItem(image: Icon.history, title: NSLocalizedString("historyMessage")),
SectionItem(image: UIImage(named: "baseline_manage_accounts_black_24pt"), title: NSLocalizedString("settings")),
SectionItem(image: UIImage(named: "baseline_gite_black_24pt"), title: "service".localized),
SectionItem(image: Icon.history, title: "historyMessage".localized),
SectionItem(image: UIImage(named: "baseline_manage_accounts_black_24pt"), title: "settings".localized)
]
let section = [SectionModel(model: "", items: sectionItems)]
return Observable.just(section)

View File

@ -40,7 +40,7 @@ class ServerListViewController: BaseViewController<ServerListViewModel> {
closeButton.frame = CGRect(x: 0, y: 0, width: 40, height: 40)
closeButton.hitTestSlop = UIEdgeInsets(top: -10, left: -10, bottom: -10, right: -10)
closeButton.tintColor = BKColor.grey.darken4
closeButton.accessibilityLabel = NSLocalizedString("close")
closeButton.accessibilityLabel = "close".localized
return closeButton
}()
@ -54,7 +54,7 @@ class ServerListViewController: BaseViewController<ServerListViewModel> {
}()
override func makeUI() {
self.title = NSLocalizedString("serverList")
self.title = "serverList".localized
navigationItem.setRightBarButtonItem(item: UIBarButtonItem(customView: closeButton))
@ -126,7 +126,7 @@ class ServerListViewController: BaseViewController<ServerListViewModel> {
output.copy
.drive(onNext: { [weak self] text in
UIPasteboard.general.string = text
self?.showSnackbar(text: NSLocalizedString("Copy"))
self?.showSnackbar(text: "Copy".localized)
})
.disposed(by: rx.disposeBag)
@ -148,50 +148,50 @@ class ServerListViewController: BaseViewController<ServerListViewModel> {
}
let alertController = UIAlertController(title: nil, message: "\(URL(string: viewModel.server.address)?.host ?? "")", preferredStyle: .actionSheet)
alertController.addAction(UIAlertAction(title: NSLocalizedString("copyAddressAndKey"), style: .default, handler: { _ in
alertController.addAction(UIAlertAction(title: "copyAddressAndKey".localized, style: .default, handler: { _ in
relay.accept((viewModel.server, .copy))
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("resetKey"), style: .default, handler: { _ in
let alertController = UIAlertController(title: NSLocalizedString("resetKey"), message: NSLocalizedString("resetKeyDesc"), preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "resetKey".localized, style: .default, handler: { _ in
let alertController = UIAlertController(title: "resetKey".localized, message: "resetKeyDesc".localized, preferredStyle: .alert)
alertController.addTextField { textField in
textField.placeholder = NSLocalizedString("resetKeyPlaceholder")
textField.placeholder = "resetKeyPlaceholder".localized
}
alertController.addAction(UIAlertAction(title: NSLocalizedString("confirm"), style: .default, handler: { _ in
alertController.addAction(UIAlertAction(title: "confirm".localized, style: .default, handler: { _ in
relay.accept((viewModel.server, .reset(key: alertController.textFields?.first?.text)))
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
self.navigationController?.present(alertController, animated: true, completion: nil)
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("setAsDefaultServer"), style: .default, handler: { _ in
alertController.addAction(UIAlertAction(title: "setAsDefaultServer".localized, style: .default, handler: { _ in
relay.accept((viewModel.server, .select))
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("setServerName"), style: .default, handler: { _ in
let alertController = UIAlertController(title: NSLocalizedString("setServerName"), message: nil, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "setServerName".localized, style: .default, handler: { _ in
let alertController = UIAlertController(title: "setServerName".localized, message: nil, preferredStyle: .alert)
alertController.addTextField { textField in
textField.text = viewModel.server.name
}
alertController.addAction(UIAlertAction(title: NSLocalizedString("confirm"), style: .default, handler: { _ in
alertController.addAction(UIAlertAction(title: "confirm".localized, style: .default, handler: { _ in
relay.accept((viewModel.server, .setName(name: alertController.textFields?.first?.text)))
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
self.navigationController?.present(alertController, animated: true, completion: nil)
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("deleteServer"), style: .destructive, handler: { _ in
alertController.addAction(UIAlertAction(title: "deleteServer".localized, style: .destructive, handler: { _ in
let alertController = UIAlertController(title: nil, message: NSLocalizedString("confirmDeleteServer"), preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: NSLocalizedString("confirm"), style: .destructive, handler: { _ in
let alertController = UIAlertController(title: nil, message: "confirmDeleteServer".localized, preferredStyle: .alert)
alertController.addAction(UIAlertAction(title: "confirm".localized, style: .destructive, handler: { _ in
relay.accept((viewModel.server, .delete))
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
self.navigationController?.present(alertController, animated: true, completion: nil)
}))
alertController.addAction(UIAlertAction(title: NSLocalizedString("Cancel"), style: .cancel, handler: nil))
alertController.addAction(UIAlertAction(title: "Cancel".localized, style: .cancel, handler: nil))
if UIDevice.current.userInterfaceIdiom == .pad {
if let cell = self.tableView.cellForRow(at: indexPath) {

View File

@ -54,7 +54,7 @@ class ServerListViewModel: ViewModel, ViewModelType {
//
deleteCheck.filter { $0 == nil }
.map { _ in NSLocalizedString("deleteFailed") }
.map { _ in "deleteFailed".localized }
.bind(to: showSnackbar)
.disposed(by: rx.disposeBag)
@ -79,7 +79,7 @@ class ServerListViewModel: ViewModel, ViewModelType {
}.share()
//
serverDeleted.map { NSLocalizedString("deletedSuccessfully") }
serverDeleted.map { "deletedSuccessfully".localized }
.bind(to: showSnackbar)
.disposed(by: rx.disposeBag)
@ -90,7 +90,7 @@ class ServerListViewModel: ViewModel, ViewModelType {
//
resetServer.filter { ($0.2?.count ?? 0) <= 0 }
.map { _ in NSLocalizedString("resetFailed2") }
.map { _ in "resetFailed2".localized }
.bind(to: showSnackbar)
.disposed(by: rx.disposeBag)
@ -131,7 +131,7 @@ class ServerListViewModel: ViewModel, ViewModelType {
//
serverReseted.filter { $0 == nil }
.map { _ in NSLocalizedString("resetFailed") }
.map { _ in "resetFailed".localized }
.bind(to: showSnackbar)
.disposed(by: rx.disposeBag)
@ -153,7 +153,7 @@ class ServerListViewModel: ViewModel, ViewModelType {
//
let serverSelected = input.selectServer.asObservable().map { server in
ServerManager.shared.setCurrentServer(serverId: server.id)
showSnackbar.accept(NSLocalizedString("setSuccessfully"))
showSnackbar.accept("setSuccessfully".localized)
return ()
}

View File

@ -32,7 +32,7 @@ class SoundsViewController: BaseViewController<SoundsViewModel> {
var playingAudio: CFURL?
override func makeUI() {
self.title = NSLocalizedString("notificationSound")
self.title = "notificationSound".localized
self.view.addSubview(self.tableView)
self.tableView.delegate = self
@ -82,14 +82,14 @@ class SoundsViewController: BaseViewController<SoundsViewModel> {
output.copyNameAction.drive(onNext: { [unowned self] name in
UIPasteboard.general.string = name.trimmingCharacters(in: .whitespacesAndNewlines)
self.navigationController?.showSnackbar(text: NSLocalizedString("Copy"))
self.navigationController?.showSnackbar(text: "Copy".localized)
}).disposed(by: rx.disposeBag)
output.playAction.drive(onNext: { url in
///
AudioServicesDisposeSystemSoundID(self.currentSoundID)
///
if self.playingAudio == url{
if self.playingAudio == url {
self.playingAudio = nil
self.currentSoundID = 0
return
@ -121,7 +121,7 @@ extension SoundsViewController: UITableViewDelegate {
guard section == 0 else {
return 0
}
return NSLocalizedString("uploadSoundNoticeFullText").count <= 30 ? 50 : 60
return "uploadSoundNoticeFullText".localized.count <= 30 ? 50 : 60
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
@ -130,7 +130,7 @@ extension SoundsViewController: UITableViewDelegate {
let view = UIView()
let label = UILabel()
label.text = NSLocalizedString(sectionTitle)
label.text = sectionTitle.localized
label.fontSize = 14
label.textColor = BKColor.grey.darken3
view.addSubview(label)
@ -148,8 +148,8 @@ extension SoundsViewController: UITableViewDelegate {
}
let view = UIView()
let fullText = NSLocalizedString("uploadSoundNoticeFullText")
let highlightText = NSLocalizedString("uploadSoundNoticeHighlightText")
let fullText = "uploadSoundNoticeFullText".localized
let highlightText = "uploadSoundNoticeHighlightText".localized
let attrStr = NSMutableAttributedString(
string: fullText,
attributes: [

View File

@ -62,7 +62,7 @@ struct AESCryptoModel {
}
guard algorithm.keyLength == key.count else {
throw String(format: NSLocalizedString("enterKey"), algorithm.keyLength)
throw String(format: "enterKey".localized, algorithm.keyLength)
}
var iv = ""
@ -74,9 +74,8 @@ struct AESCryptoModel {
if let ivField = cryptoFields.iv, ivField.count == expectIVLength {
iv = ivField
}
else {
throw String(format: NSLocalizedString("enterIv"), expectIVLength)
} else {
throw String(format: "enterIv".localized, expectIVLength)
}
}
@ -103,6 +102,6 @@ struct AESCryptoModel {
}
func decrypt(ciphertext: String) throws -> String {
return String(data: Data(try aes.decrypt(Array(base64: ciphertext))), encoding: .utf8) ?? ""
return try String(data: Data(aes.decrypt(Array(base64: ciphertext))), encoding: .utf8) ?? ""
}
}

View File

@ -32,23 +32,23 @@ enum MessageDeleteTimeRange {
var string: String {
switch self {
case .lastHour:
return NSLocalizedString("lastHour")
return "lastHour".localized
case .today:
return NSLocalizedString("today")
return "today".localized
case .todayAndYesterday:
return NSLocalizedString("todayAndYesterday")
return "todayAndYesterday".localized
case .lastMonth:
return NSLocalizedString("lastMonth")
return "lastMonth".localized
case .allTime:
return NSLocalizedString("allTime")
return "allTime".localized
case .beforeOneHour:
return NSLocalizedString("beforeAnHour")
return "beforeAnHour".localized
case .beforeToday:
return NSLocalizedString("beforeToday")
return "beforeToday".localized
case .beforeYesterday:
return NSLocalizedString("beforeYesterday")
return "beforeYesterday".localized
case .beforeOneMonth:
return NSLocalizedString("beforeAMonth")
return "beforeAMonth".localized
}
}

View File

@ -53,7 +53,7 @@ extension MessageListCellItem: IdentifiableType {
case .message(let model):
return "list_\(model.id)_\(model.createDate?.timeInterval ?? 0)"
case .messageGroup(_, _, let messages):
return "group_\(messages.first?.group ?? NSLocalizedString("default"))_\(messages.first?.createDate?.timeInterval ?? 0)"
return "group_\(messages.first?.group ?? "default".localized)_\(messages.first?.createDate?.timeInterval ?? 0)"
}
}
}

View File

@ -11,7 +11,7 @@ import UIKit
class AddSoundCell: UITableViewCell {
let button: UIButton = {
let button = UIButton(type: .system)
button.setTitle(NSLocalizedString("uploadSound"), for: .normal)
button.setTitle("uploadSound".localized, for: .normal)
button.setImage(UIImage(named: "music_note-music_note_symbol"), for: .normal)
button.setTitleColor(BKColor.lightBlue.darken3, for: .normal)
button.tintColor = BKColor.lightBlue.darken3
@ -31,8 +31,8 @@ class AddSoundCell: UITableViewCell {
}
}
@available(*, unavailable)
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

View File

@ -18,7 +18,7 @@ class ArchiveSettingCell: BaseTableViewCell<ArchiveSettingCellViewModel> {
super.init(style: style, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
self.backgroundColor = BKColor.background.secondary
self.textLabel?.text = NSLocalizedString("defaultArchiveSettings")
self.textLabel?.text = "defaultArchiveSettings".localized
contentView.addSubview(switchButton)
switchButton.snp.makeConstraints { make in

View File

@ -25,7 +25,7 @@ class MessageGroupMoreView: UIView {
var count: Int = 0 {
didSet {
moreLabel.text = NSLocalizedString("viewAllMessages").format(count)
moreLabel.text = "viewAllMessages".localized(with: count)
}
}

View File

@ -205,7 +205,7 @@ extension MessageItemView {
.contentMode(.scaleAspectFit)
]
if #available(iOS 14.0, *) {
options.append(.rightNavItemTitle(NSLocalizedString("save"), onTap: { [weak self] _ in
options.append(.rightNavItemTitle("save".localized, onTap: { [weak self] _ in
// image
self?.saveImageToAlbum(image)
}))
@ -248,7 +248,7 @@ extension MessageItemView {
PHPhotoLibrary.requestAuthorization(for: .addOnly) { status in
guard status == .authorized || status == .limited else {
DispatchQueue.main.async {
SVProgressHUD.showInfo(withStatus: NSLocalizedString("noPermission"))
SVProgressHUD.showInfo(withStatus: "noPermission".localized)
}
return
}
@ -257,7 +257,7 @@ extension MessageItemView {
}) { success, error in
DispatchQueue.main.async {
if success {
SVProgressHUD.showSuccess(withStatus: NSLocalizedString("saveSuccess"))
SVProgressHUD.showSuccess(withStatus: "saveSuccess".localized)
} else {
SVProgressHUD.showError(withStatus: error?.localizedDescription)
}

View File

@ -107,7 +107,7 @@ class MessageGroupTableViewCell: UITableViewCell {
if let newValue, !newValue.isEmpty {
groupHeader.groupName = newValue
} else {
groupHeader.groupName = NSLocalizedString("default")
groupHeader.groupName = "default".localized
}
}
get {

View File

@ -86,7 +86,7 @@ private class ShowLessView: UIView {
let label = UILabel()
label.font = UIFont.preferredFont(ofSize: 12)
label.textColor = BKColor.grey.darken3
label.text = NSLocalizedString("showLess")
label.text = "showLess".localized
return label
}()
@ -148,7 +148,7 @@ private class ClearView: UIView {
let label = UILabel()
label.font = UIFont.preferredFont(ofSize: 12)
label.textColor = BKColor.grey.darken3
label.text = NSLocalizedString("clear")
label.text = "clear".localized
label.alpha = 0
return label
}()

View File

@ -20,12 +20,12 @@ class MessageSettingFooter: UITextView, UITextViewDelegate {
// build
let buildVersion = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? ""
let attr = NSMutableAttributedString(string: "\(NSLocalizedString("version")) \(appVersion) (\(buildVersion))\n", attributes: [.font: UIFont.preferredFont(ofSize: 12), .foregroundColor: BKColor.grey.darken1])
attr.append(NSAttributedString(string: NSLocalizedString("privacyPolicy"), attributes: [.link: "privacyPolicy"]))
let attr = NSMutableAttributedString(string: "\("version".localized) \(appVersion) (\(buildVersion))\n", attributes: [.font: UIFont.preferredFont(ofSize: 12), .foregroundColor: BKColor.grey.darken1])
attr.append(NSAttributedString(string: "privacyPolicy".localized, attributes: [.link: "privacyPolicy"]))
attr.append(NSAttributedString(string: " · "))
attr.append(NSAttributedString(string: NSLocalizedString("userAgreement"), attributes: [.link: "userAgreement"]))
attr.append(NSAttributedString(string: "userAgreement".localized, attributes: [.link: "userAgreement"]))
attr.append(NSAttributedString(string: " · "))
attr.append(NSAttributedString(string: NSLocalizedString("restoreSubscription"), attributes: [.link: "restoreSubscription"]))
attr.append(NSAttributedString(string: "restoreSubscription".localized, attributes: [.link: "restoreSubscription"]))
let style = NSMutableParagraphStyle()
style.lineSpacing = 6

View File

@ -12,13 +12,13 @@ import UIKit
class PreviewCardCell: BaseTableViewCell<PreviewCardCellViewModel> {
let previewButton: IconButton = {
let button = IconButton(image: Icon.cm.skipForward, tintColor: BKColor.grey.base)
button.accessibilityLabel = NSLocalizedString("demo")
button.accessibilityLabel = "demo".localized
return button
}()
let copyButton: IconButton = {
let button = IconButton(image: UIImage(named: "baseline_file_copy_white_24pt"), tintColor: BKColor.grey.base)
button.accessibilityLabel = NSLocalizedString("copy")
button.accessibilityLabel = "copy".localized
return button
}()

View File

@ -13,7 +13,7 @@ import UIKit
class SoundCell: BaseTableViewCell<SoundCellViewModel> {
let copyButton: IconButton = {
let button = IconButton(image: UIImage(named: "baseline_file_copy_white_24pt"), tintColor: BKColor.grey.base)
button.accessibilityLabel = NSLocalizedString("copy")
button.accessibilityLabel = "copy".localized
return button
}()

View File

@ -14,18 +14,18 @@ class iCloudStatusCell: UITableViewCell {
super.init(style: .value1, reuseIdentifier: reuseIdentifier)
self.selectionStyle = .none
self.backgroundColor = BKColor.background.secondary
self.textLabel?.text = NSLocalizedString("iCloudSatatus")
self.textLabel?.text = "iCloudStatus".localized
self.detailTextLabel?.text = ""
self.detailTextLabel?.textColor = BKColor.grey.darken2
CKContainer.default().accountStatus { status, _ in
dispatch_sync_safely_main_queue {
switch status {
case .available:
self.detailTextLabel?.text = NSLocalizedString("available")
self.detailTextLabel?.text = "available".localized
case .noAccount, .restricted, .temporarilyUnavailable:
self.detailTextLabel?.text = NSLocalizedString("restricted")
self.detailTextLabel?.text = "restricted".localized
case .couldNotDetermine:
self.detailTextLabel?.text = NSLocalizedString("unknown")
self.detailTextLabel?.text = "unknown".localized
@unknown default:
break
}

View File

@ -95,7 +95,7 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
UIPasteboard.general.string = content
}
showTips(text: NSLocalizedString("Copy", comment: ""))
showTips(text: "Copy".localized)
completion(.doNotDismiss)
}
@ -105,7 +105,7 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi
//
GroupMuteSettingManager().settings[groupName] = Date() + 60 * 60
showTips(text: String(format: NSLocalizedString("groupMuted", comment: ""), groupName.isEmpty ? "default" : groupName))
showTips(text: String(format: "groupMuted".localized, groupName.isEmpty ? "default".localized : groupName))
completion(.doNotDismiss)
}