<commit_before>class TextFormattingTableViewController: TextFormattingProvidingTableViewController {

    override var titleLabelText: String? {
        return WMFLocalizedString("edit-text-formatting-table-view-title", value: "Text formatting", comment: "Title for text formatting menu in the editing interface")
    }

    private struct Content {
        let type: ContentType
        let title: String?
        let detailText: String?
        let customView: (UIView & Themeable)?

        init(type: ContentType, title: String? = nil, detailText: String? = nil, customView: (UIView & Themeable)? = nil) {
            self.type = type
            self.title = title
            self.detailText = detailText
            self.customView = customView
        }
    }

    private enum ContentType {
        case customView
        case detail
    }

    private struct Item {
        let cell: TextFormattingTableViewCell.Type
        let content: Content
        let onSelection: (() -> Void)?

        init(with content: Content, onSelection: (() -> Void)? = nil) {
            switch content.type {
            case .customView:
                self.cell = TextFormattingCustomViewTableViewCell.self
            case .detail:
                self.cell = TextFormattingDetailTableViewCell.self
            }
            self.content = content
            self.onSelection = onSelection
        }
    }

    // MARK: - Items
    // Some are lazy, some need to be updated so they can't all be in a lazy array

    let textStyleFormattingTableViewController = TextStyleFormattingTableViewController.wmf_viewControllerFromStoryboardNamed("TextFormatting")
    let textSizeFormattingTableViewController = TextSizeFormattingTableViewController.wmf_viewControllerFromStoryboardNamed("TextFormatting")

    private var textStyle: Item {
        let showTextStyleFormattingTableViewController = {
            self.textStyleFormattingTableViewController.delegate = self.delegate
            self.textStyleFormattingTableViewController.selectedTextStyleType = self.selectedTextStyleType
            self.textStyleFormattingTableViewController.apply(theme: self.theme)
            self.navigationController?.pushViewController(self.textStyleFormattingTableViewController, animated: true)
        }
        return Item(with: Content(type: .detail, title: "Style", detailText: selectedTextStyleType.name), onSelection: showTextStyleFormattingTableViewController)
    }

    private var textSize: Item {
        let showTextSizeFormattingTableViewController = {
            self.textSizeFormattingTableViewController.delegate = self.delegate
            self.textSizeFormattingTableViewController.selectedTextSizeType = self.selectedTextSizeType
            self.textSizeFormattingTableViewController.apply(theme: self.theme)
            self.navigationController?.pushViewController(self.textSizeFormattingTableViewController, animated: true)
        }
        return Item(with: Content(type: .detail, title: "Text size", detailText: selectedTextSizeType.name), onSelection: showTextSizeFormattingTableViewController)
    }

    private let textFormattingPlainToolbarView = TextFormattingPlainToolbarView.wmf_viewFromClassNib()
    private let textFormattingGroupedToolbarView = TextFormattingGroupedToolbarView.wmf_viewFromClassNib()
    
    weak override var delegate: TextFormattingDelegate? {
        didSet {
            textFormattingPlainToolbarView?.delegate = delegate
            textFormattingGroupedToolbarView?.delegate = delegate
        }
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    private lazy var staticItems: [Item] = {
        let plainToolbar = Item(with: Content(type: .customView, customView: textFormattingPlainToolbarView))

        let groupedToolbar = Item(with: Content(type: .customView, customView: textFormattingGroupedToolbarView))
        
        return [plainToolbar, groupedToolbar]
    }()

    private var items: [Item] {
        var allItems = staticItems
        allItems.insert(textStyle, at: 2)
        return allItems
    }
<commit_msg>use localized strings<commit_after>class TextFormattingTableViewController: TextFormattingProvidingTableViewController {

    override var titleLabelText: String? {
        return WMFLocalizedString("edit-text-formatting-table-view-title", value: "Text formatting", comment: "Title for text formatting menu in the editing interface")
    }

    private struct Content {
        let type: ContentType
        let title: String?
        let detailText: String?
        let customView: (UIView & Themeable)?

        init(type: ContentType, title: String? = nil, detailText: String? = nil, customView: (UIView & Themeable)? = nil) {
            self.type = type
            self.title = title
            self.detailText = detailText
            self.customView = customView
        }
    }

    private enum ContentType {
        case customView
        case detail
    }

    private struct Item {
        let cell: TextFormattingTableViewCell.Type
        let content: Content
        let onSelection: (() -> Void)?

        init(with content: Content, onSelection: (() -> Void)? = nil) {
            switch content.type {
            case .customView:
                self.cell = TextFormattingCustomViewTableViewCell.self
            case .detail:
                self.cell = TextFormattingDetailTableViewCell.self
            }
            self.content = content
            self.onSelection = onSelection
        }
    }

    // MARK: - Items
    // Some are lazy, some need to be updated so they can't all be in a lazy array

    let textStyleFormattingTableViewController = TextStyleFormattingTableViewController.wmf_viewControllerFromStoryboardNamed("TextFormatting")
    let textSizeFormattingTableViewController = TextSizeFormattingTableViewController.wmf_viewControllerFromStoryboardNamed("TextFormatting")

    private var textStyle: Item {
        let showTextStyleFormattingTableViewController = {
            self.textStyleFormattingTableViewController.delegate = self.delegate
            self.textStyleFormattingTableViewController.selectedTextStyleType = self.selectedTextStyleType
            self.textStyleFormattingTableViewController.apply(theme: self.theme)
            self.navigationController?.pushViewController(self.textStyleFormattingTableViewController, animated: true)
        }
        return Item(with: Content(type: .detail, title: textStyleFormattingTableViewController.titleLabelText, detailText: selectedTextStyleType.name), onSelection: showTextStyleFormattingTableViewController)
    }

    private var textSize: Item {
        let showTextSizeFormattingTableViewController = {
            self.textSizeFormattingTableViewController.delegate = self.delegate
            self.textSizeFormattingTableViewController.selectedTextSizeType = self.selectedTextSizeType
            self.textSizeFormattingTableViewController.apply(theme: self.theme)
            self.navigationController?.pushViewController(self.textSizeFormattingTableViewController, animated: true)
        }
        return Item(with: Content(type: .detail, title: textSizeFormattingTableViewController.titleLabelText, detailText: selectedTextSizeType.name), onSelection: showTextSizeFormattingTableViewController)
    }

    private let textFormattingPlainToolbarView = TextFormattingPlainToolbarView.wmf_viewFromClassNib()
    private let textFormattingGroupedToolbarView = TextFormattingGroupedToolbarView.wmf_viewFromClassNib()
    
    weak override var delegate: TextFormattingDelegate? {
        didSet {
            textFormattingPlainToolbarView?.delegate = delegate
            textFormattingGroupedToolbarView?.delegate = delegate
        }
    }

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    private lazy var staticItems: [Item] = {
        let plainToolbar = Item(with: Content(type: .customView, customView: textFormattingPlainToolbarView))

        let groupedToolbar = Item(with: Content(type: .customView, customView: textFormattingGroupedToolbarView))
        
        return [plainToolbar, groupedToolbar]
    }()

    private var items: [Item] {
        var allItems = staticItems
        allItems.insert(textStyle, at: 2)
        return allItems
    }

{'fraction_non_alphanumeric': 0.06991500059858734, 'fraction_numerical': 0.00023943493355680593, 'mean_word_length': 3.1438492063492065, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, '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': '6124566', 'n_tokens_mistral': 2123, 'n_tokens_neox': 2049, 'n_words': 463}