diff --git a/SodaLive/Sources/MyPage/Can/Charge/CanChargeView.swift b/SodaLive/Sources/MyPage/Can/Charge/CanChargeView.swift index 41a5b2e..515e9d7 100644 --- a/SodaLive/Sources/MyPage/Can/Charge/CanChargeView.swift +++ b/SodaLive/Sources/MyPage/Can/Charge/CanChargeView.swift @@ -94,7 +94,7 @@ struct CanItemView: View { var body: some View { HStack(spacing: 0) { - Text(item.localizedTitle) + Text(localizeCanWord(in: item.localizedTitle)) .font(.custom(Font.bold.rawValue, size: 15.3)) .foregroundColor(Color(hex: "eeeeee")) @@ -118,7 +118,7 @@ struct CanPgItemView: View { var body: some View { HStack(spacing: 0) { - Text(item.title) + Text(localizeCanWord(in: item.title)) .font(.custom(Font.bold.rawValue, size: 15.3)) .foregroundColor(Color(hex: "eeeeee")) @@ -137,6 +137,20 @@ struct CanPgItemView: View { } } +// MARK: - Localize "캔" unit inside arbitrary text based on current app language +fileprivate func localizeCanWord(in text: String) -> String { + let unit: String + switch LanguageHeaderProvider.current { + case "ko": + unit = "캔" + case "ja": + unit = "缶" + default: + unit = "cans" + } + return text.replacingOccurrences(of: "캔", with: unit) +} + struct CanChargeTabView: View { @Binding var currentTab: CanChargeCurrentTab