//
//  © 2019-2020 Qualcomm Technologies, Inc. and/or its subsidiaries. All rights reserved.
//

import UIKit

extension UIBarButtonItem {
    func makeAccessible(_ value: String) {
        isAccessibilityElement = true
        accessibilityLabel = NSLocalizedString(value, comment: "Accessibility") // Label is human readable
        accessibilityIdentifier = value // Identifier is for dev use
    }

    func makeAccessible(_ value: String, localizableSuffix: String) {
        isAccessibilityElement = true
        accessibilityLabel = value + " " + NSLocalizedString(localizableSuffix, comment: "Accessibility") // Label is human readable
        accessibilityIdentifier = value + " " + localizableSuffix // Identifier is for dev use
    }

    func makeAccessible(localizablePrefix: String, value: String) {
        isAccessibilityElement = true
        accessibilityLabel = NSLocalizedString(localizablePrefix, comment: "Accessibility") + " " + value // Label is human readable
        accessibilityIdentifier = localizablePrefix + " " + value // Identifier is for dev use
    }
}
