Skip to content

Commit edb4689

Browse files
committed
Update WooShippingOriginAddress fullName property to consider locale
1 parent 1a10649 commit edb4689

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Details/Shipping Labels/WooShipping Create Shipping Labels/WooShippingAddresses/WooShippingOriginAddress+Woo.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ extension WooShippingOriginAddress {
1414
[fullName, company].compactMap { $0.isEmpty ? nil : $0 }.joined(separator: "\n")
1515
}
1616

17-
/// Returns the first and last name combined.
18-
/// If only one name is present, that name is returned.
17+
/// Returns the First + LastName combined according to language rules and Locale.
18+
///
1919
var fullName: String {
20-
[firstName, lastName].compactMap { $0.isEmpty ? nil : $0 }.joined(separator: " ")
20+
var components = PersonNameComponents()
21+
components.givenName = firstName
22+
components.familyName = lastName
23+
24+
return PersonNameComponentsFormatter.localizedString(from: components, style: .medium, options: [])
2125
}
2226

2327
/// Returns the two Address Lines combined (if there are, effectively, two lines).

0 commit comments

Comments
 (0)