Skip to content

Commit 9a19487

Browse files
committed
Add localizations
1 parent aa85786 commit 9a19487

File tree

3 files changed

+75
-9
lines changed

3 files changed

+75
-9
lines changed

WooCommerce/Classes/ViewModels/Booking Details/AppointmentDetailsContent.swift

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,53 @@ extension BookingDetailsViewModel {
2323
].joined(separator: " - ")
2424

2525
rows = [
26-
Row(title: "Date", value: appointmentDate),
27-
Row(title: "Time", value: appointmentTimeFrame),
28-
Row(title: "Service", value: "Women's Haircut"),
29-
Row(title: "Quantity", value: "1"),
30-
Row(title: "Duration", value: String(durationMinutes)),
31-
Row(title: "Cost", value: booking.cost)
26+
Row(title: Localization.appointmentDetailsDateRowTitle, value: appointmentDate),
27+
Row(title: Localization.appointmentDetailsTimeRowTitle, value: appointmentTimeFrame),
28+
Row(title: Localization.appointmentDetailsServiceTitle, value: "Women's Haircut"),
29+
Row(title: Localization.appointmentDetailsQuantityTitle, value: "1"),
30+
Row(title: Localization.appointmentDetailsDurationTitle, value: String(durationMinutes)),
31+
Row(title: Localization.appointmentDetailsCostTitle, value: booking.cost)
3232
]
3333
}
3434
}
3535
}
36+
37+
private extension BookingDetailsViewModel.AppointmentDetailsContent {
38+
enum Localization {
39+
static let appointmentDetailsDateRowTitle = NSLocalizedString(
40+
"BookingDetailsView.appointmentDetails.dateRow.title",
41+
value: "Date",
42+
comment: "Date row title in appointment details section in booking details view."
43+
)
44+
45+
static let appointmentDetailsTimeRowTitle = NSLocalizedString(
46+
"BookingDetailsView.appointmentDetails.timeRow.title",
47+
value: "Time",
48+
comment: "Time row title in appointment details section in booking details view."
49+
)
50+
51+
static let appointmentDetailsServiceTitle = NSLocalizedString(
52+
"BookingDetailsView.appointmentDetails.serviceRow.title",
53+
value: "Service",
54+
comment: "Service name row title in appointment details section in booking details view."
55+
)
56+
57+
static let appointmentDetailsQuantityTitle = NSLocalizedString(
58+
"BookingDetailsView.appointmentDetails.quantityRow.title",
59+
value: "Quantity",
60+
comment: "Quantity row title in appointment details section in booking details view."
61+
)
62+
63+
static let appointmentDetailsDurationTitle = NSLocalizedString(
64+
"BookingDetailsView.appointmentDetails.durationRow.title",
65+
value: "Duration",
66+
comment: "Duration row title in appointment details section in booking details view."
67+
)
68+
69+
static let appointmentDetailsCostTitle = NSLocalizedString(
70+
"BookingDetailsView.appointmentDetails.costRow.title",
71+
value: "Cost",
72+
comment: "Cost row title in appointment details section in booking details view."
73+
)
74+
}
75+
}

WooCommerce/Classes/ViewModels/Booking Details/BookingDetailsViewModel+Status.swift

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ extension BookingDetailsViewModel.Status {
1111
var labelText: String {
1212
switch self {
1313
case .booked:
14-
return "Booked"
14+
return Localization.bookingStatusBooked
1515
case .paid:
16-
return "Paid"
16+
return Localization.bookingStatusPaid
1717
}
1818
}
1919

@@ -26,3 +26,19 @@ extension BookingDetailsViewModel.Status {
2626
}
2727
}
2828
}
29+
30+
private extension BookingDetailsViewModel.Status {
31+
enum Localization {
32+
static let bookingStatusBooked = NSLocalizedString(
33+
"BookingDetailsView.appointmentDetails.statusLabel.booked",
34+
value: "Booked",
35+
comment: "Title for the 'Booked' status label in the appointment details view."
36+
)
37+
38+
static let bookingStatusPaid = NSLocalizedString(
39+
"BookingDetailsView.appointmentDetails.statusLabel.paid",
40+
value: "Paid",
41+
comment: "Title for the 'Paid' status label in the appointment details view."
42+
)
43+
}
44+
}

WooCommerce/Classes/ViewModels/Booking Details/BookingDetailsViewModel.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ final class BookingDetailsViewModel: ObservableObject {
2424
)
2525

2626
let appointmentDetailsSection = Section(
27-
headerText: "Appointment Details".uppercased(),
27+
headerText: Localization.appointmentDetailsSectionHeaderTitle.uppercased(),
2828
content: .appointmentDetails(AppointmentDetailsContent(booking))
2929
)
3030

@@ -34,3 +34,13 @@ final class BookingDetailsViewModel: ObservableObject {
3434
]
3535
}
3636
}
37+
38+
private extension BookingDetailsViewModel {
39+
enum Localization {
40+
static let appointmentDetailsSectionHeaderTitle = NSLocalizedString(
41+
"BookingDetailsView.appointmentDetails.headerTitle",
42+
value: "Appointment Details",
43+
comment: "Header title for the 'Appointment Details' section in the booking details screen."
44+
)
45+
}
46+
}

0 commit comments

Comments
 (0)