Skip to content

Commit

Permalink
Groups string resources
Browse files Browse the repository at this point in the history
  • Loading branch information
antonis committed Apr 20, 2022
1 parent e2f575c commit babc542
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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.")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit babc542

Please sign in to comment.