캔 단위 표기 현지화
캔 관련 텍스트가 앱 언어에 맞게 변환된다.
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user