From babc542445c63b38afa12643abe19746e3dc30cb Mon Sep 17 00:00:00 2001 From: antonis Date: Wed, 20 Apr 2022 14:54:34 +0300 Subject: [PATCH] Groups string resources --- .../SiteDesignPreviewViewController.swift | 16 ++++++------- ...esignContentCollectionViewController.swift | 23 ++++++++++--------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Site Creation/Design Selection/Preview/SiteDesignPreviewViewController.swift b/WordPress/Classes/ViewRelated/Site Creation/Design Selection/Preview/SiteDesignPreviewViewController.swift index 681430091d03..1e1464885af4 100644 --- a/WordPress/Classes/ViewRelated/Site Creation/Design Selection/Preview/SiteDesignPreviewViewController.swift +++ b/WordPress/Classes/ViewRelated/Site Creation/Design Selection/Preview/SiteDesignPreviewViewController.swift @@ -11,7 +11,7 @@ class SiteDesignPreviewViewController: TemplatePreviewViewController { self.createsSite = createsSite super.init(demoURL: siteDesign.demoURL, selectedPreviewDevice: selectedPreviewDevice, onDismissWithDeviceSelected: onDismissWithDeviceSelected) delegate = self - title = NSLocalizedString("Preview", comment: "Title for screen to preview a selected homepage design") + title = TextContent.previewTitle } required init?(coder: NSCoder) { @@ -25,13 +25,13 @@ class SiteDesignPreviewViewController: TemplatePreviewViewController { } private func setPrimaryActionButtonTitle() { - let title: String - if createsSite { - title = NSLocalizedString("Create site", comment: "Title for the button to progress with creating the site with the selected design") - } else { - title = NSLocalizedString("Choose", comment: "Title for the button to progress with the selected site homepage design") - } - primaryActionButton.setTitle(title, for: .normal) + primaryActionButton.setTitle(createsSite ? TextContent.createSiteButton : TextContent.chooseButton, for: .normal) + } + + private enum TextContent { + static let previewTitle = NSLocalizedString("Preview", comment: "Title for screen to preview a selected homepage design.") + static let createSiteButton = NSLocalizedString("Create site", comment: "Title for the button to progress with creating the site with the selected design.") + static let chooseButton = NSLocalizedString("Choose", comment: "Title for the button to progress with the selected site homepage design.") } } diff --git a/WordPress/Classes/ViewRelated/Site Creation/Design Selection/SiteDesignContentCollectionViewController.swift b/WordPress/Classes/ViewRelated/Site Creation/Design Selection/SiteDesignContentCollectionViewController.swift index f1cdf8e1f52d..84809c7e63e6 100644 --- a/WordPress/Classes/ViewRelated/Site Creation/Design Selection/SiteDesignContentCollectionViewController.swift +++ b/WordPress/Classes/ViewRelated/Site Creation/Design Selection/SiteDesignContentCollectionViewController.swift @@ -60,22 +60,23 @@ class SiteDesignContentCollectionViewController: FilterableCategoriesViewControl self.completion = completion self.createsSite = createsSite - let primaryActionTitle: String - if createsSite { - primaryActionTitle = NSLocalizedString("Create site", comment: "Title for the button to progress with creating the site with the selected design") - } else { - primaryActionTitle = NSLocalizedString("Choose", comment: "Title for the button to progress with the selected site homepage design") - } - super.init( analyticsLocation: "site_creation", - mainTitle: NSLocalizedString("Choose a design", comment: "Title for the screen to pick a design and homepage for a site."), - prompt: NSLocalizedString("Pick your favorite homepage layout. You can edit and customize it later.", comment: "Prompt for the screen to pick a design and homepage for a site."), - primaryActionTitle: primaryActionTitle, - secondaryActionTitle: NSLocalizedString("Preview", comment: "Title for button to preview a selected homepage design") + mainTitle: TextContent.mainTitle, + prompt: TextContent.subtitle, + primaryActionTitle: createsSite ? TextContent.createSiteButton : TextContent.chooseButton, + secondaryActionTitle: TextContent.previewButton ) } + private enum TextContent { + static let mainTitle = NSLocalizedString("Choose a design", comment: "Title for the screen to pick a design and homepage for a site.") + static let subtitle = NSLocalizedString("Pick your favorite homepage layout. You can edit and customize it later.", comment: "Prompt for the screen to pick a design and homepage for a site.") + static let createSiteButton = NSLocalizedString("Create site", comment: "Title for the button to progress with creating the site with the selected design.") + static let chooseButton = NSLocalizedString("Choose", comment: "Title for the button to progress with the selected site homepage design.") + static let previewButton = NSLocalizedString("Preview", comment: "Title for button to preview a selected homepage design.") + } + required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }