Skip to content

Commit 1f93588

Browse files
committed
update POS text in cell to be localizable, adjust test
1 parent df9e7e5 commit 1f93588

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

WooCommerce/Classes/ViewRelated/Orders/Cells/OrderListCellViewModel.swift

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ struct OrderListCellViewModel {
8585

8686
switch createdVia {
8787
case "pos-rest-api":
88-
return "POS"
88+
return Localization.salesChannelPOSText
8989
default:
9090
return nil
9191
}
@@ -113,18 +113,24 @@ struct OrderListCellViewModel {
113113
#endif
114114
}
115115

116-
// MARK: - Constants
117-
118-
private extension OrderListCellViewModel {
116+
extension OrderListCellViewModel {
119117
enum Localization {
120118
static func title(orderNumber: String, customerName: String) -> String {
121-
let format = NSLocalizedString("#%@ %@", comment: "In Order List,"
119+
let format = NSLocalizedString(
120+
"orderlistcellviewmodel.cell.title",
121+
value: "#%@ %@",
122+
comment: "In Order List,"
122123
+ " the pattern to show the order number. For example, “#123456”."
123124
+ " The %@ placeholder is the order number.")
124-
125125
return String.localizedStringWithFormat(format, orderNumber, customerName)
126126
}
127-
128-
static let guestName = NSLocalizedString("Guest", comment: "In Order List, the name of the billed person when there are no first and last name.")
127+
static let guestName = NSLocalizedString(
128+
"orderlistcellviewmodel.customerName.guestName",
129+
value: "Guest",
130+
comment: "In Order List, the name of the billed person when there are no first and last name.")
131+
static let salesChannelPOSText = NSLocalizedString(
132+
"orderlistcellviewmodel.salesChannel.salesChannelPOSText",
133+
value: "POS",
134+
comment: "In Order List, the acronym for 'Point of Sale' that is shown as a badge for certain orders.")
129135
}
130136
}

WooCommerce/WooCommerceTests/ViewRelated/Orders/OrderListCellViewModelTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ final class OrderListCellViewModelTests: XCTestCase {
7070
let viewModel = OrderListCellViewModel(order: order, currencySettings: ServiceLocator.currencySettings)
7171

7272
// Then
73-
XCTAssertEqual(viewModel.salesChannel, "POS")
73+
XCTAssertEqual(viewModel.salesChannel, OrderListCellViewModel.Localization.salesChannelPOSText)
7474
}
7575

7676
func test_salesChannel_when_createdVia_is_nil_then_returns_nil() {

0 commit comments

Comments
 (0)