From 65d9931b506a06b9be588a07c1440b1ba0133165 Mon Sep 17 00:00:00 2001 From: Azuma Kasumi Date: Fri, 18 Feb 2022 17:52:00 +0900 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A4=9A=E8=A8=80=E8=AA=9E=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AgileWorks.xcodeproj/project.pbxproj | 48 ++++++- AgileWorks/AgileWorks/App/AppShared.swift | 2 +- .../App/zh-Hans.lproj/LaunchScreen.strings | 1 + .../App/zh-Hant.lproj/LaunchScreen.strings | 1 + .../View/Cell/ModalCollectionViewCell.swift | 6 +- .../Form/View/FormWebViewController.swift | 14 +- .../FormWebViewScriptMessageHandler.swift | 4 +- .../Login/View/LoginViewController.storyboard | 83 ++++++++--- .../Login/View/LoginViewController.swift | 84 +++++++++-- .../Main/Builder/MainTabBarViewBuilder.swift | 20 +-- .../Splash/View/SplashViewController.swift | 6 +- .../Strings/Chinese-Simplified.strings | 136 ++++++++++++++++++ .../Strings/Chinese-Traditional.strings | 136 ++++++++++++++++++ AgileWorks/AgileWorks/Strings/English.strings | 136 ++++++++++++++++++ .../AgileWorks/Strings/Japanese.strings | 136 ++++++++++++++++++ .../en.lproj/Localizable.strings | 2 + .../ja.lproj/Localizable.strings | 2 + .../Strings/zh-Hans.lproj/Localizable.strings | 136 ++++++++++++++++++ .../Strings/zh-Hant.lproj/Localizable.strings | 136 ++++++++++++++++++ .../WebView/View/WebViewController.swift | 24 ++-- .../View/WebViewScriptMessageHandler.swift | 4 +- .../Common/DataStore/Configuration.swift | 3 + .../Common/DataStore/KeychainDataStore.swift | 16 +++ .../Common/Utility/StringsUtility.swift | 46 ++++++ AgileWorks/Podfile | 1 + AgileWorks/Podfile.lock | 6 +- .../View/zh-Hans.lproj/MainInterface.strings | 15 ++ .../View/zh-Hant.lproj/MainInterface.strings | 15 ++ .../View/zh-Hans.lproj/MainInterface.strings | 1 + .../View/zh-Hant.lproj/MainInterface.strings | 1 + 30 files changed, 1149 insertions(+), 72 deletions(-) create mode 100644 AgileWorks/AgileWorks/App/zh-Hans.lproj/LaunchScreen.strings create mode 100644 AgileWorks/AgileWorks/App/zh-Hant.lproj/LaunchScreen.strings create mode 100644 AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings create mode 100644 AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings create mode 100644 AgileWorks/AgileWorks/Strings/English.strings create mode 100644 AgileWorks/AgileWorks/Strings/Japanese.strings rename AgileWorks/AgileWorks/{ => Strings}/en.lproj/Localizable.strings (98%) rename AgileWorks/AgileWorks/{ => Strings}/ja.lproj/Localizable.strings (98%) create mode 100644 AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings create mode 100644 AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings create mode 100644 AgileWorks/Common/Utility/StringsUtility.swift create mode 100644 AgileWorks/ShareExtension/View/zh-Hans.lproj/MainInterface.strings create mode 100644 AgileWorks/ShareExtension/View/zh-Hant.lproj/MainInterface.strings create mode 100644 AgileWorks/TodayExtension/View/zh-Hans.lproj/MainInterface.strings create mode 100644 AgileWorks/TodayExtension/View/zh-Hant.lproj/MainInterface.strings diff --git a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj index 6d7fe24..b95df62 100644 --- a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj +++ b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj @@ -24,6 +24,11 @@ 3AED7EE42449387600FC6BCC /* SearchResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AED7EE32449387600FC6BCC /* SearchResponse.swift */; }; 3AF4A84524A06A73006C0C0A /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 3AF4A84724A06A73006C0C0A /* Localizable.strings */; }; 430C967B2E966FC047726763 /* Pods_All_AgileWorks.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CF516C40B9AA44C977664C98 /* Pods_All_AgileWorks.framework */; }; + 75917F9C27BDF0F10051E201 /* Japanese.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9B27BDF0F10051E201 /* Japanese.strings */; }; + 75917F9E27BDF1C30051E201 /* English.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9D27BDF1C30051E201 /* English.strings */; }; + 75917FA027BDF2050051E201 /* Chinese-Simplified.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9F27BDF2050051E201 /* Chinese-Simplified.strings */; }; + 75917FA227BDF2250051E201 /* Chinese-Traditional.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917FA127BDF2250051E201 /* Chinese-Traditional.strings */; }; + 75917FA427BE06940051E201 /* StringsUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75917FA327BE06940051E201 /* StringsUtility.swift */; }; 7604950425380980000D6951 /* FirebaseSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7604950325380980000D6951 /* FirebaseSupport.swift */; }; 761F49E2255511A1007708D8 /* NumberUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761F49E1255511A1007708D8 /* NumberUtility.swift */; }; 761F4A0925551FCF007708D8 /* NumberUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761F49E1255511A1007708D8 /* NumberUtility.swift */; }; @@ -188,6 +193,19 @@ 3AED7EE32449387600FC6BCC /* SearchResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResponse.swift; sourceTree = ""; }; 3AF4A84624A06A73006C0C0A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; 3AF4A84824A06AD0006C0C0A /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; + 75917F8F27BD315A0051E201 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/LaunchScreen.strings"; sourceTree = ""; }; + 75917F9027BD315A0051E201 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/MainInterface.strings"; sourceTree = ""; }; + 75917F9127BD315A0051E201 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/MainInterface.strings"; sourceTree = ""; }; + 75917F9227BD315A0051E201 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; + 75917F9327BD317D0051E201 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/LaunchScreen.strings"; sourceTree = ""; }; + 75917F9427BD317D0051E201 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/MainInterface.strings"; sourceTree = ""; }; + 75917F9527BD317D0051E201 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/MainInterface.strings"; sourceTree = ""; }; + 75917F9627BD317E0051E201 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = ""; }; + 75917F9B27BDF0F10051E201 /* Japanese.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = Japanese.strings; sourceTree = ""; }; + 75917F9D27BDF1C30051E201 /* English.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = English.strings; sourceTree = ""; }; + 75917F9F27BDF2050051E201 /* Chinese-Simplified.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = "Chinese-Simplified.strings"; sourceTree = ""; }; + 75917FA127BDF2250051E201 /* Chinese-Traditional.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = "Chinese-Traditional.strings"; sourceTree = ""; }; + 75917FA327BE06940051E201 /* StringsUtility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringsUtility.swift; sourceTree = ""; }; 7604950325380980000D6951 /* FirebaseSupport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirebaseSupport.swift; sourceTree = ""; }; 761F49E1255511A1007708D8 /* NumberUtility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberUtility.swift; sourceTree = ""; }; 761F4A48255D15DA007708D8 /* AppShared.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppShared.swift; sourceTree = ""; }; @@ -395,12 +413,25 @@ path = Main; sourceTree = ""; }; + 75917F9A27BDEC880051E201 /* Strings */ = { + isa = PBXGroup; + children = ( + 3AF4A84724A06A73006C0C0A /* Localizable.strings */, + 75917F9B27BDF0F10051E201 /* Japanese.strings */, + 75917F9D27BDF1C30051E201 /* English.strings */, + 75917F9F27BDF2050051E201 /* Chinese-Simplified.strings */, + 75917FA127BDF2250051E201 /* Chinese-Traditional.strings */, + ); + path = Strings; + sourceTree = ""; + }; 761F49E025551159007708D8 /* Utility */ = { isa = PBXGroup; children = ( 761F49E1255511A1007708D8 /* NumberUtility.swift */, 764D0E1A2580ABCB00AB6617 /* URLAuthenticationUtility.swift */, 76AE52DC25D35CDC00AFA45A /* LicenseUtility.swift */, + 75917FA327BE06940051E201 /* StringsUtility.swift */, ); path = Utility; sourceTree = ""; @@ -736,7 +767,7 @@ 76AE52DB25D358D700AFA45A /* License */, BDEB7D8D23F5293800EFAF31 /* Podfile */, BDA1832823F406A600C9A6DD /* README.md */, - 3AF4A84724A06A73006C0C0A /* Localizable.strings */, + 75917F9A27BDEC880051E201 /* Strings */, ); path = AgileWorks; sourceTree = ""; @@ -956,6 +987,8 @@ en, Base, ja, + "zh-Hans", + "zh-Hant", ); mainGroup = BDA1830623F3FD7F00C9A6DD; productRefGroup = BDA1831023F3FD7F00C9A6DD /* Products */; @@ -999,15 +1032,19 @@ BDA1831C23F3FD8000C9A6DD /* Assets.xcassets in Resources */, 76AE52D725D358A800AFA45A /* License.rtf in Resources */, 76AE52FB25D3624200AFA45A /* LicenseViewController.storyboard in Resources */, + 75917F9E27BDF1C30051E201 /* English.strings in Resources */, BDA1832923F406A600C9A6DD /* README.md in Resources */, EVOMTNLDKX75D3I1FNY2QSS7 /* SplashViewController.storyboard in Resources */, 3AF4A84524A06A73006C0C0A /* Localizable.strings in Resources */, CRJ55ZZNLTXIY1R10AXQL1VZ /* LoginViewController.storyboard in Resources */, + 75917FA027BDF2050051E201 /* Chinese-Simplified.strings in Resources */, BDA1832F23F40F1000C9A6DD /* Colors.xcassets in Resources */, BD917FD82473C800005D2437 /* FormWebViewController.storyboard in Resources */, + 75917F9C27BDF0F10051E201 /* Japanese.strings in Resources */, BDA6D6A52411FFAA00FA9C33 /* Settings.bundle in Resources */, 76C4996C24E5097200759B93 /* GoogleService-Info-Production.plist in Resources */, I07ZJPNVIS069WBRK1L3WPOY /* MainViewController.storyboard in Resources */, + 75917FA227BDF2250051E201 /* Chinese-Traditional.strings in Resources */, 3A1F975224AF2D0000AE6A42 /* ModalFullCollectionViewController.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1198,6 +1235,7 @@ 76AE530025D3626800AFA45A /* LicenseViewController.swift in Sources */, BDAB1F6D240D0D0000EA15FD /* UserDefaultsExtensions.swift in Sources */, 76C7AA02250B05CA000A0FE6 /* SubWebViewStack.swift in Sources */, + 75917FA427BE06940051E201 /* StringsUtility.swift in Sources */, BD969631240C9CD400521925 /* SessionInfo.swift in Sources */, BD928CCE2407500400ED04C2 /* UserDefaultsDataStore.swift in Sources */, BD5061B4242866780014F3FA /* Configuration.swift in Sources */, @@ -1238,6 +1276,8 @@ isa = PBXVariantGroup; children = ( 3127EE11241A2A9500535CC7 /* Base */, + 75917F9027BD315A0051E201 /* zh-Hans */, + 75917F9427BD317D0051E201 /* zh-Hant */, ); name = MainInterface.storyboard; sourceTree = ""; @@ -1247,6 +1287,8 @@ children = ( 3AF4A84624A06A73006C0C0A /* en */, 3AF4A84824A06AD0006C0C0A /* ja */, + 75917F9227BD315A0051E201 /* zh-Hans */, + 75917F9627BD317E0051E201 /* zh-Hant */, ); name = Localizable.strings; sourceTree = ""; @@ -1255,6 +1297,8 @@ isa = PBXVariantGroup; children = ( 7672AD6E257EFF500063884A /* Base */, + 75917F9127BD315A0051E201 /* zh-Hans */, + 75917F9527BD317D0051E201 /* zh-Hant */, ); name = MainInterface.storyboard; sourceTree = ""; @@ -1263,6 +1307,8 @@ isa = PBXVariantGroup; children = ( BDA1831E23F3FD8000C9A6DD /* Base */, + 75917F8F27BD315A0051E201 /* zh-Hans */, + 75917F9327BD317D0051E201 /* zh-Hant */, ); name = LaunchScreen.storyboard; sourceTree = ""; diff --git a/AgileWorks/AgileWorks/App/AppShared.swift b/AgileWorks/AgileWorks/App/AppShared.swift index 71a9d02..c9e5639 100644 --- a/AgileWorks/AgileWorks/App/AppShared.swift +++ b/AgileWorks/AgileWorks/App/AppShared.swift @@ -39,5 +39,5 @@ class AppShared { func appVersionLabelText() -> String { let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String - return String(format: NSLocalizedString("AppVersion", comment: ""), version) + return String(format: getStrings(key: "AppVersion", comment: ""), version) } diff --git a/AgileWorks/AgileWorks/App/zh-Hans.lproj/LaunchScreen.strings b/AgileWorks/AgileWorks/App/zh-Hans.lproj/LaunchScreen.strings new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/AgileWorks/AgileWorks/App/zh-Hans.lproj/LaunchScreen.strings @@ -0,0 +1 @@ + diff --git a/AgileWorks/AgileWorks/App/zh-Hant.lproj/LaunchScreen.strings b/AgileWorks/AgileWorks/App/zh-Hant.lproj/LaunchScreen.strings new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/AgileWorks/AgileWorks/App/zh-Hant.lproj/LaunchScreen.strings @@ -0,0 +1 @@ + diff --git a/AgileWorks/AgileWorks/Form/View/Cell/ModalCollectionViewCell.swift b/AgileWorks/AgileWorks/Form/View/Cell/ModalCollectionViewCell.swift index 92d7742..19dae7c 100644 --- a/AgileWorks/AgileWorks/Form/View/Cell/ModalCollectionViewCell.swift +++ b/AgileWorks/AgileWorks/Form/View/Cell/ModalCollectionViewCell.swift @@ -84,8 +84,8 @@ class ModalCollectionViewCell: UICollectionViewCell { // naviBtns.enabled に override.enabled の内容も反映されているが処理の対称性のために両方見ておく。 textLabel.isEnabled = override?.enabled ?? naviBtns.enabled isUserInteractionEnabled = naviBtns.enabled ? true : false - layer.borderColor = naviBtns.enabled ? UIColor(named: NSLocalizedString("MainColor", comment: ""))!.cgColor : UIColor(named: NSLocalizedString("ClickBtnColor", comment: ""))!.cgColor - textLabel.textColor = naviBtns.enabled ? UIColor(named: NSLocalizedString("MainColor", comment: ""))! : UIColor(named: NSLocalizedString("ClickBtnColor", comment: ""))! + layer.borderColor = naviBtns.enabled ? UIColor(named: getStrings(key: "MainColor", comment: ""))!.cgColor : UIColor(named: getStrings(key: "ClickBtnColor", comment: ""))!.cgColor + textLabel.textColor = naviBtns.enabled ? UIColor(named: getStrings(key: "MainColor", comment: ""))! : UIColor(named: getStrings(key: "ClickBtnColor", comment: ""))! if let size = textLabelSize { textLabel.sizeThatFits(size) } else { @@ -93,7 +93,7 @@ class ModalCollectionViewCell: UICollectionViewCell { textLabel.sizeToFit() } iconView.image = UIImage(named: getType(type: naviBtns.type).rawValue) - iconView.tintColor = naviBtns.enabled ? UIColor(named: NSLocalizedString("MainColor", comment: ""))! : UIColor(named: NSLocalizedString("ClickBtnColor", comment: ""))! + iconView.tintColor = naviBtns.enabled ? UIColor(named: getStrings(key: "MainColor", comment: ""))! : UIColor(named: getStrings(key: "ClickBtnColor", comment: ""))! setBadge(badge) } diff --git a/AgileWorks/AgileWorks/Form/View/FormWebViewController.swift b/AgileWorks/AgileWorks/Form/View/FormWebViewController.swift index c438cd5..e42c8b4 100644 --- a/AgileWorks/AgileWorks/Form/View/FormWebViewController.swift +++ b/AgileWorks/AgileWorks/Form/View/FormWebViewController.swift @@ -102,7 +102,7 @@ class FormWebViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - self.navigationController?.navigationBar.barTintColor = UIColor(named: NSLocalizedString("MainColor", comment: "")) + self.navigationController?.navigationBar.barTintColor = UIColor(named: getStrings(key: "MainColor", comment: "")) self.navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: UIColor.white] self.navigationController?.presentationController?.delegate = self // モーダルDismiss設定(iOS13のみ) @@ -118,7 +118,7 @@ class FormWebViewController: UIViewController { } self.navigationItem.title = self.formTitle - self.closeButton.title = NSLocalizedString("Close", comment: "") + self.closeButton.title = getStrings(key: "Close", comment: "") self.subWebViewStack.eventDelegate = self self.updateSession() } @@ -445,7 +445,7 @@ class FormWebViewController: UIViewController { extension FormWebViewController: SubWebViewStackEventDelegate { func onClose(webView: WKWebView, stack: SubWebViewStack) { if stack.isEmpty { - closeButton.title = NSLocalizedString("Close", comment: "") + closeButton.title = getStrings(key: "Close", comment: "") } } } @@ -674,7 +674,7 @@ extension FormWebViewController: WKUIDelegate { func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) { let alertController = UIAlertController(title: "", message: message, preferredStyle: .alert) - let okAction = UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default) { _ in + let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in completionHandler() } alertController.addAction(okAction) @@ -683,10 +683,10 @@ extension FormWebViewController: WKUIDelegate { func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) { let alertController = UIAlertController(title: "", message: message, preferredStyle: .alert) - let okAction = UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default) { _ in + let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in completionHandler(true) } - let cancelAction = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel) { _ in + let cancelAction = UIAlertAction(title: getStrings(key: "Cancel", comment: ""), style: .cancel) { _ in completionHandler(false) } alertController.addAction(okAction) @@ -699,7 +699,7 @@ extension FormWebViewController: WKUIDelegate { let webView = WKWebView(frame: view.frame, configuration: configuration) webView.load(navigationAction.request) subWebViewStack.push(webView, superView: view) - closeButton.title = NSLocalizedString("Close Subwindow", comment: "") + closeButton.title = getStrings(key: "Close Subwindow", comment: "") return webView } return nil diff --git a/AgileWorks/AgileWorks/Form/View/FormWebViewScriptMessageHandler.swift b/AgileWorks/AgileWorks/Form/View/FormWebViewScriptMessageHandler.swift index e4f3c4c..f8264da 100644 --- a/AgileWorks/AgileWorks/Form/View/FormWebViewScriptMessageHandler.swift +++ b/AgileWorks/AgileWorks/Form/View/FormWebViewScriptMessageHandler.swift @@ -51,8 +51,8 @@ class FormWebViewScriptMessageHandler: NSObject { // パラメータ: なし "loggedOut": { controller, _, _ in DispatchQueue.main.async { - let alertController = UIAlertController(title: NSLocalizedString("LogoutAlertTitle", comment: ""), message: NSLocalizedString("LogoutAlertMessage", comment: ""), preferredStyle: .alert) - let okAction = UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default) { _ in + let alertController = UIAlertController(title: getStrings(key: "LogoutAlertTitle", comment: ""), message: getStrings(key: "LogoutAlertMessage", comment: ""), preferredStyle: .alert) + let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in controller.dismiss(animated: true, completion: nil) } alertController.addAction(okAction) diff --git a/AgileWorks/AgileWorks/Login/View/LoginViewController.storyboard b/AgileWorks/AgileWorks/Login/View/LoginViewController.storyboard index 655fd52..b732592 100644 --- a/AgileWorks/AgileWorks/Login/View/LoginViewController.storyboard +++ b/AgileWorks/AgileWorks/Login/View/LoginViewController.storyboard @@ -1,9 +1,9 @@ - + - + @@ -22,14 +22,64 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -81,7 +131,7 @@ - + + + + - + @@ -172,18 +229,10 @@ - - - - - @@ -195,6 +244,8 @@ + + diff --git a/AgileWorks/AgileWorks/Login/View/LoginViewController.swift b/AgileWorks/AgileWorks/Login/View/LoginViewController.swift index 0cd6087..cdcd7a2 100644 --- a/AgileWorks/AgileWorks/Login/View/LoginViewController.swift +++ b/AgileWorks/AgileWorks/Login/View/LoginViewController.swift @@ -8,12 +8,14 @@ import AuthenticationServices import AVFoundation +import DropDown import UIKit protocol LoginView: AnyObject { } class LoginViewController: UIViewController { + private let languageDropDown = DropDown() private let serverProtocol = "https://" private var contextPath = "AgileWorks" private var serverDirectory: String { @@ -21,6 +23,8 @@ class LoginViewController: UIViewController { } private static let kValidHostPattern = try? NSRegularExpression(pattern: #"^[-a-z0-9]+(?:\.[-a-z0-9]+)*\.?(?::\d+)?$"#, options: .caseInsensitive) + @IBOutlet private var languageView: UIView! + @IBOutlet private var languageLabel: UILabel! @IBOutlet private var appVersionLabel: UILabel! @IBOutlet private var serverTextField: UITextField! @IBOutlet private var loginButton: UIButton! @@ -57,9 +61,12 @@ class LoginViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() + createLanguageDropDown() + clientCertificateSettingView.isHidden = (CertificateDataStore().readClientCertificate() == nil) - qrCodeReadLabel.text = NSLocalizedString("QRCodeReadLabel", comment: "") + //固定文言表示 + loguinTranslation() appVersionLabel.text = appVersionLabelText() @@ -70,7 +77,7 @@ class LoginViewController: UIViewController { view.addSubview(activityIndicator) activityIndicator.frame = view.bounds - activityIndicator.backgroundColor = UIColor(named: NSLocalizedString("IndicatorBackgroud", comment: "")) + activityIndicator.backgroundColor = UIColor(named: getStrings(key: "IndicatorBackgroud", comment: "")) activityIndicator.translatesAutoresizingMaskIntoConstraints = false @@ -83,6 +90,58 @@ class LoginViewController: UIViewController { NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(_:)), name: UIResponder.keyboardWillHideNotification, object: nil) } + //言語選択(ドロップダウン)の作成 + private func createLanguageDropDown() { + //現在設定中の言語 + let language = getStrings(key: "Language", comment: "") + //プルダウンメニュー詳細設定 + languageView.layer.borderColor = UIColor.black.cgColor + languageView.layer.borderWidth = 0.5 + languageView.layer.cornerRadius = 5 + languageLabel.text = language + languageDropDown.anchorView = languageView + languageDropDown.dataSource = languageArray + languageDropDown.backgroundColor = UIColor.white + languageDropDown.cornerRadius = 10 + languageDropDown.selectRow(at: getLanguageIndex(stringsName: language)) + //言語が選択されたアクションは以下に記載する + languageDropDown.selectionAction = { [unowned self] (index: Int, item: String) in + languageDropDownAction(item: item) + } + } + + @IBAction private func languageTapped(_ sender: Any) { + //ドロップダウン表示 + languageDropDown.show() + } + + private func languageDropDownAction(item: String) { + languageLabel.text = item + //選択した言語をセットする + switch item { + case "English": + setStringsName(stringsName: "English") + case "日本語": + setStringsName(stringsName: "Japanese") + case "簡体字": + setStringsName(stringsName: "Chinese-Simplified") + case "繁体字": + setStringsName(stringsName: "Chinese-Traditional") + default: + setStringsName(stringsName: "Localizable") + languageLabel.text = getStrings(key: "Language", comment: "") + } + //ログイン画面の固定文言表示を変更する + loguinTranslation() + } + + //ログイン画面の固定文言表示 + private func loguinTranslation() { + loginButton.setTitle(getStrings(key: "LoginButton", comment: ""), for: .normal) + qrCodeReadLabel.text = getStrings(key: "QRCodeReadLabel", comment: "") + serverTextField.placeholder = getStrings(key: "ServerURLPlaceholder", comment: "") + } + override func touchesBegan(_ touches: Set, with event: UIEvent?) { self.view.endEditing(true) } @@ -93,10 +152,8 @@ class LoginViewController: UIViewController { @IBAction private func loginTapped() { guard let serverHost = serverHost else { return } - disableLogin() - print(contextPath) KeychainDataStore().writeServerURL(serverURL: serverHost) KeychainDataStore().writeContextPath(contextPath: contextPath) @@ -109,8 +166,8 @@ class LoginViewController: UIViewController { case .failure(let error): log.e(error) DispatchQueue.main.async { - let message = NSLocalizedString("LoginErrorMessage", comment: "") - let okAction = UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: nil) + let message = getStrings(key: "LoginErrorMessage", comment: "") + let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default, handler: nil) AppDelegate.shared.rootViewController.showAlertScreen(view: self, title: "", message: message, defaultAction: okAction, cancelAction: nil) self.enableLogin() } @@ -127,19 +184,18 @@ class LoginViewController: UIViewController { // 読み込めるカメラ範囲設定 qrCodeReader.readRange() // ガイダンス設定 - qrCodeReader.setCameraGuide(guide: NSLocalizedString("QRCodeReadGuidance", comment: "")) + qrCodeReader.setCameraGuide(guide: getStrings(key: "QRCodeReadGuidance", comment: "")) } else { qrCodeReader.delegate = nil // カメラ起動失敗 - let message = NSLocalizedString("CameraStartupErrorMessage", comment: "") - let defaultAction = UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default) { _ in } + let message = getStrings(key: "CameraStartupErrorMessage", comment: "") + let defaultAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in } AppDelegate.shared.rootViewController.showAlertScreen(view: self, title: "", message: message, defaultAction: defaultAction, cancelAction: nil) } } private func updateCloudUsage() { - serverTextField.placeholder = NSLocalizedString("ServerURLPlaceholder", comment: "") - + serverTextField.placeholder = getStrings(key: "ServerURLPlaceholder", comment: "") loginButton.isEnabled = isValidInput(server: serverTextField.text) } @@ -175,12 +231,12 @@ class LoginViewController: UIViewController { } @IBAction private func clientCertificateRemovalTapped(_ sender: Any) { - let alertController = UIAlertController(title: "", message: NSLocalizedString("ClientCertificateRemovalConfirmation", comment: ""), preferredStyle: .alert) - let okAction = UIAlertAction(title: NSLocalizedString("ClientCertificateRemovalOK", comment: ""), style: .default) { _ in + let alertController = UIAlertController(title: "", message: getStrings(key: "ClientCertificateRemovalConfirmation", comment: ""), preferredStyle: .alert) + let okAction = UIAlertAction(title:getStrings(key: "ClientCertificateRemovalOK", comment: ""), style: .default) { _ in CertificateDataStore().removeClientCertificate() self.clientCertificateSettingView.isHidden = true } - let cancelAction = UIAlertAction(title: NSLocalizedString("ClientCertificateRemovalCancel", comment: ""), style: .cancel, handler: nil) + let cancelAction = UIAlertAction(title: getStrings(key: "ClientCertificateRemovalCancel", comment: ""), style: .cancel, handler: nil) alertController.addAction(okAction) alertController.addAction(cancelAction) present(alertController, animated: true, completion: nil) diff --git a/AgileWorks/AgileWorks/Main/Builder/MainTabBarViewBuilder.swift b/AgileWorks/AgileWorks/Main/Builder/MainTabBarViewBuilder.swift index cfa0b6f..60c0c86 100644 --- a/AgileWorks/AgileWorks/Main/Builder/MainTabBarViewBuilder.swift +++ b/AgileWorks/AgileWorks/Main/Builder/MainTabBarViewBuilder.swift @@ -60,35 +60,35 @@ extension MainTabBarViewBuilderImpl { let viewVC = view.viewControllers[view.viewControllers.count - 1] as! WebViewController switch type { case ViewType.home.rawValue: - view.tabBarItem.title = NSLocalizedString("HomeTitle", comment: "") + view.tabBarItem.title = getStrings(key: "HomeTitle", comment: "") //view.tabBarItem.image = "" //view.tabBarItem.selectedItem = "" viewVC.loadURL = createLoadUrl(urlPath: ViewURL.home.rawValue) - viewVC.naviTitle = NSLocalizedString("HomeTitle", comment: "") + viewVC.naviTitle = getStrings(key: "HomeTitle", comment: "") case ViewType.work.rawValue: - view.tabBarItem.title = NSLocalizedString("WorkTitle", comment: "") + view.tabBarItem.title = getStrings(key: "WorkTitle", comment: "") //view.tabBarItem.image = "" //view.tabBarItem.selectedItem = "" viewVC.loadURL = createLoadUrl(urlPath: ViewURL.work.rawValue) - viewVC.naviTitle = NSLocalizedString("WorkTitle", comment: "") + viewVC.naviTitle = getStrings(key: "WorkTitle", comment: "") case ViewType.documents.rawValue: - view.tabBarItem.title = NSLocalizedString("DocumentsTitle", comment: "") + view.tabBarItem.title = getStrings(key: "DocumentsTitle", comment: "") //view.tabBarItem.image = "" //view.tabBarItem.selectedItem = "" viewVC.loadURL = ViewURL.documents.rawValue - viewVC.naviTitle = NSLocalizedString("DocumentsTitle", comment: "") + viewVC.naviTitle = getStrings(key: "DocumentsTitle", comment: "") case ViewType.search.rawValue: - view.tabBarItem.title = NSLocalizedString("SearchTitle", comment: "") + view.tabBarItem.title = getStrings(key: "SearchTitle", comment: "") //view.tabBarItem.image = "" //view.tabBarItem.selectedItem = "" viewVC.loadURL = createLoadUrl(urlPath: ViewURL.search.rawValue) - viewVC.naviTitle = NSLocalizedString("SearchTitle", comment: "") + viewVC.naviTitle = getStrings(key: "SearchTitle", comment: "") default: - view.tabBarItem.title = NSLocalizedString("HomeTitle", comment: "") + view.tabBarItem.title = getStrings(key: "HomeTitle", comment: "") //view.tabBarItem.image = "" //view.tabBarItem.selectedItem = "" viewVC.loadURL = createLoadUrl(urlPath: ViewURL.home.rawValue) - viewVC.naviTitle = NSLocalizedString("HomeTitle", comment: "") + viewVC.naviTitle = getStrings(key: "HomeTitle", comment: "") } return view } diff --git a/AgileWorks/AgileWorks/Splash/View/SplashViewController.swift b/AgileWorks/AgileWorks/Splash/View/SplashViewController.swift index 0eac421..a1d963c 100644 --- a/AgileWorks/AgileWorks/Splash/View/SplashViewController.swift +++ b/AgileWorks/AgileWorks/Splash/View/SplashViewController.swift @@ -29,10 +29,10 @@ class SplashViewController: UIViewController { super.viewDidLoad() logoImage.tintColor = .white - self.view.backgroundColor = UIColor(named: NSLocalizedString("MainColor", comment: "")) + self.view.backgroundColor = UIColor(named: getStrings(key: "MainColor", comment: "")) view.addSubview(activityIndicator) activityIndicator.frame = view.bounds - activityIndicator.backgroundColor = UIColor(named: NSLocalizedString("IndicatorBackgroud", comment: "")) + activityIndicator.backgroundColor = UIColor(named: getStrings(key: "IndicatorBackgroud", comment: "")) activityIndicator.translatesAutoresizingMaskIntoConstraints = false @@ -54,7 +54,7 @@ class SplashViewController: UIViewController { var error: NSError? if context.canEvaluatePolicy(.deviceOwnerAuthentication, error: &error) { - context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: NSLocalizedString("Auth", comment: "")) { sucess, error in + context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: getStrings(key: "Auth", comment: "")) { sucess, error in if sucess { self.freshToken() } else { diff --git a/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings b/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings new file mode 100644 index 0000000..523255d --- /dev/null +++ b/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings @@ -0,0 +1,136 @@ +/* + Chinese-Simplified.strings + AgileWorks + + Created by Azuma Kasumi on 2022/02/17. + Copyright © 2022 ATLED CORP. All rights reserved. +*/ + +// Splash +"Auth" = "認証"; + +// Version +"AppVersion" = "App ver. %@"; + +// Login +"Language" = "簡体字"; +"ServerURLPlaceholder" = "AgileWorksサーバ"; +"LoginButton" = "接続"; +"QRCodeReadLabel" = "QRコードリード"; +"QRCodeReadGuidance" = "ログインQRコードを読み込んでください"; +"ClientCertificateRemovalConfirmation" = "クライアント証明書の設定を削除します。よろしいですか?"; +"ClientCertificateRemovalOK" = "削除"; +"ClientCertificateRemovalCancel" = "キャンセル"; +"LoginErrorMessage" = "ログインに失敗しました。再度ログインしてください。"; +"CameraStartupErrorMessage" = "カメラの起動に失敗しました。"; + +// WebView +"HomeTitle" = "HOME"; +"WorkTitle" = "仕事"; +"DocumentsTitle" = "書類作成"; +"SearchTitle" = "検索"; + +// Approval +"ApprovalTitle" = "承認一覧"; +"ApprovalData" = "%1$@ (%2$@)"; + +// Approval Detail, Search Result +"Number" = "No. %d"; +"Form" = "%@"; +"Draft" = "下書き"; +"Approving" = "承認中"; +"Hold" = "保留"; +"Reject" = "却下"; +"RejectDraft" = "差し戻し"; +"RejectAuthorize" = "差し戻し"; +"SendBack" = "起票者へ差し戻し"; +"Remand" = "承認者へ差し戻し"; +"Approved" = "承認完了"; +"Request" = "申請: %1$@"; +"Update" = "更新: %1$@"; +"Approvers" = "承認者: [%@]"; +"Total" = " %@件 "; + +// Submission +"SubmissionTitle" = "提出一覧"; +"SubmissionData" = "%1$@ (%2$@)"; +"AutoSelectRoute" = "(自動選択ルート)"; + +// Submission Detail +"SubmissionName" = "%@"; +"SubmissionRoute" = "%@"; + +// Search +"FormName" = "フォーム名"; +"DocNumber" = "書類 No"; +"Subject" = "件名"; +"FalseDocButton" = "書類Noは数値のみ入力可能"; + +// Search Result +"SearchResultTitle" = "検索結果"; +"SearchNoData" = "条件に一致する結果は見つかりませんでした"; +"Loading" = "検索中"; + +"NoData" = "データがありません"; + +// Refresh Token Error +"RefreshTokenUpdateErrorTitle" = "アクセストークン更新エラー"; +"RefreshTokenUpdateError" = "AgileWorksサーバへアクセスするためのトークンの更新が行えませんでした。\n再ログインする必要があります。"; + +// Network Error Message +"UnknownNetworkError" = "ネットワークエラーが発生しました"; +"NotConnectNetworkError" = "インターネットにアクセスするにはモバイルデータ通信をオンにするかWi-Fiを利用してください"; +"TimedOutNetworkError" = "インターネットに接続できません\nしばらく経ってから再度おためしください"; + +// Setting +"SettingTitle" = "設定"; +"Domain" = "所属ドメイン"; +"Name" = "氏名"; +"Character" = "カナ"; +"primaryGroupName" = "所属"; +"PrimaryGroupPartName" = "役職"; +"LogoutConfirm" = "ログアウトしますか?"; +"YES" = "はい"; +"NO" = "いいえ"; + +// Form +"OK" = "OK"; +"Cancel" = "Cancel"; +"Close" = "Close"; +"Close Subwindow" = "Close Subwindow"; + +// Form (ログアウト通知) +"LogoutAlertTitle" = "ログアウト通知"; +"LogoutAlertMessage"= "セッションタイムアウトによりログアウトしました。書類を開き直してください。"; + +// Color +"MainColor" = "DarkMauve"; +"IndicatorBackgroud" = "IndicatorBackgroud"; +"SectionColor" = "DarkGray"; +"SeparatorColor" = "PastelGray"; +"SelectCellBgColor" = "PastelGray"; +"DraftColor" = "Gray"; +"ApprovingColor" = "Orange"; +"HoldColor" = "DarkMauve"; +"RejectColor" = "Red"; +"RemandColor" = "Blue"; +"ApprovedColor" = "Green"; +"ClickBtnColor" = "Mouse"; + +// Image +"HeaderIcon" = "folder"; +"HeaderRightIcon" = "right"; +"checkIcon" = "CheckIcon"; +"checkNoIcon" = "CheckNoIcon"; + +// TodayExtension +"NotLogedin" = "アプリからログインしてください"; + +// WfAction +"WfApprove" = "Approve"; +"WfSuspend" = "Suspend"; + +// ShareExtension +"CertificateImportSuccess" = "クライアント証明書をインポートしました。"; +"IncorrectPassphrase" = "パスフレーズが違います。"; +"CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; diff --git a/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings b/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings new file mode 100644 index 0000000..2ff74ff --- /dev/null +++ b/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings @@ -0,0 +1,136 @@ +/* + Chinese-Traditional.strings + AgileWorks + + Created by Azuma Kasumi on 2022/02/17. + Copyright © 2022 ATLED CORP. All rights reserved. +*/ + +// Splash +"Auth" = "認証"; + +// Version +"AppVersion" = "App ver. %@"; + +// Login +"Language" = "繁体字"; +"ServerURLPlaceholder" = "AgileWorksサーバ"; +"LoginButton" = "接続"; +"QRCodeReadLabel" = "QRコードリード"; +"QRCodeReadGuidance" = "ログインQRコードを読み込んでください"; +"ClientCertificateRemovalConfirmation" = "クライアント証明書の設定を削除します。よろしいですか?"; +"ClientCertificateRemovalOK" = "削除"; +"ClientCertificateRemovalCancel" = "キャンセル"; +"LoginErrorMessage" = "ログインに失敗しました。再度ログインしてください。"; +"CameraStartupErrorMessage" = "カメラの起動に失敗しました。"; + +// WebView +"HomeTitle" = "HOME"; +"WorkTitle" = "仕事"; +"DocumentsTitle" = "書類作成"; +"SearchTitle" = "検索"; + +// Approval +"ApprovalTitle" = "承認一覧"; +"ApprovalData" = "%1$@ (%2$@)"; + +// Approval Detail, Search Result +"Number" = "No. %d"; +"Form" = "%@"; +"Draft" = "下書き"; +"Approving" = "承認中"; +"Hold" = "保留"; +"Reject" = "却下"; +"RejectDraft" = "差し戻し"; +"RejectAuthorize" = "差し戻し"; +"SendBack" = "起票者へ差し戻し"; +"Remand" = "承認者へ差し戻し"; +"Approved" = "承認完了"; +"Request" = "申請: %1$@"; +"Update" = "更新: %1$@"; +"Approvers" = "承認者: [%@]"; +"Total" = " %@件 "; + +// Submission +"SubmissionTitle" = "提出一覧"; +"SubmissionData" = "%1$@ (%2$@)"; +"AutoSelectRoute" = "(自動選択ルート)"; + +// Submission Detail +"SubmissionName" = "%@"; +"SubmissionRoute" = "%@"; + +// Search +"FormName" = "フォーム名"; +"DocNumber" = "書類 No"; +"Subject" = "件名"; +"FalseDocButton" = "書類Noは数値のみ入力可能"; + +// Search Result +"SearchResultTitle" = "検索結果"; +"SearchNoData" = "条件に一致する結果は見つかりませんでした"; +"Loading" = "検索中"; + +"NoData" = "データがありません"; + +// Refresh Token Error +"RefreshTokenUpdateErrorTitle" = "アクセストークン更新エラー"; +"RefreshTokenUpdateError" = "AgileWorksサーバへアクセスするためのトークンの更新が行えませんでした。\n再ログインする必要があります。"; + +// Network Error Message +"UnknownNetworkError" = "ネットワークエラーが発生しました"; +"NotConnectNetworkError" = "インターネットにアクセスするにはモバイルデータ通信をオンにするかWi-Fiを利用してください"; +"TimedOutNetworkError" = "インターネットに接続できません\nしばらく経ってから再度おためしください"; + +// Setting +"SettingTitle" = "設定"; +"Domain" = "所属ドメイン"; +"Name" = "氏名"; +"Character" = "カナ"; +"primaryGroupName" = "所属"; +"PrimaryGroupPartName" = "役職"; +"LogoutConfirm" = "ログアウトしますか?"; +"YES" = "はい"; +"NO" = "いいえ"; + +// Form +"OK" = "OK"; +"Cancel" = "Cancel"; +"Close" = "Close"; +"Close Subwindow" = "Close Subwindow"; + +// Form (ログアウト通知) +"LogoutAlertTitle" = "ログアウト通知"; +"LogoutAlertMessage"= "セッションタイムアウトによりログアウトしました。書類を開き直してください。"; + +// Color +"MainColor" = "DarkMauve"; +"IndicatorBackgroud" = "IndicatorBackgroud"; +"SectionColor" = "DarkGray"; +"SeparatorColor" = "PastelGray"; +"SelectCellBgColor" = "PastelGray"; +"DraftColor" = "Gray"; +"ApprovingColor" = "Orange"; +"HoldColor" = "DarkMauve"; +"RejectColor" = "Red"; +"RemandColor" = "Blue"; +"ApprovedColor" = "Green"; +"ClickBtnColor" = "Mouse"; + +// Image +"HeaderIcon" = "folder"; +"HeaderRightIcon" = "right"; +"checkIcon" = "CheckIcon"; +"checkNoIcon" = "CheckNoIcon"; + +// TodayExtension +"NotLogedin" = "アプリからログインしてください"; + +// WfAction +"WfApprove" = "Approve"; +"WfSuspend" = "Suspend"; + +// ShareExtension +"CertificateImportSuccess" = "クライアント証明書をインポートしました。"; +"IncorrectPassphrase" = "パスフレーズが違います。"; +"CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; diff --git a/AgileWorks/AgileWorks/Strings/English.strings b/AgileWorks/AgileWorks/Strings/English.strings new file mode 100644 index 0000000..f32cdc2 --- /dev/null +++ b/AgileWorks/AgileWorks/Strings/English.strings @@ -0,0 +1,136 @@ +/* + English.strings + AgileWorks + + Created by Azuma Kasumi on 2022/02/17. + Copyright © 2022 ATLED CORP. All rights reserved. +*/ + +// Splash +"Auth" = "認証"; + +// Version +"AppVersion" = "App ver. %@"; + +// Login +"Language" = "English"; +"ServerURLPlaceholder" = "AgileWorksサーバ"; +"LoginButton" = "接続"; +"QRCodeReadLabel" = "QRコードリード"; +"QRCodeReadGuidance" = "ログインQRコードを読み込んでください"; +"ClientCertificateRemovalConfirmation" = "クライアント証明書の設定を削除します。よろしいですか?"; +"ClientCertificateRemovalOK" = "削除"; +"ClientCertificateRemovalCancel" = "キャンセル"; +"LoginErrorMessage" = "ログインに失敗しました。再度ログインしてください。"; +"CameraStartupErrorMessage" = "カメラの起動に失敗しました。"; + +// WebView +"HomeTitle" = "HOME"; +"WorkTitle" = "仕事"; +"DocumentsTitle" = "書類作成"; +"SearchTitle" = "検索"; + +// Approval +"ApprovalTitle" = "承認一覧"; +"ApprovalData" = "%1$@ (%2$@)"; + +// Approval Detail, Search Result +"Number" = "No. %d"; +"Form" = "%@"; +"Draft" = "下書き"; +"Approving" = "承認中"; +"Hold" = "保留"; +"Reject" = "却下"; +"RejectDraft" = "差し戻し"; +"RejectAuthorize" = "差し戻し"; +"SendBack" = "起票者へ差し戻し"; +"Remand" = "承認者へ差し戻し"; +"Approved" = "承認完了"; +"Request" = "申請: %1$@"; +"Update" = "更新: %1$@"; +"Approvers" = "承認者: [%@]"; +"Total" = " %@件 "; + +// Submission +"SubmissionTitle" = "提出一覧"; +"SubmissionData" = "%1$@ (%2$@)"; +"AutoSelectRoute" = "(自動選択ルート)"; + +// Submission Detail +"SubmissionName" = "%@"; +"SubmissionRoute" = "%@"; + +// Search +"FormName" = "フォーム名"; +"DocNumber" = "書類 No"; +"Subject" = "件名"; +"FalseDocButton" = "書類Noは数値のみ入力可能"; + +// Search Result +"SearchResultTitle" = "検索結果"; +"SearchNoData" = "条件に一致する結果は見つかりませんでした"; +"Loading" = "検索中"; + +"NoData" = "データがありません"; + +// Refresh Token Error +"RefreshTokenUpdateErrorTitle" = "アクセストークン更新エラー"; +"RefreshTokenUpdateError" = "AgileWorksサーバへアクセスするためのトークンの更新が行えませんでした。\n再ログインする必要があります。"; + +// Network Error Message +"UnknownNetworkError" = "ネットワークエラーが発生しました"; +"NotConnectNetworkError" = "インターネットにアクセスするにはモバイルデータ通信をオンにするかWi-Fiを利用してください"; +"TimedOutNetworkError" = "インターネットに接続できません\nしばらく経ってから再度おためしください"; + +// Setting +"SettingTitle" = "設定"; +"Domain" = "所属ドメイン"; +"Name" = "氏名"; +"Character" = "カナ"; +"primaryGroupName" = "所属"; +"PrimaryGroupPartName" = "役職"; +"LogoutConfirm" = "ログアウトしますか?"; +"YES" = "はい"; +"NO" = "いいえ"; + +// Form +"OK" = "OK"; +"Cancel" = "Cancel"; +"Close" = "Close"; +"Close Subwindow" = "Close Subwindow"; + +// Form (ログアウト通知) +"LogoutAlertTitle" = "ログアウト通知"; +"LogoutAlertMessage"= "セッションタイムアウトによりログアウトしました。書類を開き直してください。"; + +// Color +"MainColor" = "DarkMauve"; +"IndicatorBackgroud" = "IndicatorBackgroud"; +"SectionColor" = "DarkGray"; +"SeparatorColor" = "PastelGray"; +"SelectCellBgColor" = "PastelGray"; +"DraftColor" = "Gray"; +"ApprovingColor" = "Orange"; +"HoldColor" = "DarkMauve"; +"RejectColor" = "Red"; +"RemandColor" = "Blue"; +"ApprovedColor" = "Green"; +"ClickBtnColor" = "Mouse"; + +// Image +"HeaderIcon" = "folder"; +"HeaderRightIcon" = "right"; +"checkIcon" = "CheckIcon"; +"checkNoIcon" = "CheckNoIcon"; + +// TodayExtension +"NotLogedin" = "アプリからログインしてください"; + +// WfAction +"WfApprove" = "Approve"; +"WfSuspend" = "Suspend"; + +// ShareExtension +"CertificateImportSuccess" = "クライアント証明書をインポートしました。"; +"IncorrectPassphrase" = "パスフレーズが違います。"; +"CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; diff --git a/AgileWorks/AgileWorks/Strings/Japanese.strings b/AgileWorks/AgileWorks/Strings/Japanese.strings new file mode 100644 index 0000000..cf64e4e --- /dev/null +++ b/AgileWorks/AgileWorks/Strings/Japanese.strings @@ -0,0 +1,136 @@ +/* + Japanese.strings + AgileWorks + + Created by Azuma Kasumi on 2022/02/17. + Copyright © 2022 ATLED CORP. All rights reserved. +*/ + +// Splash +"Auth" = "認証"; + +// Version +"AppVersion" = "App ver. %@"; + +// Login +"Language" = "日本語"; +"ServerURLPlaceholder" = "AgileWorksサーバ"; +"LoginButton" = "接続"; +"QRCodeReadLabel" = "QRコードリード"; +"QRCodeReadGuidance" = "ログインQRコードを読み込んでください"; +"ClientCertificateRemovalConfirmation" = "クライアント証明書の設定を削除します。よろしいですか?"; +"ClientCertificateRemovalOK" = "削除"; +"ClientCertificateRemovalCancel" = "キャンセル"; +"LoginErrorMessage" = "ログインに失敗しました。再度ログインしてください。"; +"CameraStartupErrorMessage" = "カメラの起動に失敗しました。"; + +// WebView +"HomeTitle" = "HOME"; +"WorkTitle" = "仕事"; +"DocumentsTitle" = "書類作成"; +"SearchTitle" = "検索"; + +// Approval +"ApprovalTitle" = "承認一覧"; +"ApprovalData" = "%1$@ (%2$@)"; + +// Approval Detail, Search Result +"Number" = "No. %d"; +"Form" = "%@"; +"Draft" = "下書き"; +"Approving" = "承認中"; +"Hold" = "保留"; +"Reject" = "却下"; +"RejectDraft" = "差し戻し"; +"RejectAuthorize" = "差し戻し"; +"SendBack" = "起票者へ差し戻し"; +"Remand" = "承認者へ差し戻し"; +"Approved" = "承認完了"; +"Request" = "申請: %1$@"; +"Update" = "更新: %1$@"; +"Approvers" = "承認者: [%@]"; +"Total" = " %@件 "; + +// Submission +"SubmissionTitle" = "提出一覧"; +"SubmissionData" = "%1$@ (%2$@)"; +"AutoSelectRoute" = "(自動選択ルート)"; + +// Submission Detail +"SubmissionName" = "%@"; +"SubmissionRoute" = "%@"; + +// Search +"FormName" = "フォーム名"; +"DocNumber" = "書類 No"; +"Subject" = "件名"; +"FalseDocButton" = "書類Noは数値のみ入力可能"; + +// Search Result +"SearchResultTitle" = "検索結果"; +"SearchNoData" = "条件に一致する結果は見つかりませんでした"; +"Loading" = "検索中"; + +"NoData" = "データがありません"; + +// Refresh Token Error +"RefreshTokenUpdateErrorTitle" = "アクセストークン更新エラー"; +"RefreshTokenUpdateError" = "AgileWorksサーバへアクセスするためのトークンの更新が行えませんでした。\n再ログインする必要があります。"; + +// Network Error Message +"UnknownNetworkError" = "ネットワークエラーが発生しました"; +"NotConnectNetworkError" = "インターネットにアクセスするにはモバイルデータ通信をオンにするかWi-Fiを利用してください"; +"TimedOutNetworkError" = "インターネットに接続できません\nしばらく経ってから再度おためしください"; + +// Setting +"SettingTitle" = "設定"; +"Domain" = "所属ドメイン"; +"Name" = "氏名"; +"Character" = "カナ"; +"primaryGroupName" = "所属"; +"PrimaryGroupPartName" = "役職"; +"LogoutConfirm" = "ログアウトしますか?"; +"YES" = "はい"; +"NO" = "いいえ"; + +// Form +"OK" = "OK"; +"Cancel" = "キャンセル"; +"Close" = "閉じる"; +"Close Subwindow" = "閉じる (サブウィンドウ)"; + +// Form (ログアウト通知) +"LogoutAlertTitle" = "ログアウト通知"; +"LogoutAlertMessage"= "セッションタイムアウトによりログアウトしました。書類を開き直してください。"; + +// Color +"MainColor" = "DarkMauve"; +"IndicatorBackgroud" = "IndicatorBackgroud"; +"SectionColor" = "DarkGray"; +"SeparatorColor" = "PastelGray"; +"SelectCellBgColor" = "PastelGray"; +"DraftColor" = "Gray"; +"ApprovingColor" = "Orange"; +"HoldColor" = "DarkMauve"; +"RejectColor" = "Red"; +"RemandColor" = "Blue"; +"ApprovedColor" = "Green"; +"ClickBtnColor" = "Mouse"; + +// Image +"HeaderIcon" = "folder"; +"HeaderRightIcon" = "right"; +"checkIcon" = "CheckIcon"; +"checkNoIcon" = "CheckNoIcon"; + +// TodayExtension +"NotLogedin" = "アプリからログインしてください"; + +// WfAction +"WfApprove" = "承認"; +"WfSuspend" = "保留"; + +// ShareExtension +"CertificateImportSuccess" = "クライアント証明書をインポートしました。"; +"IncorrectPassphrase" = "パスフレーズが違います。"; +"CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; diff --git a/AgileWorks/AgileWorks/en.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings similarity index 98% rename from AgileWorks/AgileWorks/en.lproj/Localizable.strings rename to AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings index cdf459d..0e58b77 100644 --- a/AgileWorks/AgileWorks/en.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings @@ -13,7 +13,9 @@ "AppVersion" = "App ver. %@"; // Login +"Language" = "English"; "ServerURLPlaceholder" = "AgileWorksサーバ"; +"LoginButton" = "接続"; "QRCodeReadLabel" = "QRコードリード"; "QRCodeReadGuidance" = "ログインQRコードを読み込んでください"; "ClientCertificateRemovalConfirmation" = "クライアント証明書の設定を削除します。よろしいですか?"; diff --git a/AgileWorks/AgileWorks/ja.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings similarity index 98% rename from AgileWorks/AgileWorks/ja.lproj/Localizable.strings rename to AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings index ce21a25..abe3a77 100644 --- a/AgileWorks/AgileWorks/ja.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings @@ -13,7 +13,9 @@ "AppVersion" = "App ver. %@"; // Login +"Language" = "日本語"; "ServerURLPlaceholder" = "AgileWorksサーバ"; +"LoginButton" = "接続"; "QRCodeReadLabel" = "QRコードリード"; "QRCodeReadGuidance" = "ログインQRコードを読み込んでください"; "ClientCertificateRemovalConfirmation" = "クライアント証明書の設定を削除します。よろしいですか?"; diff --git a/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings new file mode 100644 index 0000000..34bc4e2 --- /dev/null +++ b/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings @@ -0,0 +1,136 @@ +/* + Localizable.strings + AgileWorks + + Created by sbc on 2020/06/22. + Copyright © 2020 nttdata-sbc. All rights reserved. +*/ + +// Splash +"Auth" = "認証"; + +// Version +"AppVersion" = "App ver. %@"; + +// Login +"Language" = "簡体字"; +"ServerURLPlaceholder" = "AgileWorksサーバ"; +"LoginButton" = "接続"; +"QRCodeReadLabel" = "QRコードリード"; +"QRCodeReadGuidance" = "ログインQRコードを読み込んでください"; +"ClientCertificateRemovalConfirmation" = "クライアント証明書の設定を削除します。よろしいですか?"; +"ClientCertificateRemovalOK" = "削除"; +"ClientCertificateRemovalCancel" = "キャンセル"; +"LoginErrorMessage" = "ログインに失敗しました。再度ログインしてください。"; +"CameraStartupErrorMessage" = "カメラの起動に失敗しました。"; + +// WebView +"HomeTitle" = "HOME"; +"WorkTitle" = "仕事"; +"DocumentsTitle" = "書類作成"; +"SearchTitle" = "検索"; + +// Approval +"ApprovalTitle" = "承認一覧"; +"ApprovalData" = "%1$@ (%2$@)"; + +// Approval Detail, Search Result +"Number" = "No. %d"; +"Form" = "%@"; +"Draft" = "下書き"; +"Approving" = "承認中"; +"Hold" = "保留"; +"Reject" = "却下"; +"RejectDraft" = "差し戻し"; +"RejectAuthorize" = "差し戻し"; +"SendBack" = "起票者へ差し戻し"; +"Remand" = "承認者へ差し戻し"; +"Approved" = "承認完了"; +"Request" = "申請: %1$@"; +"Update" = "更新: %1$@"; +"Approvers" = "承認者: [%@]"; +"Total" = " %@件 "; + +// Submission +"SubmissionTitle" = "提出一覧"; +"SubmissionData" = "%1$@ (%2$@)"; +"AutoSelectRoute" = "(自動選択ルート)"; + +// Submission Detail +"SubmissionName" = "%@"; +"SubmissionRoute" = "%@"; + +// Search +"FormName" = "フォーム名"; +"DocNumber" = "書類 No"; +"Subject" = "件名"; +"FalseDocButton" = "書類Noは数値のみ入力可能"; + +// Search Result +"SearchResultTitle" = "検索結果"; +"SearchNoData" = "条件に一致する結果は見つかりませんでした"; +"Loading" = "検索中"; + +"NoData" = "データがありません"; + +// Refresh Token Error +"RefreshTokenUpdateErrorTitle" = "アクセストークン更新エラー"; +"RefreshTokenUpdateError" = "AgileWorksサーバへアクセスするためのトークンの更新が行えませんでした。\n再ログインする必要があります。"; + +// Network Error Message +"UnknownNetworkError" = "ネットワークエラーが発生しました"; +"NotConnectNetworkError" = "インターネットにアクセスするにはモバイルデータ通信をオンにするかWi-Fiを利用してください"; +"TimedOutNetworkError" = "インターネットに接続できません\nしばらく経ってから再度おためしください"; + +// Setting +"SettingTitle" = "設定"; +"Domain" = "所属ドメイン"; +"Name" = "氏名"; +"Character" = "カナ"; +"primaryGroupName" = "所属"; +"PrimaryGroupPartName" = "役職"; +"LogoutConfirm" = "ログアウトしますか?"; +"YES" = "はい"; +"NO" = "いいえ"; + +// Form +"OK" = "OK"; +"Cancel" = "Cancel"; +"Close" = "Close"; +"Close Subwindow" = "Close Subwindow"; + +// Form (ログアウト通知) +"LogoutAlertTitle" = "ログアウト通知"; +"LogoutAlertMessage"= "セッションタイムアウトによりログアウトしました。書類を開き直してください。"; + +// Color +"MainColor" = "DarkMauve"; +"IndicatorBackgroud" = "IndicatorBackgroud"; +"SectionColor" = "DarkGray"; +"SeparatorColor" = "PastelGray"; +"SelectCellBgColor" = "PastelGray"; +"DraftColor" = "Gray"; +"ApprovingColor" = "Orange"; +"HoldColor" = "DarkMauve"; +"RejectColor" = "Red"; +"RemandColor" = "Blue"; +"ApprovedColor" = "Green"; +"ClickBtnColor" = "Mouse"; + +// Image +"HeaderIcon" = "folder"; +"HeaderRightIcon" = "right"; +"checkIcon" = "CheckIcon"; +"checkNoIcon" = "CheckNoIcon"; + +// TodayExtension +"NotLogedin" = "アプリからログインしてください"; + +// WfAction +"WfApprove" = "Approve"; +"WfSuspend" = "Suspend"; + +// ShareExtension +"CertificateImportSuccess" = "クライアント証明書をインポートしました。"; +"IncorrectPassphrase" = "パスフレーズが違います。"; +"CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; diff --git a/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings new file mode 100644 index 0000000..a31e365 --- /dev/null +++ b/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings @@ -0,0 +1,136 @@ +/* + Localizable.strings + AgileWorks + + Created by sbc on 2020/06/22. + Copyright © 2020 nttdata-sbc. All rights reserved. +*/ + +// Splash +"Auth" = "認証"; + +// Version +"AppVersion" = "App ver. %@"; + +// Login +"Language" = "繁体字"; +"ServerURLPlaceholder" = "AgileWorksサーバ"; +"LoginButton" = "接続"; +"QRCodeReadLabel" = "QRコードリード"; +"QRCodeReadGuidance" = "ログインQRコードを読み込んでください"; +"ClientCertificateRemovalConfirmation" = "クライアント証明書の設定を削除します。よろしいですか?"; +"ClientCertificateRemovalOK" = "削除"; +"ClientCertificateRemovalCancel" = "キャンセル"; +"LoginErrorMessage" = "ログインに失敗しました。再度ログインしてください。"; +"CameraStartupErrorMessage" = "カメラの起動に失敗しました。"; + +// WebView +"HomeTitle" = "HOME"; +"WorkTitle" = "仕事"; +"DocumentsTitle" = "書類作成"; +"SearchTitle" = "検索"; + +// Approval +"ApprovalTitle" = "承認一覧"; +"ApprovalData" = "%1$@ (%2$@)"; + +// Approval Detail, Search Result +"Number" = "No. %d"; +"Form" = "%@"; +"Draft" = "下書き"; +"Approving" = "承認中"; +"Hold" = "保留"; +"Reject" = "却下"; +"RejectDraft" = "差し戻し"; +"RejectAuthorize" = "差し戻し"; +"SendBack" = "起票者へ差し戻し"; +"Remand" = "承認者へ差し戻し"; +"Approved" = "承認完了"; +"Request" = "申請: %1$@"; +"Update" = "更新: %1$@"; +"Approvers" = "承認者: [%@]"; +"Total" = " %@件 "; + +// Submission +"SubmissionTitle" = "提出一覧"; +"SubmissionData" = "%1$@ (%2$@)"; +"AutoSelectRoute" = "(自動選択ルート)"; + +// Submission Detail +"SubmissionName" = "%@"; +"SubmissionRoute" = "%@"; + +// Search +"FormName" = "フォーム名"; +"DocNumber" = "書類 No"; +"Subject" = "件名"; +"FalseDocButton" = "書類Noは数値のみ入力可能"; + +// Search Result +"SearchResultTitle" = "検索結果"; +"SearchNoData" = "条件に一致する結果は見つかりませんでした"; +"Loading" = "検索中"; + +"NoData" = "データがありません"; + +// Refresh Token Error +"RefreshTokenUpdateErrorTitle" = "アクセストークン更新エラー"; +"RefreshTokenUpdateError" = "AgileWorksサーバへアクセスするためのトークンの更新が行えませんでした。\n再ログインする必要があります。"; + +// Network Error Message +"UnknownNetworkError" = "ネットワークエラーが発生しました"; +"NotConnectNetworkError" = "インターネットにアクセスするにはモバイルデータ通信をオンにするかWi-Fiを利用してください"; +"TimedOutNetworkError" = "インターネットに接続できません\nしばらく経ってから再度おためしください"; + +// Setting +"SettingTitle" = "設定"; +"Domain" = "所属ドメイン"; +"Name" = "氏名"; +"Character" = "カナ"; +"primaryGroupName" = "所属"; +"PrimaryGroupPartName" = "役職"; +"LogoutConfirm" = "ログアウトしますか?"; +"YES" = "はい"; +"NO" = "いいえ"; + +// Form +"OK" = "OK"; +"Cancel" = "Cancel"; +"Close" = "Close"; +"Close Subwindow" = "Close Subwindow"; + +// Form (ログアウト通知) +"LogoutAlertTitle" = "ログアウト通知"; +"LogoutAlertMessage"= "セッションタイムアウトによりログアウトしました。書類を開き直してください。"; + +// Color +"MainColor" = "DarkMauve"; +"IndicatorBackgroud" = "IndicatorBackgroud"; +"SectionColor" = "DarkGray"; +"SeparatorColor" = "PastelGray"; +"SelectCellBgColor" = "PastelGray"; +"DraftColor" = "Gray"; +"ApprovingColor" = "Orange"; +"HoldColor" = "DarkMauve"; +"RejectColor" = "Red"; +"RemandColor" = "Blue"; +"ApprovedColor" = "Green"; +"ClickBtnColor" = "Mouse"; + +// Image +"HeaderIcon" = "folder"; +"HeaderRightIcon" = "right"; +"checkIcon" = "CheckIcon"; +"checkNoIcon" = "CheckNoIcon"; + +// TodayExtension +"NotLogedin" = "アプリからログインしてください"; + +// WfAction +"WfApprove" = "Approve"; +"WfSuspend" = "Suspend"; + +// ShareExtension +"CertificateImportSuccess" = "クライアント証明書をインポートしました。"; +"IncorrectPassphrase" = "パスフレーズが違います。"; +"CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; diff --git a/AgileWorks/AgileWorks/WebView/View/WebViewController.swift b/AgileWorks/AgileWorks/WebView/View/WebViewController.swift index 2c5f4ac..8f5b6a7 100644 --- a/AgileWorks/AgileWorks/WebView/View/WebViewController.swift +++ b/AgileWorks/AgileWorks/WebView/View/WebViewController.swift @@ -25,9 +25,9 @@ class WebViewController: UIViewController { // Title を設定する URL を定義 let urlToTitle: [String: String] = [ - "Mobile#home": NSLocalizedString("HomeTitle", comment: ""), - "Mobile#work": NSLocalizedString("WorkTitle", comment: ""), - "Mobile#agileWorksSearch": NSLocalizedString("SearchTitle", comment: "") + "Mobile#home": getStrings(key: "HomeTitle", comment: ""), + "Mobile#work": getStrings(key: "WorkTitle", comment: ""), + "Mobile#agileWorksSearch": getStrings(key: "SearchTitle", comment: "") ] // reload 対象URL let reloadUrl: [String] = ["Mobile#docDetail"] @@ -168,16 +168,16 @@ class WebViewController: UIViewController { // リフレッシュトークン更新エラーの場合 if refreshError { DispatchQueue.main.async { - let title = NSLocalizedString("RefreshTokenUpdateErrorTitle", comment: "") - let message = NSLocalizedString("RefreshTokenUpdateError", comment: "") - let defaultAction = AppDelegate.shared.rootViewController.logoutDefaultAction(title: NSLocalizedString("OK", comment: "")) + let title = getStrings(key: "RefreshTokenUpdateErrorTitle", comment: "") + let message = getStrings(key: "RefreshTokenUpdateError", comment: "") + let defaultAction = AppDelegate.shared.rootViewController.logoutDefaultAction(title: getStrings(key: "OK", comment: "")) AppDelegate.shared.rootViewController.showAlertScreen(view: self, title: title, message: message, defaultAction: defaultAction, cancelAction: nil) } // その他エラーの場合 } else { DispatchQueue.main.async { - let message = NSLocalizedString("UnknownNetworkError", comment: "") - let defaultAction = UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default) { _ in } + let message = getStrings(key: "UnknownNetworkError", comment: "") + let defaultAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in } AppDelegate.shared.rootViewController.showAlertScreen(view: self, title: "", message: message, defaultAction: defaultAction, cancelAction: nil) } } @@ -236,7 +236,7 @@ class WebViewController: UIViewController { extension WebViewController: WKUIDelegate { func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) { let alertController = UIAlertController(title: "", message: message, preferredStyle: .alert) - let okAction = UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default) { _ in + let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in completionHandler() } alertController.addAction(okAction) @@ -245,10 +245,10 @@ extension WebViewController: WKUIDelegate { func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) { let alertController = UIAlertController(title: "", message: message, preferredStyle: .alert) - let okAction = UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default) { _ in + let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in completionHandler(true) } - let cancelAction = UIAlertAction(title: NSLocalizedString("Cancel", comment: ""), style: .cancel) { _ in + let cancelAction = UIAlertAction(title: getStrings(key: "Cancel", comment: ""), style: .cancel) { _ in completionHandler(false) } alertController.addAction(okAction) @@ -280,7 +280,7 @@ extension WebViewController: WKUIDelegate { extension WebViewController: SubWebViewStackEventDelegate { func onClose(webView: WKWebView, stack: SubWebViewStack) { if stack.isEmpty { - //closeButton.title = NSLocalizedString("Close", comment: "") + //closeButton.title = getStrings(key: "Close", comment: "") } } } diff --git a/AgileWorks/AgileWorks/WebView/View/WebViewScriptMessageHandler.swift b/AgileWorks/AgileWorks/WebView/View/WebViewScriptMessageHandler.swift index 35e9cb0..0c931a8 100644 --- a/AgileWorks/AgileWorks/WebView/View/WebViewScriptMessageHandler.swift +++ b/AgileWorks/AgileWorks/WebView/View/WebViewScriptMessageHandler.swift @@ -18,8 +18,8 @@ class WebViewScriptMessageHandler: NSObject { // 名前は、sample に変えて "sample": { controller, _, _ in DispatchQueue.main.async { - let alertController = UIAlertController(title: NSLocalizedString("LogoutAlertTitle", comment: ""), message: NSLocalizedString("LogoutAlertMessage", comment: ""), preferredStyle: .alert) - let okAction = UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default) { _ in + let alertController = UIAlertController(title: getStrings(key: "LogoutAlertTitle", comment: ""), message: getStrings(key: "LogoutAlertMessage", comment: ""), preferredStyle: .alert) + let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in controller.dismiss(animated: true, completion: nil) } alertController.addAction(okAction) diff --git a/AgileWorks/Common/DataStore/Configuration.swift b/AgileWorks/Common/DataStore/Configuration.swift index b5876e1..12a2b68 100644 --- a/AgileWorks/Common/DataStore/Configuration.swift +++ b/AgileWorks/Common/DataStore/Configuration.swift @@ -17,6 +17,9 @@ struct Configuration { return plist["AppConfig"] as! [AnyHashable: Any] }() + var awLanguage: String { + return KeychainDataStore().readLanguage() ?? "" + } var awServer: String { return KeychainDataStore().readServerURL() ?? "" } diff --git a/AgileWorks/Common/DataStore/KeychainDataStore.swift b/AgileWorks/Common/DataStore/KeychainDataStore.swift index 504d201..bea972d 100644 --- a/AgileWorks/Common/DataStore/KeychainDataStore.swift +++ b/AgileWorks/Common/DataStore/KeychainDataStore.swift @@ -15,6 +15,7 @@ final class KeychainDataStore: DataStoreProtocol { private let groupId = Bundle.main.object(forInfoDictionaryKey: "AppIdentifierPrefix") as! String + Configuration.shared.awShareBundleIdentifier private let kAccessToken: String = "AccessToken" private let kOAuthState: String = "OAuthState" + private let kLanguage: String = "Localizable" private let kServerURL: String = "ServerURL" private let kContextPath: String = "ContextPath" private let kDeviceID: String = "DeviceID" @@ -60,6 +61,21 @@ final class KeychainDataStore: DataStoreProtocol { removeKeychainValue(key: kOAuthState) } + // 言語設定の書き込み + func writeLanguage(language: String) { + setKeychainValue(key: kLanguage, value: language) + } + + // 言語設定の読み込み + func readLanguage() -> String? { + return getKeychainValue(key: kLanguage) + } + + // 言語設定の削除 + func removeLanguage() { + removeKeychainValue(key: kLanguage) + } + // サーバーURLの書き込み func writeServerURL(serverURL: String) { setKeychainValue(key: kServerURL, value: serverURL) diff --git a/AgileWorks/Common/Utility/StringsUtility.swift b/AgileWorks/Common/Utility/StringsUtility.swift new file mode 100644 index 0000000..7ece240 --- /dev/null +++ b/AgileWorks/Common/Utility/StringsUtility.swift @@ -0,0 +1,46 @@ +// +// StringsUtility.swift +// AgileWorks +// +// Created by Azuma Kasumi on 2022/02/17. +// Copyright © 2022 ATLED CORP. All rights reserved. +// + +import Foundation + +//多言語対応 + +//言語の種類 +let languageArray = ["日本語", "English", "簡体字", "繁体字"] + +//言語を設定する +func setStringsName(stringsName: String){ + KeychainDataStore().writeLanguage(language: stringsName) +} + +//設定中の言語ファイル(stringsファイル)名を取得する +func getStringsName()->String { + var stringName = Configuration.shared.awLanguage + //設定されていない場合は環境に依存した言語で返す + if stringName.isEmpty { + stringName = "Localizable" + } + return stringName +} + +//指定した言語を取得する +func getStrings(key: String, comment: String) -> String { + return NSLocalizedString(key, tableName: getStringsName(), comment: comment) +} + +//選択中の言語の要素番号を返す +func getLanguageIndex(stringsName: String) -> Int { + var index = 0 + for language in languageArray { + if language == stringsName { + break + } + index += 1 + } + return index +} diff --git a/AgileWorks/Podfile b/AgileWorks/Podfile index 8d044bf..2472c09 100644 --- a/AgileWorks/Podfile +++ b/AgileWorks/Podfile @@ -15,6 +15,7 @@ abstract_target 'All' do pod 'LicensePlist' pod 'SwiftLint' pod 'FloatingPanel' + pod 'DropDown' # For Firebase pod 'Crashlytics', '~> 3.14.0' diff --git a/AgileWorks/Podfile.lock b/AgileWorks/Podfile.lock index dda3f24..796da82 100644 --- a/AgileWorks/Podfile.lock +++ b/AgileWorks/Podfile.lock @@ -6,6 +6,7 @@ PODS: - AppAuth/ExternalUserAgent (1.3.0) - Crashlytics (3.14.0): - Fabric (~> 1.10.2) + - DropDown (2.3.13) - Fabric (1.10.2) - Firebase/Analytics (6.18.0): - Firebase/Core @@ -107,6 +108,7 @@ PODS: DEPENDENCIES: - AppAuth - Crashlytics (~> 3.14.0) + - DropDown - Fabric (~> 1.10.2) - Firebase/Analytics - Firebase/Messaging @@ -120,6 +122,7 @@ SPEC REPOS: trunk: - AppAuth - Crashlytics + - DropDown - Fabric - Firebase - FirebaseAnalytics @@ -147,6 +150,7 @@ SPEC REPOS: SPEC CHECKSUMS: AppAuth: 73574f3013a1e65b9601a3ddc8b3158cce68c09d Crashlytics: 9220f5bc89e7a618df411b4f639389dbfb0e03d2 + DropDown: 8a2116376c1981888557f72ec2ffc9a5e0e456ec Fabric: ea977e3cd9c20425516d3dafd3bf8c941c51223f Firebase: 0490eca762a72e4f1582319539153897f1508dee FirebaseAnalytics: 058d71e714a1a6804d9e0f25e3bb18e377a51579 @@ -171,6 +175,6 @@ SPEC CHECKSUMS: SwiftLint: 55e96a4a4d537d4a3156859fc1c54bd24851a046 XCGLogger: 1943831ef907df55108b0b18657953f868de973b -PODFILE CHECKSUM: 4999acd164e0d17ea0f76514484907fb5cf47e78 +PODFILE CHECKSUM: 098b08dfc02bcc011514548f1c9cd491768400be COCOAPODS: 1.11.2 diff --git a/AgileWorks/ShareExtension/View/zh-Hans.lproj/MainInterface.strings b/AgileWorks/ShareExtension/View/zh-Hans.lproj/MainInterface.strings new file mode 100644 index 0000000..a3e3991 --- /dev/null +++ b/AgileWorks/ShareExtension/View/zh-Hans.lproj/MainInterface.strings @@ -0,0 +1,15 @@ + +/* Class = "UIBarButtonItem"; title = "インポート"; ObjectID = "UF3-H2-hjI"; */ +"UF3-H2-hjI.title" = "インポート"; + +/* Class = "UITableViewSection"; headerTitle = "クライアント証明書"; ObjectID = "m3B-MO-zRY"; */ +"m3B-MO-zRY.headerTitle" = "クライアント証明書"; + +/* Class = "UINavigationItem"; title = "クライアント証明書"; ObjectID = "nxD-IX-Nlu"; */ +"nxD-IX-Nlu.title" = "クライアント証明書"; + +/* Class = "UILabel"; text = "パスフレーズ"; ObjectID = "sHY-83-irr"; */ +"sHY-83-irr.text" = "パスフレーズ"; + +/* Class = "UIBarButtonItem"; title = "キャンセル"; ObjectID = "uhs-KR-oxe"; */ +"uhs-KR-oxe.title" = "キャンセル"; diff --git a/AgileWorks/ShareExtension/View/zh-Hant.lproj/MainInterface.strings b/AgileWorks/ShareExtension/View/zh-Hant.lproj/MainInterface.strings new file mode 100644 index 0000000..a3e3991 --- /dev/null +++ b/AgileWorks/ShareExtension/View/zh-Hant.lproj/MainInterface.strings @@ -0,0 +1,15 @@ + +/* Class = "UIBarButtonItem"; title = "インポート"; ObjectID = "UF3-H2-hjI"; */ +"UF3-H2-hjI.title" = "インポート"; + +/* Class = "UITableViewSection"; headerTitle = "クライアント証明書"; ObjectID = "m3B-MO-zRY"; */ +"m3B-MO-zRY.headerTitle" = "クライアント証明書"; + +/* Class = "UINavigationItem"; title = "クライアント証明書"; ObjectID = "nxD-IX-Nlu"; */ +"nxD-IX-Nlu.title" = "クライアント証明書"; + +/* Class = "UILabel"; text = "パスフレーズ"; ObjectID = "sHY-83-irr"; */ +"sHY-83-irr.text" = "パスフレーズ"; + +/* Class = "UIBarButtonItem"; title = "キャンセル"; ObjectID = "uhs-KR-oxe"; */ +"uhs-KR-oxe.title" = "キャンセル"; diff --git a/AgileWorks/TodayExtension/View/zh-Hans.lproj/MainInterface.strings b/AgileWorks/TodayExtension/View/zh-Hans.lproj/MainInterface.strings new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/AgileWorks/TodayExtension/View/zh-Hans.lproj/MainInterface.strings @@ -0,0 +1 @@ + diff --git a/AgileWorks/TodayExtension/View/zh-Hant.lproj/MainInterface.strings b/AgileWorks/TodayExtension/View/zh-Hant.lproj/MainInterface.strings new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/AgileWorks/TodayExtension/View/zh-Hant.lproj/MainInterface.strings @@ -0,0 +1 @@ + -- GitLab From 38a9a9f0c41c2a4125033503c7450122f19b21a5 Mon Sep 17 00:00:00 2001 From: Azuma Kasumi Date: Tue, 22 Feb 2022 11:33:26 +0900 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A4=9A=E8=A8=80=E8=AA=9E=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AgileWorks.xcodeproj/project.pbxproj | 40 ++++++++++++++++--- .../Login/View/LoginViewController.storyboard | 12 +++--- .../Login/View/LoginViewController.swift | 8 ++-- .../Strings/Chinese-Simplified.strings | 2 +- .../Strings/Chinese-Traditional.strings | 2 +- .../Strings/zh-Hans.lproj/Localizable.strings | 2 +- .../Strings/zh-Hant.lproj/Localizable.strings | 2 +- .../View/MenuTableViewController.swift | 10 ++--- .../WebView/View/WebViewController.swift | 4 +- AgileWorks/Common/Utility/NumberUtility.swift | 2 + .../Common/Utility/StringsUtility.swift | 8 ++-- AgileWorks/Common/WfAction.swift | 2 +- .../View/ShareViewController.swift | 9 ++--- .../View/TodayViewController.swift | 8 ++-- 14 files changed, 72 insertions(+), 39 deletions(-) diff --git a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj index 45899ba..beb1dee 100644 --- a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj +++ b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj @@ -28,7 +28,22 @@ 75917F9E27BDF1C30051E201 /* English.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9D27BDF1C30051E201 /* English.strings */; }; 75917FA027BDF2050051E201 /* Chinese-Simplified.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9F27BDF2050051E201 /* Chinese-Simplified.strings */; }; 75917FA227BDF2250051E201 /* Chinese-Traditional.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917FA127BDF2250051E201 /* Chinese-Traditional.strings */; }; - 75917FA427BE06940051E201 /* StringsUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75917FA327BE06940051E201 /* StringsUtility.swift */; }; + 75917FA727C36D0C0051E201 /* Japanese.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9B27BDF0F10051E201 /* Japanese.strings */; }; + 75917FA827C36D220051E201 /* English.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9D27BDF1C30051E201 /* English.strings */; }; + 75917FA927C36D220051E201 /* Chinese-Simplified.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9F27BDF2050051E201 /* Chinese-Simplified.strings */; }; + 75917FAA27C36D220051E201 /* Chinese-Traditional.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917FA127BDF2250051E201 /* Chinese-Traditional.strings */; }; + 75917FAB27C36D340051E201 /* Japanese.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9B27BDF0F10051E201 /* Japanese.strings */; }; + 75917FAC27C36D340051E201 /* English.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9D27BDF1C30051E201 /* English.strings */; }; + 75917FAD27C36D340051E201 /* Chinese-Simplified.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9F27BDF2050051E201 /* Chinese-Simplified.strings */; }; + 75917FAE27C36D340051E201 /* Chinese-Traditional.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917FA127BDF2250051E201 /* Chinese-Traditional.strings */; }; + 75917FAF27C36E4A0051E201 /* KeychainDataStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDEA2CD4246CDAEF00D3E15F /* KeychainDataStore.swift */; }; + 75917FB027C36E950051E201 /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD5061B3242866780014F3FA /* Configuration.swift */; }; + 75917FB127C36F7B0051E201 /* UserDefaultsDataStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD928CCD2407500400ED04C2 /* UserDefaultsDataStore.swift */; }; + 75917FB327C371390051E201 /* StringsUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75917FB227C371390051E201 /* StringsUtility.swift */; }; + 75917FB427C371390051E201 /* StringsUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75917FB227C371390051E201 /* StringsUtility.swift */; }; + 75917FB527C371390051E201 /* StringsUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75917FB227C371390051E201 /* StringsUtility.swift */; }; + 75917FB627C372C80051E201 /* XCGLoggerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD8D55D82420609000A667B0 /* XCGLoggerExtensions.swift */; }; + 75917FB727C373060051E201 /* UserDefaultsExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDAB1F6C240D0D0000EA15FD /* UserDefaultsExtensions.swift */; }; 7604950425380980000D6951 /* FirebaseSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7604950325380980000D6951 /* FirebaseSupport.swift */; }; 761F49E2255511A1007708D8 /* NumberUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761F49E1255511A1007708D8 /* NumberUtility.swift */; }; 761F4A0925551FCF007708D8 /* NumberUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761F49E1255511A1007708D8 /* NumberUtility.swift */; }; @@ -207,7 +222,7 @@ 75917F9D27BDF1C30051E201 /* English.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = English.strings; sourceTree = ""; }; 75917F9F27BDF2050051E201 /* Chinese-Simplified.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = "Chinese-Simplified.strings"; sourceTree = ""; }; 75917FA127BDF2250051E201 /* Chinese-Traditional.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = "Chinese-Traditional.strings"; sourceTree = ""; }; - 75917FA327BE06940051E201 /* StringsUtility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringsUtility.swift; sourceTree = ""; }; + 75917FB227C371390051E201 /* StringsUtility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringsUtility.swift; sourceTree = ""; }; 7604950325380980000D6951 /* FirebaseSupport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirebaseSupport.swift; sourceTree = ""; }; 761F49E1255511A1007708D8 /* NumberUtility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberUtility.swift; sourceTree = ""; }; 761F4A48255D15DA007708D8 /* AppShared.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppShared.swift; sourceTree = ""; }; @@ -420,8 +435,8 @@ isa = PBXGroup; children = ( 3AF4A84724A06A73006C0C0A /* Localizable.strings */, - 75917F9B27BDF0F10051E201 /* Japanese.strings */, 75917F9D27BDF1C30051E201 /* English.strings */, + 75917F9B27BDF0F10051E201 /* Japanese.strings */, 75917F9F27BDF2050051E201 /* Chinese-Simplified.strings */, 75917FA127BDF2250051E201 /* Chinese-Traditional.strings */, ); @@ -434,7 +449,7 @@ 761F49E1255511A1007708D8 /* NumberUtility.swift */, 764D0E1A2580ABCB00AB6617 /* URLAuthenticationUtility.swift */, 76AE52DC25D35CDC00AFA45A /* LicenseUtility.swift */, - 75917FA327BE06940051E201 /* StringsUtility.swift */, + 75917FB227C371390051E201 /* StringsUtility.swift */, ); path = Utility; sourceTree = ""; @@ -1006,6 +1021,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 75917FA827C36D220051E201 /* English.strings in Resources */, + 75917FA927C36D220051E201 /* Chinese-Simplified.strings in Resources */, + 75917FAA27C36D220051E201 /* Chinese-Traditional.strings in Resources */, + 75917FA727C36D0C0051E201 /* Japanese.strings in Resources */, 3127EE12241A2A9500535CC7 /* MainInterface.storyboard in Resources */, BD6DE26F24D1079700C1479E /* Localizable.strings in Resources */, ); @@ -1015,6 +1034,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 75917FAB27C36D340051E201 /* Japanese.strings in Resources */, + 75917FAC27C36D340051E201 /* English.strings in Resources */, + 75917FAD27C36D340051E201 /* Chinese-Simplified.strings in Resources */, + 75917FAE27C36D340051E201 /* Chinese-Traditional.strings in Resources */, 7672AD6F257EFF500063884A /* MainInterface.storyboard in Resources */, 764D0E122580641F00AB6617 /* Localizable.strings in Resources */, ); @@ -1153,6 +1176,7 @@ BD7DC0F324C061EA00C3FBED /* ErrorResponse.swift in Sources */, 3127EE0F241A2A9500535CC7 /* TodayViewController.swift in Sources */, BD13676C244427C600767222 /* GetSubmissionsIDEndpoint.swift in Sources */, + 75917FB427C371390051E201 /* StringsUtility.swift in Sources */, BDA74C52245016AC000D4351 /* XCGLoggerExtensions.swift in Sources */, BD1B50DD244DABF900783FB5 /* OAuthService.swift in Sources */, ); @@ -1162,8 +1186,14 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 75917FB727C373060051E201 /* UserDefaultsExtensions.swift in Sources */, + 75917FB627C372C80051E201 /* XCGLoggerExtensions.swift in Sources */, + 75917FB127C36F7B0051E201 /* UserDefaultsDataStore.swift in Sources */, + 75917FB027C36E950051E201 /* Configuration.swift in Sources */, + 75917FAF27C36E4A0051E201 /* KeychainDataStore.swift in Sources */, 764D0E1D2580ABCB00AB6617 /* URLAuthenticationUtility.swift in Sources */, 7672AD6C257EFF500063884A /* ShareViewController.swift in Sources */, + 75917FB527C371390051E201 /* StringsUtility.swift in Sources */, 764D0DB1257F44DF00AB6617 /* CertificateDataStore.swift in Sources */, 764D0DB9257F4A9200AB6617 /* Log.swift in Sources */, ); @@ -1236,7 +1266,6 @@ 76AE530025D3626800AFA45A /* LicenseViewController.swift in Sources */, BDAB1F6D240D0D0000EA15FD /* UserDefaultsExtensions.swift in Sources */, 76C7AA02250B05CA000A0FE6 /* SubWebViewStack.swift in Sources */, - 75917FA427BE06940051E201 /* StringsUtility.swift in Sources */, BD969631240C9CD400521925 /* SessionInfo.swift in Sources */, BD928CCE2407500400ED04C2 /* UserDefaultsDataStore.swift in Sources */, BD5061B4242866780014F3FA /* Configuration.swift in Sources */, @@ -1249,6 +1278,7 @@ BD3E90822474D56100B449A7 /* WKWebViewExtensions.swift in Sources */, 76F9B9452505FAA600BD2EBA /* FormWebViewScriptMessageHandler.swift in Sources */, BD25F853242A05510014B726 /* Session.swift in Sources */, + 75917FB327C371390051E201 /* StringsUtility.swift in Sources */, BD9D569F24AF14AB00C73B33 /* NotificationData.swift in Sources */, BDEA2CD5246CDAEF00D3E15F /* KeychainDataStore.swift in Sources */, BDAABA1F24A364D00077EC69 /* DeviceRequest.swift in Sources */, diff --git a/AgileWorks/AgileWorks/Login/View/LoginViewController.storyboard b/AgileWorks/AgileWorks/Login/View/LoginViewController.storyboard index da4c653..6576ee9 100644 --- a/AgileWorks/AgileWorks/Login/View/LoginViewController.storyboard +++ b/AgileWorks/AgileWorks/Login/View/LoginViewController.storyboard @@ -25,7 +25,7 @@ - + - + - + @@ -259,9 +259,9 @@ + - diff --git a/AgileWorks/AgileWorks/Login/View/LoginViewController.swift b/AgileWorks/AgileWorks/Login/View/LoginViewController.swift index 0291365..1c4d72f 100644 --- a/AgileWorks/AgileWorks/Login/View/LoginViewController.swift +++ b/AgileWorks/AgileWorks/Login/View/LoginViewController.swift @@ -127,9 +127,9 @@ class LoginViewController: UIViewController { setStringsName(stringsName: "English") case "日本語": setStringsName(stringsName: "Japanese") - case "簡体字": + case "中文(簡体)": setStringsName(stringsName: "Chinese-Simplified") - case "繁体字": + case "中文(繁体)": setStringsName(stringsName: "Chinese-Traditional") default: setStringsName(stringsName: "Localizable") @@ -226,8 +226,8 @@ class LoginViewController: UIViewController { } private func updateCloudUsage() { - serverTextField.placeholder = NSLocalizedString("ServerURLPlaceholder", comment: "") - contextTextField.placeholder = NSLocalizedString("ContextPlaceholder", comment: "") + serverTextField.placeholder = getStrings(key: "ServerURLPlaceholder", comment: "") + contextTextField.placeholder = getStrings(key: "ContextPlaceholder", comment: "") loginButton.isEnabled = isTextFieldValue() } diff --git a/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings b/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings index 1bc7a83..900c582 100644 --- a/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings +++ b/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings @@ -13,7 +13,7 @@ "AppVersion" = "App ver. %@"; // Login -"Language" = "簡体字"; +"Language" = "中文(簡体)"; "ServerURLPlaceholder" = "AgileWorksサーバ"; "ContextPlaceholder" = "AgileWorks"; "LoginButton" = "接続"; diff --git a/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings b/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings index 098ffe3..65afe29 100644 --- a/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings +++ b/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings @@ -13,7 +13,7 @@ "AppVersion" = "App ver. %@"; // Login -"Language" = "繁体字"; +"Language" = "中文(繁体)"; "ServerURLPlaceholder" = "AgileWorksサーバ"; "ContextPlaceholder" = "AgileWorks"; "LoginButton" = "接続"; diff --git a/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings index 61677ed..133d21f 100644 --- a/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings @@ -13,7 +13,7 @@ "AppVersion" = "App ver. %@"; // Login -"Language" = "簡体字"; +"Language" = "中文(簡体)"; "ServerURLPlaceholder" = "AgileWorksサーバ"; "ContextPlaceholder" = "AgileWorks"; "LoginButton" = "接続"; diff --git a/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings index 99ededc..9fe21bf 100644 --- a/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings @@ -13,7 +13,7 @@ "AppVersion" = "App ver. %@"; // Login -"Language" = "繁体字"; +"Language" = "中文(繁体)"; "ServerURLPlaceholder" = "AgileWorksサーバ"; "ContextPlaceholder" = "AgileWorks"; "LoginButton" = "接続"; diff --git a/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift b/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift index 84a14e1..1f8e282 100644 --- a/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift +++ b/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift @@ -20,7 +20,7 @@ class MenuTableViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() - self.tableView.separatorColor = UIColor(named: NSLocalizedString("SeparatorColor", comment: "")) + self.tableView.separatorColor = UIColor(named: getStrings(key: "SeparatorColor", comment: "")) self.setup() } @@ -46,10 +46,10 @@ class MenuTableViewController: UITableViewController { // 各種セットアップ private func setup() { // 各ラベル設定 - self.profileLabel.text = NSLocalizedString("ProfileTitle", comment: "") - self.logoutLabel.text = NSLocalizedString("LogoutTitle", comment: "") - self.licenseLabel.text = NSLocalizedString("LicenseTitle", comment: "") - self.openLicenseLable.text = NSLocalizedString("OpenLicenseTitle", comment: "") + self.profileLabel.text = getStrings(key: "ProfileTitle", comment: "") + self.logoutLabel.text = getStrings(key: "LogoutTitle", comment: "") + self.licenseLabel.text = getStrings(key: "LicenseTitle", comment: "") + self.openLicenseLable.text = getStrings(key: "OpenLicenseTitle", comment: "") } // プロファイルセルタップ処理 private func pushToProfile() { diff --git a/AgileWorks/AgileWorks/WebView/View/WebViewController.swift b/AgileWorks/AgileWorks/WebView/View/WebViewController.swift index 9171a30..0779b35 100644 --- a/AgileWorks/AgileWorks/WebView/View/WebViewController.swift +++ b/AgileWorks/AgileWorks/WebView/View/WebViewController.swift @@ -196,10 +196,10 @@ class WebViewController: UIViewController { // オフラインViewセットアップ func setDisconnectView() { - disconnectLabel.text = NSLocalizedString("DisconnectNetworkLabel", comment: "") + disconnectLabel.text = getStrings(key: "DisconnectNetworkLabel", comment: "") disconnectLabel.textAlignment = .center disconnectLabel.textColor = UIColor.red - checkConnectButton.setTitle(NSLocalizedString("CheckConnectButton", comment: ""), for: .normal) + checkConnectButton.setTitle(getStrings(key: "CheckConnectButton", comment: ""), for: .normal) } // ネットワークモニタリング開始 diff --git a/AgileWorks/Common/Utility/NumberUtility.swift b/AgileWorks/Common/Utility/NumberUtility.swift index 868dc7c..2e5d2d8 100644 --- a/AgileWorks/Common/Utility/NumberUtility.swift +++ b/AgileWorks/Common/Utility/NumberUtility.swift @@ -15,3 +15,5 @@ extension Int { return formatter.string(from: NSNumber(value: self)) ?? String(self) } } + + diff --git a/AgileWorks/Common/Utility/StringsUtility.swift b/AgileWorks/Common/Utility/StringsUtility.swift index 7ece240..c3d3243 100644 --- a/AgileWorks/Common/Utility/StringsUtility.swift +++ b/AgileWorks/Common/Utility/StringsUtility.swift @@ -11,15 +11,15 @@ import Foundation //多言語対応 //言語の種類 -let languageArray = ["日本語", "English", "簡体字", "繁体字"] +let languageArray = ["日本語", "English", "中文(簡体)", "中文(繁体)"] //言語を設定する -func setStringsName(stringsName: String){ +func setStringsName(stringsName: String) { KeychainDataStore().writeLanguage(language: stringsName) } //設定中の言語ファイル(stringsファイル)名を取得する -func getStringsName()->String { +func getStringsName() -> String { var stringName = Configuration.shared.awLanguage //設定されていない場合は環境に依存した言語で返す if stringName.isEmpty { @@ -29,6 +29,7 @@ func getStringsName()->String { } //指定した言語を取得する + func getStrings(key: String, comment: String) -> String { return NSLocalizedString(key, tableName: getStringsName(), comment: comment) } @@ -44,3 +45,4 @@ func getLanguageIndex(stringsName: String) -> Int { } return index } + diff --git a/AgileWorks/Common/WfAction.swift b/AgileWorks/Common/WfAction.swift index 3833171..d64c990 100644 --- a/AgileWorks/Common/WfAction.swift +++ b/AgileWorks/Common/WfAction.swift @@ -17,7 +17,7 @@ enum WfAction: String, CaseIterable { case suspend = "suspend" func toLabel() -> String { - NSLocalizedString("Wf\(self.rawValue.capitalized)", comment: "") + getStrings(key: "Wf\(self.rawValue.capitalized)", comment: "") } static func from(name: String) -> Self? { diff --git a/AgileWorks/ShareExtension/View/ShareViewController.swift b/AgileWorks/ShareExtension/View/ShareViewController.swift index 70f2b42..131f84a 100644 --- a/AgileWorks/ShareExtension/View/ShareViewController.swift +++ b/AgileWorks/ShareExtension/View/ShareViewController.swift @@ -5,7 +5,6 @@ // Created by 本多 洋平 on 2020/12/08. // Copyright © 2020 ATLED CORP. All rights reserved. // - import UIKit enum ShareExtensionError: Int, Error { @@ -31,17 +30,17 @@ class ShareViewController: UITableViewController { importCertificateFromContext() { identity, error in if let identity = identity { CertificateDataStore().writeClientCertificate(identity: identity) - self.alertInUiThread(message: NSLocalizedString("CertificateImportSuccess", comment: "")) { + self.alertInUiThread(message: getStrings(key: "CertificateImportSuccess", comment: "")) { self.extensionContext?.completeRequest(returningItems: nil, completionHandler: nil) } } else { if let error = error as NSError?, (error.domain == NSOSStatusErrorDomain) && (error.code == errSecAuthFailed) { // パスフレース間違い - self.alertInUiThread(message: NSLocalizedString("IncorrectPassphrase", comment: "")) {} + self.alertInUiThread(message: getStrings(key: "IncorrectPassphrase", comment: "")) {} } else { // その他のエラー - self.alertInUiThread(message: NSLocalizedString("CertificateImportError", comment: "")) { + self.alertInUiThread(message: getStrings(key: "CertificateImportError", comment: "")) { self.extensionContext?.cancelRequest(withError: error ?? ShareExtensionError.genericError) } } @@ -112,7 +111,7 @@ class ShareViewController: UITableViewController { private func alertInUiThread(message: String, completion: @escaping () -> Void) { DispatchQueue.main.async { let alertController = UIAlertController(title: "AgileWorks", message: message, preferredStyle: .alert) - let okAction = UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default, handler: { _ in completion() }) + let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default, handler: { _ in completion() }) alertController.addAction(okAction) self.present(alertController, animated: true, completion: nil) } diff --git a/AgileWorks/TodayExtension/View/TodayViewController.swift b/AgileWorks/TodayExtension/View/TodayViewController.swift index a9ba575..7b9cde6 100644 --- a/AgileWorks/TodayExtension/View/TodayViewController.swift +++ b/AgileWorks/TodayExtension/View/TodayViewController.swift @@ -111,7 +111,7 @@ extension TodayViewController: UITableViewDelegate { extension TodayViewController { func fetch(completion: @escaping (APIResult) -> Void) { guard KeychainDataStore().readAccessToken() != nil else { - completion(.failure(NSLocalizedString("NotLogedin", comment: ""))) + completion(.failure(getStrings(key: "NotLogedin", comment: ""))) return } @@ -123,7 +123,7 @@ extension TodayViewController { if response.itemCount > 0 { completion(.success(response)) } else { - completion(.nodate(NSLocalizedString("NoData", comment: ""))) + completion(.nodate(getStrings(key: "NoData", comment: ""))) } case .failure(let error): var errorMessage = "-" @@ -143,9 +143,9 @@ extension TodayViewController { func errorMessageNSError(error: Error) -> String? { switch URLError.Code(rawValue: (error as NSError).code) { case .notConnectedToInternet: // -1009 - return NSLocalizedString("NotConnectNetworkError", comment: "") + return getStrings(key: "NotConnectNetworkError", comment: "") case .timedOut: // -1001 - return NSLocalizedString("TimedOutNetworkError", comment: "") + return getStrings(key: "TimedOutNetworkError", comment: "") default: return nil } -- GitLab From 8a1f7473761e22c632f9a2ae63597b0c3d0dd171 Mon Sep 17 00:00:00 2001 From: Azuma Kasumi Date: Tue, 22 Feb 2022 13:03:40 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=E3=83=89=E3=83=AD=E3=83=83=E3=83=97?= =?UTF-8?q?=E3=83=80=E3=82=A6=E3=83=B3=E3=80=8C=E8=87=AA=E5=8B=95=E3=80=8D?= =?UTF-8?q?=E9=A0=85=E7=9B=AE=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AgileWorks/Strings/en.lproj/Localizable.strings | 2 +- .../AgileWorks/Strings/ja.lproj/Localizable.strings | 2 +- .../AgileWorks/Strings/zh-Hans.lproj/Localizable.strings | 2 +- .../AgileWorks/Strings/zh-Hant.lproj/Localizable.strings | 2 +- AgileWorks/Common/Utility/StringsUtility.swift | 8 ++++++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings index f8e3aa3..1335f6f 100644 --- a/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings @@ -13,7 +13,7 @@ "AppVersion" = "App ver. %@"; // Login -"Language" = "English"; +"Language" = "auto"; "ServerURLPlaceholder" = "AgileWorksサーバ"; "ContextPlaceholder" = "AgileWorks"; "LoginButton" = "接続"; diff --git a/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings index 91e02f0..c2a90d9 100644 --- a/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings @@ -13,7 +13,7 @@ "AppVersion" = "App ver. %@"; // Login -"Language" = "日本語"; +"Language" = "自動"; "ServerURLPlaceholder" = "AgileWorksサーバ"; "ContextPlaceholder" = "AgileWorks"; "LoginButton" = "接続"; diff --git a/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings index 133d21f..9473ece 100644 --- a/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings @@ -13,7 +13,7 @@ "AppVersion" = "App ver. %@"; // Login -"Language" = "中文(簡体)"; +"Language" = "自动的"; "ServerURLPlaceholder" = "AgileWorksサーバ"; "ContextPlaceholder" = "AgileWorks"; "LoginButton" = "接続"; diff --git a/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings index 9fe21bf..84235c7 100644 --- a/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings @@ -13,7 +13,7 @@ "AppVersion" = "App ver. %@"; // Login -"Language" = "中文(繁体)"; +"Language" = "自動的"; "ServerURLPlaceholder" = "AgileWorksサーバ"; "ContextPlaceholder" = "AgileWorks"; "LoginButton" = "接続"; diff --git a/AgileWorks/Common/Utility/StringsUtility.swift b/AgileWorks/Common/Utility/StringsUtility.swift index c3d3243..c3fa24c 100644 --- a/AgileWorks/Common/Utility/StringsUtility.swift +++ b/AgileWorks/Common/Utility/StringsUtility.swift @@ -11,7 +11,7 @@ import Foundation //多言語対応 //言語の種類 -let languageArray = ["日本語", "English", "中文(簡体)", "中文(繁体)"] +let languageArray = [getLocalizableStrings(key: "Language", comment: ""), "日本語", "English", "中文(簡体)", "中文(繁体)"] //言語を設定する func setStringsName(stringsName: String) { @@ -28,8 +28,12 @@ func getStringsName() -> String { return stringName } -//指定した言語を取得する +//OSで設定している言語を取得する +private func getLocalizableStrings(key: String, comment: String) -> String { + return NSLocalizedString(key, tableName: "Localizable", comment: comment) +} +//指定した言語を取得する func getStrings(key: String, comment: String) -> String { return NSLocalizedString(key, tableName: getStringsName(), comment: comment) } -- GitLab From 0e3778762abe497622ed7dcda0580fc55fcdf771 Mon Sep 17 00:00:00 2001 From: Azuma Kasumi Date: Tue, 22 Feb 2022 17:24:55 +0900 Subject: [PATCH 4/4] =?UTF-8?q?=E3=83=AC=E3=83=93=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AgileWorks.xcodeproj/project.pbxproj | 4 +-- AgileWorks/AgileWorks/App/AppShared.swift | 2 +- .../View/Cell/ModalCollectionViewCell.swift | 6 ++-- .../Form/View/FormWebViewController.swift | 14 ++++---- .../FormWebViewScriptMessageHandler.swift | 4 +-- .../Login/View/LoginViewController.swift | 34 +++++++++---------- .../Main/Builder/MainTabBarViewBuilder.swift | 20 +++++------ .../Splash/View/SplashViewController.swift | 6 ++-- .../Strings/Chinese-Simplified.strings | 20 +++++++---- .../Strings/Chinese-Traditional.strings | 18 +++++++--- AgileWorks/AgileWorks/Strings/English.strings | 18 +++++++--- .../AgileWorks/Strings/Japanese.strings | 11 +++++- .../Strings/zh-Hans.lproj/Localizable.strings | 19 ++++++++--- .../Strings/zh-Hant.lproj/Localizable.strings | 18 +++++++--- .../View/MenuTableViewController.swift | 10 +++--- .../WebView/View/WebViewController.storyboard | 12 +++---- .../WebView/View/WebViewController.swift | 28 +++++++-------- .../View/WebViewScriptMessageHandler.swift | 4 +-- .../Common/Utility/StringsUtility.swift | 26 +++++++------- AgileWorks/Common/WfAction.swift | 2 +- .../View/ShareViewController.swift | 8 ++--- .../View/TodayViewController.swift | 8 ++--- 22 files changed, 171 insertions(+), 121 deletions(-) diff --git a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj index beb1dee..2ec4c6f 100644 --- a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj +++ b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj @@ -995,12 +995,12 @@ }; buildConfigurationList = BDA1830A23F3FD7F00C9A6DD /* Build configuration list for PBXProject "AgileWorks" */; compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; + developmentRegion = ja; hasScannedForEncodings = 0; knownRegions = ( + ja, en, Base, - ja, "zh-Hans", "zh-Hant", ); diff --git a/AgileWorks/AgileWorks/App/AppShared.swift b/AgileWorks/AgileWorks/App/AppShared.swift index c9e5639..0492ce6 100644 --- a/AgileWorks/AgileWorks/App/AppShared.swift +++ b/AgileWorks/AgileWorks/App/AppShared.swift @@ -39,5 +39,5 @@ class AppShared { func appVersionLabelText() -> String { let version = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String - return String(format: getStrings(key: "AppVersion", comment: ""), version) + return String(format: localizadString(key: "AppVersion", comment: ""), version) } diff --git a/AgileWorks/AgileWorks/Form/View/Cell/ModalCollectionViewCell.swift b/AgileWorks/AgileWorks/Form/View/Cell/ModalCollectionViewCell.swift index 19dae7c..1f8795b 100644 --- a/AgileWorks/AgileWorks/Form/View/Cell/ModalCollectionViewCell.swift +++ b/AgileWorks/AgileWorks/Form/View/Cell/ModalCollectionViewCell.swift @@ -84,8 +84,8 @@ class ModalCollectionViewCell: UICollectionViewCell { // naviBtns.enabled に override.enabled の内容も反映されているが処理の対称性のために両方見ておく。 textLabel.isEnabled = override?.enabled ?? naviBtns.enabled isUserInteractionEnabled = naviBtns.enabled ? true : false - layer.borderColor = naviBtns.enabled ? UIColor(named: getStrings(key: "MainColor", comment: ""))!.cgColor : UIColor(named: getStrings(key: "ClickBtnColor", comment: ""))!.cgColor - textLabel.textColor = naviBtns.enabled ? UIColor(named: getStrings(key: "MainColor", comment: ""))! : UIColor(named: getStrings(key: "ClickBtnColor", comment: ""))! + layer.borderColor = naviBtns.enabled ? UIColor(named: localizadString(key: "MainColor", comment: ""))!.cgColor : UIColor(named: localizadString(key: "ClickBtnColor", comment: ""))!.cgColor + textLabel.textColor = naviBtns.enabled ? UIColor(named: localizadString(key: "MainColor", comment: ""))! : UIColor(named: localizadString(key: "ClickBtnColor", comment: ""))! if let size = textLabelSize { textLabel.sizeThatFits(size) } else { @@ -93,7 +93,7 @@ class ModalCollectionViewCell: UICollectionViewCell { textLabel.sizeToFit() } iconView.image = UIImage(named: getType(type: naviBtns.type).rawValue) - iconView.tintColor = naviBtns.enabled ? UIColor(named: getStrings(key: "MainColor", comment: ""))! : UIColor(named: getStrings(key: "ClickBtnColor", comment: ""))! + iconView.tintColor = naviBtns.enabled ? UIColor(named: localizadString(key: "MainColor", comment: ""))! : UIColor(named: localizadString(key: "ClickBtnColor", comment: ""))! setBadge(badge) } diff --git a/AgileWorks/AgileWorks/Form/View/FormWebViewController.swift b/AgileWorks/AgileWorks/Form/View/FormWebViewController.swift index e42c8b4..4768915 100644 --- a/AgileWorks/AgileWorks/Form/View/FormWebViewController.swift +++ b/AgileWorks/AgileWorks/Form/View/FormWebViewController.swift @@ -102,7 +102,7 @@ class FormWebViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - self.navigationController?.navigationBar.barTintColor = UIColor(named: getStrings(key: "MainColor", comment: "")) + self.navigationController?.navigationBar.barTintColor = UIColor(named: localizadString(key: "MainColor", comment: "")) self.navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: UIColor.white] self.navigationController?.presentationController?.delegate = self // モーダルDismiss設定(iOS13のみ) @@ -118,7 +118,7 @@ class FormWebViewController: UIViewController { } self.navigationItem.title = self.formTitle - self.closeButton.title = getStrings(key: "Close", comment: "") + self.closeButton.title = localizadString(key: "Close", comment: "") self.subWebViewStack.eventDelegate = self self.updateSession() } @@ -445,7 +445,7 @@ class FormWebViewController: UIViewController { extension FormWebViewController: SubWebViewStackEventDelegate { func onClose(webView: WKWebView, stack: SubWebViewStack) { if stack.isEmpty { - closeButton.title = getStrings(key: "Close", comment: "") + closeButton.title = localizadString(key: "Close", comment: "") } } } @@ -674,7 +674,7 @@ extension FormWebViewController: WKUIDelegate { func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) { let alertController = UIAlertController(title: "", message: message, preferredStyle: .alert) - let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in + let okAction = UIAlertAction(title: localizadString(key: "OK", comment: ""), style: .default) { _ in completionHandler() } alertController.addAction(okAction) @@ -683,10 +683,10 @@ extension FormWebViewController: WKUIDelegate { func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) { let alertController = UIAlertController(title: "", message: message, preferredStyle: .alert) - let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in + let okAction = UIAlertAction(title: localizadString(key: "OK", comment: ""), style: .default) { _ in completionHandler(true) } - let cancelAction = UIAlertAction(title: getStrings(key: "Cancel", comment: ""), style: .cancel) { _ in + let cancelAction = UIAlertAction(title: localizadString(key: "Cancel", comment: ""), style: .cancel) { _ in completionHandler(false) } alertController.addAction(okAction) @@ -699,7 +699,7 @@ extension FormWebViewController: WKUIDelegate { let webView = WKWebView(frame: view.frame, configuration: configuration) webView.load(navigationAction.request) subWebViewStack.push(webView, superView: view) - closeButton.title = getStrings(key: "Close Subwindow", comment: "") + closeButton.title = localizadString(key: "Close Subwindow", comment: "") return webView } return nil diff --git a/AgileWorks/AgileWorks/Form/View/FormWebViewScriptMessageHandler.swift b/AgileWorks/AgileWorks/Form/View/FormWebViewScriptMessageHandler.swift index f8264da..8c94f7a 100644 --- a/AgileWorks/AgileWorks/Form/View/FormWebViewScriptMessageHandler.swift +++ b/AgileWorks/AgileWorks/Form/View/FormWebViewScriptMessageHandler.swift @@ -51,8 +51,8 @@ class FormWebViewScriptMessageHandler: NSObject { // パラメータ: なし "loggedOut": { controller, _, _ in DispatchQueue.main.async { - let alertController = UIAlertController(title: getStrings(key: "LogoutAlertTitle", comment: ""), message: getStrings(key: "LogoutAlertMessage", comment: ""), preferredStyle: .alert) - let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in + let alertController = UIAlertController(title: localizadString(key: "LogoutAlertTitle", comment: ""), message: localizadString(key: "LogoutAlertMessage", comment: ""), preferredStyle: .alert) + let okAction = UIAlertAction(title: localizadString(key: "OK", comment: ""), style: .default) { _ in controller.dismiss(animated: true, completion: nil) } alertController.addAction(okAction) diff --git a/AgileWorks/AgileWorks/Login/View/LoginViewController.swift b/AgileWorks/AgileWorks/Login/View/LoginViewController.swift index 1c4d72f..b534602 100644 --- a/AgileWorks/AgileWorks/Login/View/LoginViewController.swift +++ b/AgileWorks/AgileWorks/Login/View/LoginViewController.swift @@ -81,7 +81,7 @@ class LoginViewController: UIViewController { view.addSubview(activityIndicator) activityIndicator.frame = view.bounds - activityIndicator.backgroundColor = UIColor(named: getStrings(key: "IndicatorBackgroud", comment: "")) + activityIndicator.backgroundColor = UIColor(named: localizadString(key: "IndicatorBackgroud", comment: "")) activityIndicator.translatesAutoresizingMaskIntoConstraints = false @@ -97,7 +97,7 @@ class LoginViewController: UIViewController { //言語選択(ドロップダウン)の作成 private func createLanguageDropDown() { //現在設定中の言語 - let language = getStrings(key: "Language", comment: "") + let language = localizadString(key: "Language", comment: "") //プルダウンメニュー詳細設定 languageView.layer.borderColor = UIColor.black.cgColor languageView.layer.borderWidth = 0.5 @@ -107,7 +107,7 @@ class LoginViewController: UIViewController { languageDropDown.dataSource = languageArray languageDropDown.backgroundColor = UIColor.white languageDropDown.cornerRadius = 10 - languageDropDown.selectRow(at: getLanguageIndex(stringsName: language)) + languageDropDown.selectRow(at: getLanguageIndex(dropDownItem: language)) //言語が選択されたアクションは以下に記載する languageDropDown.selectionAction = { [unowned self] (index: Int, item: String) in languageDropDownAction(item: item) @@ -133,7 +133,7 @@ class LoginViewController: UIViewController { setStringsName(stringsName: "Chinese-Traditional") default: setStringsName(stringsName: "Localizable") - languageLabel.text = getStrings(key: "Language", comment: "") + languageLabel.text = localizadString(key: "Language", comment: "") } //ログイン画面の固定文言表示を変更する loguinTranslation() @@ -141,9 +141,9 @@ class LoginViewController: UIViewController { //ログイン画面の固定文言表示 private func loguinTranslation() { - loginButton.setTitle(getStrings(key: "LoginButton", comment: ""), for: .normal) - qrCodeReadLabel.text = getStrings(key: "QRCodeReadLabel", comment: "") - serverTextField.placeholder = getStrings(key: "ServerURLPlaceholder", comment: "") + loginButton.setTitle(localizadString(key: "LoginButton", comment: ""), for: .normal) + qrCodeReadLabel.text = localizadString(key: "QRCodeReadLabel", comment: "") + serverTextField.placeholder = localizadString(key: "ServerURLPlaceholder", comment: "") } override func viewDidLayoutSubviews() { @@ -197,8 +197,8 @@ class LoginViewController: UIViewController { case .failure(let error): log.e(error) DispatchQueue.main.async { - let message = getStrings(key: "LoginErrorMessage", comment: "") - let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default, handler: nil) + let message = localizadString(key: "LoginErrorMessage", comment: "") + let okAction = UIAlertAction(title: localizadString(key: "OK", comment: ""), style: .default, handler: nil) AppDelegate.shared.rootViewController.showAlertScreen(view: self, title: "", message: message, defaultAction: okAction, cancelAction: nil) self.enableLogin() } @@ -215,19 +215,19 @@ class LoginViewController: UIViewController { // 読み込めるカメラ範囲設定 qrCodeReader.readRange() // ガイダンス設定 - qrCodeReader.setCameraGuide(guide: getStrings(key: "QRCodeReadGuidance", comment: "")) + qrCodeReader.setCameraGuide(guide: localizadString(key: "QRCodeReadGuidance", comment: "")) } else { qrCodeReader.delegate = nil // カメラ起動失敗 - let message = getStrings(key: "CameraStartupErrorMessage", comment: "") - let defaultAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in } + let message = localizadString(key: "CameraStartupErrorMessage", comment: "") + let defaultAction = UIAlertAction(title: localizadString(key: "OK", comment: ""), style: .default) { _ in } AppDelegate.shared.rootViewController.showAlertScreen(view: self, title: "", message: message, defaultAction: defaultAction, cancelAction: nil) } } private func updateCloudUsage() { - serverTextField.placeholder = getStrings(key: "ServerURLPlaceholder", comment: "") - contextTextField.placeholder = getStrings(key: "ContextPlaceholder", comment: "") + serverTextField.placeholder = localizadString(key: "ServerURLPlaceholder", comment: "") + contextTextField.placeholder = localizadString(key: "ContextPlaceholder", comment: "") loginButton.isEnabled = isTextFieldValue() } @@ -287,12 +287,12 @@ class LoginViewController: UIViewController { } @IBAction private func clientCertificateRemovalTapped(_ sender: Any) { - let alertController = UIAlertController(title: "", message: getStrings(key: "ClientCertificateRemovalConfirmation", comment: ""), preferredStyle: .alert) - let okAction = UIAlertAction(title:getStrings(key: "ClientCertificateRemovalOK", comment: ""), style: .default) { _ in + let alertController = UIAlertController(title: "", message: localizadString(key: "ClientCertificateRemovalConfirmation", comment: ""), preferredStyle: .alert) + let okAction = UIAlertAction(title:localizadString(key: "ClientCertificateRemovalOK", comment: ""), style: .default) { _ in CertificateDataStore().removeClientCertificate() self.clientCertificateSettingView.isHidden = true } - let cancelAction = UIAlertAction(title: getStrings(key: "ClientCertificateRemovalCancel", comment: ""), style: .cancel, handler: nil) + let cancelAction = UIAlertAction(title: localizadString(key: "ClientCertificateRemovalCancel", comment: ""), style: .cancel, handler: nil) alertController.addAction(okAction) alertController.addAction(cancelAction) present(alertController, animated: true, completion: nil) diff --git a/AgileWorks/AgileWorks/Main/Builder/MainTabBarViewBuilder.swift b/AgileWorks/AgileWorks/Main/Builder/MainTabBarViewBuilder.swift index 60c0c86..b8d6367 100644 --- a/AgileWorks/AgileWorks/Main/Builder/MainTabBarViewBuilder.swift +++ b/AgileWorks/AgileWorks/Main/Builder/MainTabBarViewBuilder.swift @@ -60,35 +60,35 @@ extension MainTabBarViewBuilderImpl { let viewVC = view.viewControllers[view.viewControllers.count - 1] as! WebViewController switch type { case ViewType.home.rawValue: - view.tabBarItem.title = getStrings(key: "HomeTitle", comment: "") + view.tabBarItem.title = localizadString(key: "HomeTitle", comment: "") //view.tabBarItem.image = "" //view.tabBarItem.selectedItem = "" viewVC.loadURL = createLoadUrl(urlPath: ViewURL.home.rawValue) - viewVC.naviTitle = getStrings(key: "HomeTitle", comment: "") + viewVC.naviTitle = localizadString(key: "HomeTitle", comment: "") case ViewType.work.rawValue: - view.tabBarItem.title = getStrings(key: "WorkTitle", comment: "") + view.tabBarItem.title = localizadString(key: "WorkTitle", comment: "") //view.tabBarItem.image = "" //view.tabBarItem.selectedItem = "" viewVC.loadURL = createLoadUrl(urlPath: ViewURL.work.rawValue) - viewVC.naviTitle = getStrings(key: "WorkTitle", comment: "") + viewVC.naviTitle = localizadString(key: "WorkTitle", comment: "") case ViewType.documents.rawValue: - view.tabBarItem.title = getStrings(key: "DocumentsTitle", comment: "") + view.tabBarItem.title = localizadString(key: "DocumentsTitle", comment: "") //view.tabBarItem.image = "" //view.tabBarItem.selectedItem = "" viewVC.loadURL = ViewURL.documents.rawValue - viewVC.naviTitle = getStrings(key: "DocumentsTitle", comment: "") + viewVC.naviTitle = localizadString(key: "DocumentsTitle", comment: "") case ViewType.search.rawValue: - view.tabBarItem.title = getStrings(key: "SearchTitle", comment: "") + view.tabBarItem.title = localizadString(key: "SearchTitle", comment: "") //view.tabBarItem.image = "" //view.tabBarItem.selectedItem = "" viewVC.loadURL = createLoadUrl(urlPath: ViewURL.search.rawValue) - viewVC.naviTitle = getStrings(key: "SearchTitle", comment: "") + viewVC.naviTitle = localizadString(key: "SearchTitle", comment: "") default: - view.tabBarItem.title = getStrings(key: "HomeTitle", comment: "") + view.tabBarItem.title = localizadString(key: "HomeTitle", comment: "") //view.tabBarItem.image = "" //view.tabBarItem.selectedItem = "" viewVC.loadURL = createLoadUrl(urlPath: ViewURL.home.rawValue) - viewVC.naviTitle = getStrings(key: "HomeTitle", comment: "") + viewVC.naviTitle = localizadString(key: "HomeTitle", comment: "") } return view } diff --git a/AgileWorks/AgileWorks/Splash/View/SplashViewController.swift b/AgileWorks/AgileWorks/Splash/View/SplashViewController.swift index a1d963c..bbaa738 100644 --- a/AgileWorks/AgileWorks/Splash/View/SplashViewController.swift +++ b/AgileWorks/AgileWorks/Splash/View/SplashViewController.swift @@ -29,10 +29,10 @@ class SplashViewController: UIViewController { super.viewDidLoad() logoImage.tintColor = .white - self.view.backgroundColor = UIColor(named: getStrings(key: "MainColor", comment: "")) + self.view.backgroundColor = UIColor(named: localizadString(key: "MainColor", comment: "")) view.addSubview(activityIndicator) activityIndicator.frame = view.bounds - activityIndicator.backgroundColor = UIColor(named: getStrings(key: "IndicatorBackgroud", comment: "")) + activityIndicator.backgroundColor = UIColor(named: localizadString(key: "IndicatorBackgroud", comment: "")) activityIndicator.translatesAutoresizingMaskIntoConstraints = false @@ -54,7 +54,7 @@ class SplashViewController: UIViewController { var error: NSError? if context.canEvaluatePolicy(.deviceOwnerAuthentication, error: &error) { - context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: getStrings(key: "Auth", comment: "")) { sucess, error in + context.evaluatePolicy(.deviceOwnerAuthentication, localizedReason: localizadString(key: "Auth", comment: "")) { sucess, error in if sucess { self.freshToken() } else { diff --git a/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings b/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings index 900c582..c0fb7e8 100644 --- a/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings +++ b/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings @@ -1,4 +1,4 @@ -/* +/* Chinese-Simplified.strings AgileWorks @@ -30,6 +30,13 @@ "WorkTitle" = "仕事"; "DocumentsTitle" = "書類作成"; "SearchTitle" = "検索"; +"CheckConnectButton" = "接続確認"; + +// SideMenu +"ProfileTitle" = "プロファイル"; +"LogoutTitle" = "ログアウト"; +"LicenseTitle" = "ライセンス"; +"OpenLicenseTitle" = "オープンソースライセンス"; // Approval "ApprovalTitle" = "承認一覧"; @@ -79,6 +86,7 @@ "RefreshTokenUpdateError" = "AgileWorksサーバへアクセスするためのトークンの更新が行えませんでした。\n再ログインする必要があります。"; // Network Error Message +"DisconnectNetworkLabel" = "現在オフラインです。\nオフライン中の操作はお控えください。"; "UnknownNetworkError" = "ネットワークエラーが発生しました"; "NotConnectNetworkError" = "インターネットにアクセスするにはモバイルデータ通信をオンにするかWi-Fiを利用してください"; "TimedOutNetworkError" = "インターネットに接続できません\nしばらく経ってから再度おためしください"; @@ -96,9 +104,9 @@ // Form "OK" = "OK"; -"Cancel" = "Cancel"; -"Close" = "Close"; -"Close Subwindow" = "Close Subwindow"; +"Cancel" = "キャンセル"; +"Close" = "閉じる"; +"Close Subwindow" = "閉じる (サブウィンドウ)"; // Form (ログアウト通知) "LogoutAlertTitle" = "ログアウト通知"; @@ -128,8 +136,8 @@ "NotLogedin" = "アプリからログインしてください"; // WfAction -"WfApprove" = "Approve"; -"WfSuspend" = "Suspend"; +"WfApprove" = "承認"; +"WfSuspend" = "保留"; // ShareExtension "CertificateImportSuccess" = "クライアント証明書をインポートしました。"; diff --git a/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings b/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings index 65afe29..37a66ee 100644 --- a/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings +++ b/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings @@ -30,6 +30,13 @@ "WorkTitle" = "仕事"; "DocumentsTitle" = "書類作成"; "SearchTitle" = "検索"; +"CheckConnectButton" = "接続確認"; + +// SideMenu +"ProfileTitle" = "プロファイル"; +"LogoutTitle" = "ログアウト"; +"LicenseTitle" = "ライセンス"; +"OpenLicenseTitle" = "オープンソースライセンス"; // Approval "ApprovalTitle" = "承認一覧"; @@ -79,6 +86,7 @@ "RefreshTokenUpdateError" = "AgileWorksサーバへアクセスするためのトークンの更新が行えませんでした。\n再ログインする必要があります。"; // Network Error Message +"DisconnectNetworkLabel" = "現在オフラインです。\nオフライン中の操作はお控えください。"; "UnknownNetworkError" = "ネットワークエラーが発生しました"; "NotConnectNetworkError" = "インターネットにアクセスするにはモバイルデータ通信をオンにするかWi-Fiを利用してください"; "TimedOutNetworkError" = "インターネットに接続できません\nしばらく経ってから再度おためしください"; @@ -96,9 +104,9 @@ // Form "OK" = "OK"; -"Cancel" = "Cancel"; -"Close" = "Close"; -"Close Subwindow" = "Close Subwindow"; +"Cancel" = "キャンセル"; +"Close" = "閉じる"; +"Close Subwindow" = "閉じる (サブウィンドウ)"; // Form (ログアウト通知) "LogoutAlertTitle" = "ログアウト通知"; @@ -128,8 +136,8 @@ "NotLogedin" = "アプリからログインしてください"; // WfAction -"WfApprove" = "Approve"; -"WfSuspend" = "Suspend"; +"WfApprove" = "承認"; +"WfSuspend" = "保留"; // ShareExtension "CertificateImportSuccess" = "クライアント証明書をインポートしました。"; diff --git a/AgileWorks/AgileWorks/Strings/English.strings b/AgileWorks/AgileWorks/Strings/English.strings index c07c682..8bcd43b 100644 --- a/AgileWorks/AgileWorks/Strings/English.strings +++ b/AgileWorks/AgileWorks/Strings/English.strings @@ -30,6 +30,13 @@ "WorkTitle" = "仕事"; "DocumentsTitle" = "書類作成"; "SearchTitle" = "検索"; +"CheckConnectButton" = "接続確認"; + +// SideMenu +"ProfileTitle" = "プロファイル"; +"LogoutTitle" = "ログアウト"; +"LicenseTitle" = "ライセンス"; +"OpenLicenseTitle" = "オープンソースライセンス"; // Approval "ApprovalTitle" = "承認一覧"; @@ -79,6 +86,7 @@ "RefreshTokenUpdateError" = "AgileWorksサーバへアクセスするためのトークンの更新が行えませんでした。\n再ログインする必要があります。"; // Network Error Message +"DisconnectNetworkLabel" = "現在オフラインです。\nオフライン中の操作はお控えください。"; "UnknownNetworkError" = "ネットワークエラーが発生しました"; "NotConnectNetworkError" = "インターネットにアクセスするにはモバイルデータ通信をオンにするかWi-Fiを利用してください"; "TimedOutNetworkError" = "インターネットに接続できません\nしばらく経ってから再度おためしください"; @@ -96,9 +104,9 @@ // Form "OK" = "OK"; -"Cancel" = "Cancel"; -"Close" = "Close"; -"Close Subwindow" = "Close Subwindow"; +"Cancel" = "キャンセル"; +"Close" = "閉じる"; +"Close Subwindow" = "閉じる (サブウィンドウ)"; // Form (ログアウト通知) "LogoutAlertTitle" = "ログアウト通知"; @@ -128,8 +136,8 @@ "NotLogedin" = "アプリからログインしてください"; // WfAction -"WfApprove" = "Approve"; -"WfSuspend" = "Suspend"; +"WfApprove" = "承認"; +"WfSuspend" = "保留"; // ShareExtension "CertificateImportSuccess" = "クライアント証明書をインポートしました。"; diff --git a/AgileWorks/AgileWorks/Strings/Japanese.strings b/AgileWorks/AgileWorks/Strings/Japanese.strings index c03bed2..0f32d65 100644 --- a/AgileWorks/AgileWorks/Strings/Japanese.strings +++ b/AgileWorks/AgileWorks/Strings/Japanese.strings @@ -1,4 +1,4 @@ -/* +/* Japanese.strings AgileWorks @@ -30,6 +30,13 @@ "WorkTitle" = "仕事"; "DocumentsTitle" = "書類作成"; "SearchTitle" = "検索"; +"CheckConnectButton" = "接続確認"; + +// SideMenu +"ProfileTitle" = "プロファイル"; +"LogoutTitle" = "ログアウト"; +"LicenseTitle" = "ライセンス"; +"OpenLicenseTitle" = "オープンソースライセンス"; // Approval "ApprovalTitle" = "承認一覧"; @@ -79,6 +86,7 @@ "RefreshTokenUpdateError" = "AgileWorksサーバへアクセスするためのトークンの更新が行えませんでした。\n再ログインする必要があります。"; // Network Error Message +"DisconnectNetworkLabel" = "現在オフラインです。\nオフライン中の操作はお控えください。"; "UnknownNetworkError" = "ネットワークエラーが発生しました"; "NotConnectNetworkError" = "インターネットにアクセスするにはモバイルデータ通信をオンにするかWi-Fiを利用してください"; "TimedOutNetworkError" = "インターネットに接続できません\nしばらく経ってから再度おためしください"; @@ -135,3 +143,4 @@ "CertificateImportSuccess" = "クライアント証明書をインポートしました。"; "IncorrectPassphrase" = "パスフレーズが違います。"; "CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; + diff --git a/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings index 9473ece..e675cda 100644 --- a/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings @@ -30,6 +30,13 @@ "WorkTitle" = "仕事"; "DocumentsTitle" = "書類作成"; "SearchTitle" = "検索"; +"CheckConnectButton" = "接続確認"; + +// SideMenu +"ProfileTitle" = "プロファイル"; +"LogoutTitle" = "ログアウト"; +"LicenseTitle" = "ライセンス"; +"OpenLicenseTitle" = "オープンソースライセンス"; // Approval "ApprovalTitle" = "承認一覧"; @@ -79,6 +86,7 @@ "RefreshTokenUpdateError" = "AgileWorksサーバへアクセスするためのトークンの更新が行えませんでした。\n再ログインする必要があります。"; // Network Error Message +"DisconnectNetworkLabel" = "現在オフラインです。\nオフライン中の操作はお控えください。"; "UnknownNetworkError" = "ネットワークエラーが発生しました"; "NotConnectNetworkError" = "インターネットにアクセスするにはモバイルデータ通信をオンにするかWi-Fiを利用してください"; "TimedOutNetworkError" = "インターネットに接続できません\nしばらく経ってから再度おためしください"; @@ -96,9 +104,9 @@ // Form "OK" = "OK"; -"Cancel" = "Cancel"; -"Close" = "Close"; -"Close Subwindow" = "Close Subwindow"; +"Cancel" = "キャンセル"; +"Close" = "閉じる"; +"Close Subwindow" = "閉じる (サブウィンドウ)"; // Form (ログアウト通知) "LogoutAlertTitle" = "ログアウト通知"; @@ -128,10 +136,11 @@ "NotLogedin" = "アプリからログインしてください"; // WfAction -"WfApprove" = "Approve"; -"WfSuspend" = "Suspend"; +"WfApprove" = "承認"; +"WfSuspend" = "保留"; // ShareExtension "CertificateImportSuccess" = "クライアント証明書をインポートしました。"; "IncorrectPassphrase" = "パスフレーズが違います。"; "CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; + diff --git a/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings index 84235c7..c46f769 100644 --- a/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings @@ -30,6 +30,13 @@ "WorkTitle" = "仕事"; "DocumentsTitle" = "書類作成"; "SearchTitle" = "検索"; +"CheckConnectButton" = "接続確認"; + +// SideMenu +"ProfileTitle" = "プロファイル"; +"LogoutTitle" = "ログアウト"; +"LicenseTitle" = "ライセンス"; +"OpenLicenseTitle" = "オープンソースライセンス"; // Approval "ApprovalTitle" = "承認一覧"; @@ -79,6 +86,7 @@ "RefreshTokenUpdateError" = "AgileWorksサーバへアクセスするためのトークンの更新が行えませんでした。\n再ログインする必要があります。"; // Network Error Message +"DisconnectNetworkLabel" = "現在オフラインです。\nオフライン中の操作はお控えください。"; "UnknownNetworkError" = "ネットワークエラーが発生しました"; "NotConnectNetworkError" = "インターネットにアクセスするにはモバイルデータ通信をオンにするかWi-Fiを利用してください"; "TimedOutNetworkError" = "インターネットに接続できません\nしばらく経ってから再度おためしください"; @@ -96,9 +104,9 @@ // Form "OK" = "OK"; -"Cancel" = "Cancel"; -"Close" = "Close"; -"Close Subwindow" = "Close Subwindow"; +"Cancel" = "キャンセル"; +"Close" = "閉じる"; +"Close Subwindow" = "閉じる (サブウィンドウ)"; // Form (ログアウト通知) "LogoutAlertTitle" = "ログアウト通知"; @@ -128,8 +136,8 @@ "NotLogedin" = "アプリからログインしてください"; // WfAction -"WfApprove" = "Approve"; -"WfSuspend" = "Suspend"; +"WfApprove" = "承認"; +"WfSuspend" = "保留"; // ShareExtension "CertificateImportSuccess" = "クライアント証明書をインポートしました。"; diff --git a/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift b/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift index 1f8e282..e571549 100644 --- a/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift +++ b/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift @@ -20,7 +20,7 @@ class MenuTableViewController: UITableViewController { override func viewDidLoad() { super.viewDidLoad() - self.tableView.separatorColor = UIColor(named: getStrings(key: "SeparatorColor", comment: "")) + self.tableView.separatorColor = UIColor(named: localizadString(key: "SeparatorColor", comment: "")) self.setup() } @@ -46,10 +46,10 @@ class MenuTableViewController: UITableViewController { // 各種セットアップ private func setup() { // 各ラベル設定 - self.profileLabel.text = getStrings(key: "ProfileTitle", comment: "") - self.logoutLabel.text = getStrings(key: "LogoutTitle", comment: "") - self.licenseLabel.text = getStrings(key: "LicenseTitle", comment: "") - self.openLicenseLable.text = getStrings(key: "OpenLicenseTitle", comment: "") + self.profileLabel.text = localizadString(key: "ProfileTitle", comment: "") + self.logoutLabel.text = localizadString(key: "LogoutTitle", comment: "") + self.licenseLabel.text = localizadString(key: "LicenseTitle", comment: "") + self.openLicenseLable.text = localizadString(key: "OpenLicenseTitle", comment: "") } // プロファイルセルタップ処理 private func pushToProfile() { diff --git a/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard b/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard index b7eb59c..176bcb7 100644 --- a/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard +++ b/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard @@ -1,9 +1,9 @@ - + - + @@ -183,7 +183,7 @@ - + @@ -206,7 +206,7 @@ - + @@ -229,7 +229,7 @@ - + @@ -252,7 +252,7 @@ - + diff --git a/AgileWorks/AgileWorks/WebView/View/WebViewController.swift b/AgileWorks/AgileWorks/WebView/View/WebViewController.swift index 0779b35..3637f53 100644 --- a/AgileWorks/AgileWorks/WebView/View/WebViewController.swift +++ b/AgileWorks/AgileWorks/WebView/View/WebViewController.swift @@ -32,9 +32,9 @@ class WebViewController: UIViewController { // Title を設定する URL を定義 let urlToTitle: [String: String] = [ - "Mobile#home": getStrings(key: "HomeTitle", comment: ""), - "Mobile#work": getStrings(key: "WorkTitle", comment: ""), - "Mobile#agileWorksSearch": getStrings(key: "SearchTitle", comment: "") + "Mobile#home": localizadString(key: "HomeTitle", comment: ""), + "Mobile#work": localizadString(key: "WorkTitle", comment: ""), + "Mobile#agileWorksSearch": localizadString(key: "SearchTitle", comment: "") ] // reload 対象URL let reloadUrl: [String] = ["Mobile#docDetail"] @@ -177,16 +177,16 @@ class WebViewController: UIViewController { // リフレッシュトークン更新エラーの場合 if refreshError { DispatchQueue.main.async { - let title = getStrings(key: "RefreshTokenUpdateErrorTitle", comment: "") - let message = getStrings(key: "RefreshTokenUpdateError", comment: "") - let defaultAction = AppDelegate.shared.rootViewController.logoutDefaultAction(title: getStrings(key: "OK", comment: "")) + let title = localizadString(key: "RefreshTokenUpdateErrorTitle", comment: "") + let message = localizadString(key: "RefreshTokenUpdateError", comment: "") + let defaultAction = AppDelegate.shared.rootViewController.logoutDefaultAction(title: localizadString(key: "OK", comment: "")) AppDelegate.shared.rootViewController.showAlertScreen(view: self, title: title, message: message, defaultAction: defaultAction, cancelAction: nil) } // その他エラーの場合 } else { DispatchQueue.main.async { - let message = getStrings(key: "UnknownNetworkError", comment: "") - let defaultAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in } + let message = localizadString(key: "UnknownNetworkError", comment: "") + let defaultAction = UIAlertAction(title: localizadString(key: "OK", comment: ""), style: .default) { _ in } AppDelegate.shared.rootViewController.showAlertScreen(view: self, title: "", message: message, defaultAction: defaultAction, cancelAction: nil) } } @@ -196,10 +196,10 @@ class WebViewController: UIViewController { // オフラインViewセットアップ func setDisconnectView() { - disconnectLabel.text = getStrings(key: "DisconnectNetworkLabel", comment: "") + disconnectLabel.text = localizadString(key: "DisconnectNetworkLabel", comment: "") disconnectLabel.textAlignment = .center disconnectLabel.textColor = UIColor.red - checkConnectButton.setTitle(getStrings(key: "CheckConnectButton", comment: ""), for: .normal) + checkConnectButton.setTitle(localizadString(key: "CheckConnectButton", comment: ""), for: .normal) } // ネットワークモニタリング開始 @@ -304,7 +304,7 @@ class WebViewController: UIViewController { extension WebViewController: WKUIDelegate { func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) { let alertController = UIAlertController(title: "", message: message, preferredStyle: .alert) - let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in + let okAction = UIAlertAction(title: localizadString(key: "OK", comment: ""), style: .default) { _ in completionHandler() } alertController.addAction(okAction) @@ -313,10 +313,10 @@ extension WebViewController: WKUIDelegate { func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) { let alertController = UIAlertController(title: "", message: message, preferredStyle: .alert) - let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in + let okAction = UIAlertAction(title: localizadString(key: "OK", comment: ""), style: .default) { _ in completionHandler(true) } - let cancelAction = UIAlertAction(title: getStrings(key: "Cancel", comment: ""), style: .cancel) { _ in + let cancelAction = UIAlertAction(title: localizadString(key: "Cancel", comment: ""), style: .cancel) { _ in completionHandler(false) } alertController.addAction(okAction) @@ -348,7 +348,7 @@ extension WebViewController: WKUIDelegate { extension WebViewController: SubWebViewStackEventDelegate { func onClose(webView: WKWebView, stack: SubWebViewStack) { if stack.isEmpty { - //closeButton.title = getStrings(key: "Close", comment: "") + //closeButton.title = localizadStrings(key: "Close", comment: "") } } } diff --git a/AgileWorks/AgileWorks/WebView/View/WebViewScriptMessageHandler.swift b/AgileWorks/AgileWorks/WebView/View/WebViewScriptMessageHandler.swift index 0c931a8..1b2c5e8 100644 --- a/AgileWorks/AgileWorks/WebView/View/WebViewScriptMessageHandler.swift +++ b/AgileWorks/AgileWorks/WebView/View/WebViewScriptMessageHandler.swift @@ -18,8 +18,8 @@ class WebViewScriptMessageHandler: NSObject { // 名前は、sample に変えて "sample": { controller, _, _ in DispatchQueue.main.async { - let alertController = UIAlertController(title: getStrings(key: "LogoutAlertTitle", comment: ""), message: getStrings(key: "LogoutAlertMessage", comment: ""), preferredStyle: .alert) - let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default) { _ in + let alertController = UIAlertController(title: localizadString(key: "LogoutAlertTitle", comment: ""), message: localizadString(key: "LogoutAlertMessage", comment: ""), preferredStyle: .alert) + let okAction = UIAlertAction(title: localizadString(key: "OK", comment: ""), style: .default) { _ in controller.dismiss(animated: true, completion: nil) } alertController.addAction(okAction) diff --git a/AgileWorks/Common/Utility/StringsUtility.swift b/AgileWorks/Common/Utility/StringsUtility.swift index c3fa24c..f9c04d0 100644 --- a/AgileWorks/Common/Utility/StringsUtility.swift +++ b/AgileWorks/Common/Utility/StringsUtility.swift @@ -19,13 +19,13 @@ func setStringsName(stringsName: String) { } //設定中の言語ファイル(stringsファイル)名を取得する -func getStringsName() -> String { - var stringName = Configuration.shared.awLanguage +func getStringsFileName() -> String { + var stringsFileName = Configuration.shared.awLanguage //設定されていない場合は環境に依存した言語で返す - if stringName.isEmpty { - stringName = "Localizable" + if stringsFileName.isEmpty { + stringsFileName = "Localizable" } - return stringName + return stringsFileName } //OSで設定している言語を取得する @@ -34,19 +34,19 @@ private func getLocalizableStrings(key: String, comment: String) -> String { } //指定した言語を取得する -func getStrings(key: String, comment: String) -> String { - return NSLocalizedString(key, tableName: getStringsName(), comment: comment) +func localizadString(key: String, comment: String) -> String { + return NSLocalizedString(key, tableName: getStringsFileName(), comment: comment) } //選択中の言語の要素番号を返す -func getLanguageIndex(stringsName: String) -> Int { +func getLanguageIndex(dropDownItem: String) -> Int { var index = 0 for language in languageArray { - if language == stringsName { - break + if language == dropDownItem { + return index + }else { + index += 1 } - index += 1 } - return index + return 0 } - diff --git a/AgileWorks/Common/WfAction.swift b/AgileWorks/Common/WfAction.swift index d64c990..4068daa 100644 --- a/AgileWorks/Common/WfAction.swift +++ b/AgileWorks/Common/WfAction.swift @@ -17,7 +17,7 @@ enum WfAction: String, CaseIterable { case suspend = "suspend" func toLabel() -> String { - getStrings(key: "Wf\(self.rawValue.capitalized)", comment: "") + localizadString(key: "Wf\(self.rawValue.capitalized)", comment: "") } static func from(name: String) -> Self? { diff --git a/AgileWorks/ShareExtension/View/ShareViewController.swift b/AgileWorks/ShareExtension/View/ShareViewController.swift index 131f84a..b9dfaae 100644 --- a/AgileWorks/ShareExtension/View/ShareViewController.swift +++ b/AgileWorks/ShareExtension/View/ShareViewController.swift @@ -30,17 +30,17 @@ class ShareViewController: UITableViewController { importCertificateFromContext() { identity, error in if let identity = identity { CertificateDataStore().writeClientCertificate(identity: identity) - self.alertInUiThread(message: getStrings(key: "CertificateImportSuccess", comment: "")) { + self.alertInUiThread(message: localizadString(key: "CertificateImportSuccess", comment: "")) { self.extensionContext?.completeRequest(returningItems: nil, completionHandler: nil) } } else { if let error = error as NSError?, (error.domain == NSOSStatusErrorDomain) && (error.code == errSecAuthFailed) { // パスフレース間違い - self.alertInUiThread(message: getStrings(key: "IncorrectPassphrase", comment: "")) {} + self.alertInUiThread(message: localizadString(key: "IncorrectPassphrase", comment: "")) {} } else { // その他のエラー - self.alertInUiThread(message: getStrings(key: "CertificateImportError", comment: "")) { + self.alertInUiThread(message: localizadString(key: "CertificateImportError", comment: "")) { self.extensionContext?.cancelRequest(withError: error ?? ShareExtensionError.genericError) } } @@ -111,7 +111,7 @@ class ShareViewController: UITableViewController { private func alertInUiThread(message: String, completion: @escaping () -> Void) { DispatchQueue.main.async { let alertController = UIAlertController(title: "AgileWorks", message: message, preferredStyle: .alert) - let okAction = UIAlertAction(title: getStrings(key: "OK", comment: ""), style: .default, handler: { _ in completion() }) + let okAction = UIAlertAction(title: localizadString(key: "OK", comment: ""), style: .default, handler: { _ in completion() }) alertController.addAction(okAction) self.present(alertController, animated: true, completion: nil) } diff --git a/AgileWorks/TodayExtension/View/TodayViewController.swift b/AgileWorks/TodayExtension/View/TodayViewController.swift index 7b9cde6..bb0451d 100644 --- a/AgileWorks/TodayExtension/View/TodayViewController.swift +++ b/AgileWorks/TodayExtension/View/TodayViewController.swift @@ -111,7 +111,7 @@ extension TodayViewController: UITableViewDelegate { extension TodayViewController { func fetch(completion: @escaping (APIResult) -> Void) { guard KeychainDataStore().readAccessToken() != nil else { - completion(.failure(getStrings(key: "NotLogedin", comment: ""))) + completion(.failure(localizadString(key: "NotLogedin", comment: ""))) return } @@ -123,7 +123,7 @@ extension TodayViewController { if response.itemCount > 0 { completion(.success(response)) } else { - completion(.nodate(getStrings(key: "NoData", comment: ""))) + completion(.nodate(localizadString(key: "NoData", comment: ""))) } case .failure(let error): var errorMessage = "-" @@ -143,9 +143,9 @@ extension TodayViewController { func errorMessageNSError(error: Error) -> String? { switch URLError.Code(rawValue: (error as NSError).code) { case .notConnectedToInternet: // -1009 - return getStrings(key: "NotConnectNetworkError", comment: "") + return localizadString(key: "NotConnectNetworkError", comment: "") case .timedOut: // -1001 - return getStrings(key: "TimedOutNetworkError", comment: "") + return localizadString(key: "TimedOutNetworkError", comment: "") default: return nil } -- GitLab