iOS 10 Camera view showing API_Cancel_Title instead of Cancel

后端 未结 5 1920
借酒劲吻你
借酒劲吻你 2021-02-15 17:40

I am working on an app using iOS 10 and using camera for taking pictures. When camera view opens, instead of cancel button there is a title \"API_CANCEL_TITLE\". And when I capt

5条回答
  •  感动是毒
    2021-02-15 18:09

    On this Extension of Bundle You need to check for the CameraUI in tableName. Use that change the value for the key of "Api_Cancel_title" to "Cancel" Using your own Localized value where you used to declare a your own value

    for example

    English "API_CANCEL_TITLE" = "Cancel";

    Hindi "API_CANCEL_TITLE" = "रद्द करना";

    French "API_CANCEL_TITLE" = "Annuler";

    // MARK: - Bundle Extension
    
    extension Bundle {
    
        @objc func specialLocalizedStringForKey(_ key: String, value: String?, table tableName: String?) -> String {
            let currentLanguage = CSLanguage.currentAppleLanguage()
            var bundle = Bundle.main
            if let path = Bundle.main.path(forResource: currentLanguage, ofType: "lproj") {
                bundle = Bundle.init(path: path)!
            } else {
                let basePath = Bundle.main.path(forResource: "Base", ofType: "lproj")
                bundle = Bundle.init(path: basePath!)!
            }
            if let name = tableName, name == "CameraUI"{
             let values = NSLocalizedString(key, comment: name)
    
             return values
            }
            if let name = tableName, name == "PhotoLibrary"{
             let values = NSLocalizedString(key, comment: name)
    
             return values
            }
            if let name = tableName, name == "PhotoLibraryServices"{
             let values = NSLocalizedString(key, comment: name)
    
             return values
            }
            if let name = tableName, name == "PhotosUI"
            {
             let values = NSLocalizedString(key, comment: name)
    
             return values
            }
            return bundle.specialLocalizedStringForKey(key, value: value, table: tableName)
        }
    }
    

提交回复
热议问题