<commit_before>
class WMFAuthLinkLabel: UILabel {
    override open func awakeFromNib() {
        super.awakeFromNib()
        textColor = UIColor.wmf_blueTint()
        numberOfLines = 0
        lineBreakMode = .byWordWrapping
        textAlignment = .natural
    }
    override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
        super.traitCollectionDidChange(previousTraitCollection)
        font = UIFont.wmf_preferredFontForFontFamily(WMFFontFamily.systemBold, withTextStyle: .subheadline, compatibleWithTraitCollection: self.traitCollection)
    }
}<commit_msg>Let WMFAuthLinkLabel handle compound auth label strings.<commit_after>
struct WMFAuthLinkLabelStrings {
    /// String containing "$1" substring.
    var dollarSignString: String
    
    /// String which will replace "$1" in "dollarSignString".
    var substitutionString: String
}

class WMFAuthLinkLabel: UILabel {
    override open func awakeFromNib() {
        super.awakeFromNib()
        textColor = UIColor.wmf_blueTint()
        numberOfLines = 0
        lineBreakMode = .byWordWrapping
        textAlignment = .natural
    }

    /// Some auth labels display a string from two localized strings, each styled differently.
    public var strings: WMFAuthLinkLabelStrings?

    override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
        super.traitCollectionDidChange(previousTraitCollection)
        
        let boldSubheadlineFont = UIFont.wmf_preferredFontForFontFamily(WMFFontFamily.systemBold, withTextStyle: .subheadline, compatibleWithTraitCollection: self.traitCollection)!

        guard let strings = strings else {
            // Not combining two strings.
            font = boldSubheadlineFont
            return
        }

        // Combine and style 'dollarSignString' and 'substitutionString'.
        // https://github.com/wikimedia/wikipedia-ios/pull/1216#discussion_r104224511
        let subheadlineFont = UIFont.wmf_preferredFontForFontFamily(WMFFontFamily.system, withTextStyle: .subheadline, compatibleWithTraitCollection: self.traitCollection)!
        let dollarSignStringAttributes: [String:Any] = [NSForegroundColorAttributeName : UIColor.black, NSFontAttributeName : subheadlineFont]
        let substitutionStringAttributes: [String:Any] = [NSForegroundColorAttributeName : UIColor.wmf_blueTint(), NSFontAttributeName : boldSubheadlineFont]
        assert(strings.dollarSignString.contains("$1"), "Expected dollar sign substitution placeholder not found")
        attributedText = strings.dollarSignString.attributedString(attributes: dollarSignStringAttributes, substitutionStrings: [strings.substitutionString], substitutionAttributes: [substitutionStringAttributes])
    }
}
{'fraction_non_alphanumeric': 0.07332123411978221, 'fraction_numerical': 0.006533575317604356, 'mean_word_length': 4.010909090909091, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6067489', 'n_tokens_mistral': 746, 'n_tokens_neox': 723, 'n_words': 156}