캔 단위 표기 현지화

캔 관련 텍스트가 앱 언어에 맞게 변환된다.
This commit is contained in:
Yu Sung
2025-12-20 00:15:57 +09:00
parent 6a7497af7d
commit 7c1d57676c

View File

@@ -94,7 +94,7 @@ struct CanItemView: View {
var body: some View { var body: some View {
HStack(spacing: 0) { HStack(spacing: 0) {
Text(item.localizedTitle) Text(localizeCanWord(in: item.localizedTitle))
.font(.custom(Font.bold.rawValue, size: 15.3)) .font(.custom(Font.bold.rawValue, size: 15.3))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color(hex: "eeeeee"))
@@ -118,7 +118,7 @@ struct CanPgItemView: View {
var body: some View { var body: some View {
HStack(spacing: 0) { HStack(spacing: 0) {
Text(item.title) Text(localizeCanWord(in: item.title))
.font(.custom(Font.bold.rawValue, size: 15.3)) .font(.custom(Font.bold.rawValue, size: 15.3))
.foregroundColor(Color(hex: "eeeeee")) .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 { struct CanChargeTabView: View {
@Binding var currentTab: CanChargeCurrentTab @Binding var currentTab: CanChargeCurrentTab