Jelajahi Sumber

【2025】【综合】多语处理

niehaoyu 1 bulan lalu
induk
melakukan
b4e46c752c

+ 49 - 49
PDF Office/PDF Master/KMClass/KMPDFViewController/KMMainViewController.swift

@@ -1473,22 +1473,22 @@ struct KMNMWCFlags {
         
         let outputSavePanel = NSSavePanel()
         outputSavePanel.directoryURL = listView.document.documentURL.deletingLastPathComponent()
-        outputSavePanel.title = NSLocalizedString("", comment: "Save as PDF")
+        outputSavePanel.title = KMLocalizedString("", comment: "Save as PDF")
         outputSavePanel.allowedFileTypes = ["pdf"]
-        outputSavePanel.nameFieldStringValue = fileNameWithoutExtension + "_" + NSLocalizedString("Signed", comment: "")
+        outputSavePanel.nameFieldStringValue = fileNameWithoutExtension + "_" + KMLocalizedString("Signed", comment: "")
         let result = outputSavePanel.runModal()
         if result == .OK {
             let contentArr = NSMutableArray()
             var locationStr = ""
-            var reasonStr = NSLocalizedString("none", comment: "")
+            var reasonStr = KMLocalizedString("none", comment: "")
             for item in config.contents {
-                if item.key == NSLocalizedString("Reason", comment: "") {
-                    if item.value == NSLocalizedString("<your signing reason here>", comment: "") {
-                        item.value = " " + NSLocalizedString("none", comment: "")
+                if item.key == KMLocalizedString("Reason", comment: "") {
+                    if item.value == KMLocalizedString("<your signing reason here>", comment: "") {
+                        item.value = " " + KMLocalizedString("none", comment: "")
                     }
                     reasonStr = item.value
-                } else if item.key == NSLocalizedString("Location", comment: "") {
-                    if item.value == NSLocalizedString("<your signing location here>", comment: "") {
+                } else if item.key == KMLocalizedString("Location", comment: "") {
+                    if item.value == KMLocalizedString("<your signing location here>", comment: "") {
                         item.value = " "
                     }
                     locationStr = item.value
@@ -1513,8 +1513,8 @@ struct KMNMWCFlags {
                 }
             } else {
                 let alert = NSAlert.init()
-                alert.messageText = NSLocalizedString("Save failed!", comment: "")
-                alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+                alert.messageText = KMLocalizedString("Save failed!", comment: "")
+                alert.addButton(withTitle: KMLocalizedString("OK", comment: ""))
                 alert.runModal()
             }
             widget.page.removeAnnotation(widget)
@@ -1853,17 +1853,17 @@ struct KMNMWCFlags {
         if (watermarks == nil || watermarks!.count <= 0) {
             let alert = NSAlert()
             alert.alertStyle = .warning
-            alert.messageText = NSLocalizedString("Could not find a removable watermark in this document. If you see a watermark, it was not added with PDF Reader Pro and therefore cannot be detected.", comment: "")
-            alert.addButton(withTitle: NSLocalizedString("Confirm", comment: ""))
+            alert.messageText = KMLocalizedString("Could not find a removable watermark in this document. If you see a watermark, it was not added with PDF Reader Pro and therefore cannot be detected.", comment: "")
+            alert.addButton(withTitle: KMLocalizedString("Confirm", comment: ""))
             alert.runModal()
             return
         }
         
         let alert = NSAlert()
         alert.alertStyle = .warning
-        alert.messageText = NSLocalizedString("Are you sure you want to remove the watermark?", comment: "")
-        alert.addButton(withTitle: NSLocalizedString("Delete", comment: ""))
-        alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
+        alert.messageText = KMLocalizedString("Are you sure you want to remove the watermark?", comment: "")
+        alert.addButton(withTitle: KMLocalizedString("Delete", comment: ""))
+        alert.addButton(withTitle: KMLocalizedString("Cancel", comment: ""))
         let result = alert.runModal()
         if (result == .alertFirstButtonReturn) {
             for watermark in watermarks! {
@@ -2165,9 +2165,9 @@ struct KMNMWCFlags {
     func removePDFBackground() {
         let alert = NSAlert()
         alert.alertStyle = .warning
-        alert.messageText = NSLocalizedString("Are you sure you want to remove the background?", comment: "")
-        alert.addButton(withTitle: NSLocalizedString("Delete", comment: ""))
-        alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
+        alert.messageText = KMLocalizedString("Are you sure you want to remove the background?", comment: "")
+        alert.addButton(withTitle: KMLocalizedString("Delete", comment: ""))
+        alert.addButton(withTitle: KMLocalizedString("Cancel", comment: ""))
         let result = alert.runModal()
         if (result == .alertFirstButtonReturn) {
             let background = listView.document.background()
@@ -2238,9 +2238,9 @@ struct KMNMWCFlags {
         
         let alert = NSAlert()
         alert.alertStyle = .warning
-        alert.messageText = NSLocalizedString("Are you sure you want to remove the Header & Footer?", comment: "")
-        alert.addButton(withTitle: NSLocalizedString("Delete", comment: ""))
-        alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
+        alert.messageText = KMLocalizedString("Are you sure you want to remove the Header & Footer?", comment: "")
+        alert.addButton(withTitle: KMLocalizedString("Delete", comment: ""))
+        alert.addButton(withTitle: KMLocalizedString("Cancel", comment: ""))
         let result = alert.runModal()
         if (result == .alertFirstButtonReturn) {
             let headerFooter = listView.document.headerFooter()
@@ -2313,9 +2313,9 @@ struct KMNMWCFlags {
     func removePDFBates() {
         let alert = NSAlert()
         alert.alertStyle = .warning
-        alert.messageText = NSLocalizedString("Are you sure you want to remove the Bates?", comment: "")
-        alert.addButton(withTitle: NSLocalizedString("Delete", comment: ""))
-        alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
+        alert.messageText = KMLocalizedString("Are you sure you want to remove the Bates?", comment: "")
+        alert.addButton(withTitle: KMLocalizedString("Delete", comment: ""))
+        alert.addButton(withTitle: KMLocalizedString("Cancel", comment: ""))
         let result = alert.runModal()
         if (result == .alertFirstButtonReturn) {
             let bates = listView.document.bates()
@@ -2658,7 +2658,7 @@ struct KMNMWCFlags {
         if !(self.listView.document.allowsPrinting || self.listView.document.allowsCopying) {
             let alert = NSAlert()
             alert.alertStyle = .critical
-            alert.messageText = NSLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
+            alert.messageText = KMLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
             alert.runModal()
             return
         }
@@ -2677,7 +2677,7 @@ struct KMNMWCFlags {
             let lastPathName = fileURL?.deletingPathExtension().lastPathComponent ?? ""
             let tFileName = (String(format: "%@_Extract Images", lastPathName))
             let outputSavePanel = NSSavePanel()
-            outputSavePanel.title = NSLocalizedString("Save as PDF", comment: "")
+            outputSavePanel.title = KMLocalizedString("Save as PDF", comment: "")
             outputSavePanel.allowsOtherFileTypes = true
             outputSavePanel.isExtensionHidden = true
             outputSavePanel.canCreateDirectories = true
@@ -2685,7 +2685,7 @@ struct KMNMWCFlags {
             outputSavePanel.beginSheetModal(for: self.view.window!, completionHandler: { (result) in
                 if result == NSApplication.ModalResponse.OK {
                     DispatchQueue.main.async {
-                        self.beginProgressSheet(withMessage: NSLocalizedString("Extracting all pictures...", comment: "") + "...", maxValue: 0)
+                        self.beginProgressSheet(withMessage: KMLocalizedString("Extracting all pictures...", comment: "") + "...", maxValue: 0)
                         let tDestFile = outputSavePanel.url!.path
                         let uniquePath = KMExtractImageWindowController.createDestFolder(path: tDestFile, isUnique: false)
                         let pdfconverter = PDFConvertObject()
@@ -2734,7 +2734,7 @@ struct KMNMWCFlags {
         progress.window?.contentView?.wantsLayer = true
         progress.window?.contentView?.layer?.backgroundColor = NSColor.km_init(hex: "#36383B").cgColor
         progress.progressField.textColor = NSColor.white
-        progress.message = NSLocalizedString("Converting...", comment: "")
+        progress.message = KMLocalizedString("Converting...", comment: "")
         progressC = progress
         progressC?.message = message
         if maxValue > 0 {
@@ -2896,7 +2896,7 @@ struct KMNMWCFlags {
         if !pdfDoc.allowsCopying || !pdfDoc.allowsPrinting {
             let alert = NSAlert()
             alert.alertStyle = .critical
-            alert.messageText = NSLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
+            alert.messageText = KMLocalizedString("This is a secured document. Editing is not permitted.", comment: "")
             alert.runModal()
             return
         }
@@ -3069,7 +3069,7 @@ struct KMNMWCFlags {
     @objc func menuItemBookMarkClick_add(sender:NSMenuItem?) {
         if self.listView.document?.bookmark(forPageIndex: UInt(self.listView.currentPageIndex)) == nil {
             let index = self.listView.currentPageIndex
-            self.listView.document?.addBookmark("\(NSLocalizedString("Page", comment: "")) \(index+1)", forPageIndex: UInt(index))
+            self.listView.document?.addBookmark("\(KMLocalizedString("Page", comment: "")) \(index+1)", forPageIndex: UInt(index))
             self.listView.updateRender(true)
         } else {
             self.listView.document?.removeBookmark(forPageIndex: UInt(self.listView.currentPageIndex))
@@ -3558,7 +3558,7 @@ extension KMMainViewController {
                 }
             } else {
                 let alert = NSAlert()
-                alert.messageText = NSLocalizedString("Compress Faild", comment: "")
+                alert.messageText = KMLocalizedString("Compress Faild", comment: "")
                 alert.runModal()
             }
         }
@@ -4727,18 +4727,18 @@ extension KMMainViewController: KMEditToolbarViewDelegate {
         if view.applyEnable {
             let alert = NSAlert()
             if view.editType == .watermark {
-                alert.messageText = NSLocalizedString("There are unapplied Watermark settings, do you want to apply them?", comment: "")
+                alert.messageText = KMLocalizedString("There are unapplied Watermark settings, do you want to apply them?", comment: "")
             } else if view.editType == .background {
-                alert.messageText = NSLocalizedString("There are unapplied Background settings, do you want to apply them?", comment: "")
+                alert.messageText = KMLocalizedString("There are unapplied Background settings, do you want to apply them?", comment: "")
             } else if view.editType == .header_Footer {
-                alert.messageText = NSLocalizedString("There are unapplied Header & Footer settings, do you want to apply them?", comment: "")
+                alert.messageText = KMLocalizedString("There are unapplied Header & Footer settings, do you want to apply them?", comment: "")
             } else if view.editType == .bates {
-                alert.messageText = NSLocalizedString("There are unapplied Bates settings, do you want to apply them?", comment: "")
+                alert.messageText = KMLocalizedString("There are unapplied Bates settings, do you want to apply them?", comment: "")
             }
-            alert.informativeText = NSLocalizedString("If not, the changes will be lost.", comment: "")
-            alert.addButton(withTitle: NSLocalizedString("Apply", comment: ""))
-            alert.addButton(withTitle: NSLocalizedString("Don't Apply", comment: ""))
-            alert.addButton(withTitle: NSLocalizedString("Cancel", comment: ""))
+            alert.informativeText = KMLocalizedString("If not, the changes will be lost.", comment: "")
+            alert.addButton(withTitle: KMLocalizedString("Apply", comment: ""))
+            alert.addButton(withTitle: KMLocalizedString("Don't Apply", comment: ""))
+            alert.addButton(withTitle: KMLocalizedString("Cancel", comment: ""))
             let result = alert.runModal()
             if (result == .alertFirstButtonReturn) {
                 self.kmEditToolbarViewDidChooseApply(view)
@@ -5043,9 +5043,9 @@ extension KMMainViewController: CPDFViewDelegate,CPDFListViewDelegate {
         } else {
             let alert = NSAlert()
             alert.alertStyle = .critical
-            alert.informativeText = NSLocalizedString("The hyperlink is invalid.", comment: "")
+            alert.informativeText = KMLocalizedString("The hyperlink is invalid.", comment: "")
             alert.messageText = ""
-            alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+            alert.addButton(withTitle: KMLocalizedString("OK", comment: ""))
             alert.runModal()
             return
         }
@@ -7026,9 +7026,9 @@ extension KMMainViewController {
     
     func removeAllAnnotations() {
         let alert = NSAlert()
-        alert.messageText = NSLocalizedString("This will permanently remove all annotations. Are you sure to continue?", comment: "")
-        alert.addButton(withTitle: NSLocalizedString("Yes", comment:""))
-        alert.addButton(withTitle: NSLocalizedString("No", comment:""))
+        alert.messageText = KMLocalizedString("This will permanently remove all annotations. Are you sure to continue?", comment: "")
+        alert.addButton(withTitle: KMLocalizedString("Yes", comment:""))
+        alert.addButton(withTitle: KMLocalizedString("No", comment:""))
         if (alert.runModal() != .alertFirstButtonReturn) {
             return
         }
@@ -7479,7 +7479,7 @@ extension KMMainViewController {
     internal func saveDocumentWithProgressAlert(callback:@escaping KMCommonBlock) {
         // 显示进度
         AutoSaveManager.manager.isSaving = true
-        self.showProgressWindow(message: NSLocalizedString("Save", comment: "") + "PDF")
+        self.showProgressWindow(message: KMLocalizedString("Save", comment: "") + "PDF")
         self.progressC?.maxValue = 3.0
         self.progressC?.increment(by: 1.0)
         // 保存文档
@@ -7863,10 +7863,10 @@ extension KMMainViewController {
             
             // 保存到钥匙串
             let alert = NSAlert()
-            alert.messageText = NSLocalizedString("Remember Password?", comment: "")
-            alert.informativeText = NSLocalizedString("Do you want to save this password in your Keychain?", comment: "")
-            alert.addButton(withTitle: NSLocalizedString("Yes", comment: ""))
-            alert.addButton(withTitle: NSLocalizedString("No", comment: ""))
+            alert.messageText = KMLocalizedString("Remember Password?", comment: "")
+            alert.informativeText = KMLocalizedString("Do you want to save this password in your Keychain?", comment: "")
+            alert.addButton(withTitle: KMLocalizedString("Yes", comment: ""))
+            alert.addButton(withTitle: KMLocalizedString("No", comment: ""))
             if (alert.runModal() == .alertFirstButtonReturn) { // 保存密码
                 self.myDocument?.savePasswordInKeychain(self.listView.document.password, self.listView.document)
                 return