Skip to content

Commit 9e3ed9c

Browse files
committed
Move strings into localization enum
1 parent 7660fd2 commit 9e3ed9c

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

WooCommerce/Classes/Authentication/Epilogue/StorePickerError.swift

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,46 +17,63 @@ final class StorePickerErrorHostingController: UIHostingController<StorePickerEr
1717
///
1818
struct StorePickerError: View {
1919
var body: some View {
20-
VStack(alignment: .center) {
20+
VStack(alignment: .center, spacing: 30) {
2121
// Title
22-
Text("We couldn't load your site")
22+
Text(Localization.title)
2323
.headlineStyle()
2424

2525
// Main image
2626
Image(uiImage: .errorImage)
2727

2828
// Body text
29-
Text("Please try again or reach out to us and we'll be happy to assist you!")
29+
Text(Localization.body)
3030
.bodyStyle()
3131

3232
// Primary Button
33-
Button("Read our Troubleshooting Tips") {
33+
Button(Localization.troubleshoot) {
3434
print("Troubleshooting Tips tapped")
3535
}
3636
.buttonStyle(PrimaryButtonStyle())
3737

3838
// Secondary button
39-
Button("Contact Support") {
39+
Button(Localization.contact) {
4040
print("Contact support tapped")
4141
}
4242
.buttonStyle(SecondaryButtonStyle())
4343

4444
// Dismiss button
45-
Button("Back to Sites") {
45+
Button(Localization.back) {
4646
print("Back to site")
4747
}
4848
.buttonStyle(LinkButtonStyle())
4949
}
5050
.background(Color(.basicBackground))
51+
.cornerRadius(10)
5152
.padding()
5253
}
5354
}
5455

56+
// MARK: Constant
57+
58+
private extension StorePickerError {
59+
enum Localization {
60+
static let title = NSLocalizedString("We couldn't load your site", comment: "Title for the default store picker error screen")
61+
static let body = NSLocalizedString("Please try again or reach out to us and we'll be happy to assist you!",
62+
comment: "Body text for the default store picker error screen")
63+
static let troubleshoot = NSLocalizedString("Read our Troubleshooting Tips",
64+
comment: "Text for the button to navigate to troubleshooting tips from the store picker error screen")
65+
static let contact = NSLocalizedString("Contact Support",
66+
comment: "Text for the button to contact support from the store picker error screen")
67+
static let back = NSLocalizedString("Back to Sites",
68+
comment: "Text for the button to dismiss the store picker error screen")
69+
}
70+
}
71+
5572
// MARK: Previews
5673

5774
struct StorePickerError_Preview: PreviewProvider {
5875
static var previews: some View {
5976
StorePickerError()
60-
.previewLayout(.fixed(width: 414, height: 768))
77+
.previewLayout(.sizeThatFits)
6178
}
6279
}

0 commit comments

Comments
 (0)