<commit_before>//
//  ArticleThemeImporter.swift
//  NetNewsWire
//
//  Created by <NAME> on 9/18/21.
//  Copyright © 2021 Ranchero Software. All rights reserved.
//

import UIKit

struct ArticleThemeImporter {
	
	static func importTheme(controller: UIViewController, filename: String) throws {
		let theme = try ArticleTheme(path: filename)
		
		let localizedTitleText = NSLocalizedString("Install theme “%@” by %@?", comment: "Theme message text")
		let title = NSString.localizedStringWithFormat(localizedTitleText as NSString, theme.name, theme.creatorName) as String

		let localizedMessageText = NSLocalizedString("Author's Website:\n%@", comment: "Authors website")
		let message = NSString.localizedStringWithFormat(localizedMessageText as NSString, theme.creatorHomePage) as String

		let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
		
		let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
		alertController.addAction(UIAlertAction(title: cancelTitle, style: .cancel))
		
		if let url = URL(string: theme.creatorHomePage) {
			let visitSiteTitle = NSLocalizedString("Show Website", comment: "Show Website")
			let visitSiteAction = UIAlertAction(title: visitSiteTitle, style: .default) { action in
				UIApplication.shared.open(url)
				try? Self.importTheme(controller: controller, filename: filename)
			}
			alertController.addAction(visitSiteAction)
		}<commit_msg>Correct label<commit_after>//
//  ArticleThemeImporter.swift
//  NetNewsWire
//
//  Created by <NAME> on 9/18/21.
//  Copyright © 2021 Ranchero Software. All rights reserved.
//

import UIKit

struct ArticleThemeImporter {
	
	static func importTheme(controller: UIViewController, filename: String) throws {
		let theme = try ArticleTheme(path: filename)
		
		let localizedTitleText = NSLocalizedString("Install theme “%@” by %@?", comment: "Theme message text")
		let title = NSString.localizedStringWithFormat(localizedTitleText as NSString, theme.name, theme.creatorName) as String

		let localizedMessageText = NSLocalizedString("Author‘s website:\n%@", comment: "Authors website")
		let message = NSString.localizedStringWithFormat(localizedMessageText as NSString, theme.creatorHomePage) as String

		let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
		
		let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
		alertController.addAction(UIAlertAction(title: cancelTitle, style: .cancel))
		
		if let url = URL(string: theme.creatorHomePage) {
			let visitSiteTitle = NSLocalizedString("Show Website", comment: "Show Website")
			let visitSiteAction = UIAlertAction(title: visitSiteTitle, style: .default) { action in
				UIApplication.shared.open(url)
				try? Self.importTheme(controller: controller, filename: filename)
			}
			alertController.addAction(visitSiteAction)
		}
{'fraction_non_alphanumeric': 0.10215427380125087, 'fraction_numerical': 0.006254343293954135, 'mean_word_length': 5.31359649122807, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4612208', 'n_tokens_mistral': 899, 'n_tokens_neox': 785, 'n_words': 219}