Skip to content

Commit

Permalink
🌐 Add product count localization
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteHyun committed Jan 28, 2024
1 parent 5bdf21b commit 8e301d5
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 deletions.
2 changes: 1 addition & 1 deletion PyeonHaeng-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@
isa = PBXGroup;
children = (
BA28F1872B6155910052855E /* HomeView.swift */,
BAE159DD2B663A9A002DCF94 /* HomeProductSorterView.swift */,
BAE159D72B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift */,
BAE159DD2B663A9A002DCF94 /* HomeProductSorterView.swift */,
BAE159D92B65FC35002DCF94 /* HomeProductListView.swift */,
);
path = HomeScene;
Expand Down
47 changes: 47 additions & 0 deletions PyeonHaeng-iOS/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,53 @@
"strings" : {
"" : {

},
"총 %lld개의 상품이 있어요!" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "There is a total of %lld product!"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "There are a total of %lld product!"
}
}
}
}
},
"ja" : {
"variations" : {
"plural" : {
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "合計%lld個の商品があります!"
}
}
}
}
},
"ko" : {
"variations" : {
"plural" : {
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "총 %lld개의 상품이 있어요!"
}
}
}
}
}
}
}
},
"version" : "1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct HomeProductSorterView: View {

var body: some View {
HStack {
Text(attributedString)
Text(productCountString)
.font(.title2)
Spacer()
Button {} label: {
Expand All @@ -26,8 +26,8 @@ struct HomeProductSorterView: View {
.padding(.all, 8)
}

var attributedString: AttributedString {
var string = AttributedString("\(count)개의 상품이 있어요!")
var productCountString: AttributedString {
var string = AttributedString(localized: "\(count)개의 상품이 있어요!")

if let range = string.range(of: "\(count)") {
string[range].foregroundColor = .green500
Expand Down

0 comments on commit 8e301d5

Please sign in to comment.