From 8e301d52b552b51901280ef0b0bafa0e8a54d585 Mon Sep 17 00:00:00 2001 From: SeungHyun Hong Date: Sun, 28 Jan 2024 17:28:32 +0900 Subject: [PATCH] :globe_with_meridians: Add product count localization --- PyeonHaeng-iOS.xcodeproj/project.pbxproj | 2 +- .../Resources/Localizable.xcstrings | 47 +++++++++++++++++++ .../HomeScene/HomeProductSorterView.swift | 6 +-- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/PyeonHaeng-iOS.xcodeproj/project.pbxproj b/PyeonHaeng-iOS.xcodeproj/project.pbxproj index 7185227..f85fbf0 100644 --- a/PyeonHaeng-iOS.xcodeproj/project.pbxproj +++ b/PyeonHaeng-iOS.xcodeproj/project.pbxproj @@ -181,8 +181,8 @@ isa = PBXGroup; children = ( BA28F1872B6155910052855E /* HomeView.swift */, - BAE159DD2B663A9A002DCF94 /* HomeProductSorterView.swift */, BAE159D72B65FA6F002DCF94 /* HomeProductDetailSelectionView.swift */, + BAE159DD2B663A9A002DCF94 /* HomeProductSorterView.swift */, BAE159D92B65FC35002DCF94 /* HomeProductListView.swift */, ); path = HomeScene; diff --git a/PyeonHaeng-iOS/Resources/Localizable.xcstrings b/PyeonHaeng-iOS/Resources/Localizable.xcstrings index 9d18f22..4de18a9 100644 --- a/PyeonHaeng-iOS/Resources/Localizable.xcstrings +++ b/PyeonHaeng-iOS/Resources/Localizable.xcstrings @@ -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" diff --git a/PyeonHaeng-iOS/Sources/Scenes/HomeScene/HomeProductSorterView.swift b/PyeonHaeng-iOS/Sources/Scenes/HomeScene/HomeProductSorterView.swift index fe8a724..fc1d575 100644 --- a/PyeonHaeng-iOS/Sources/Scenes/HomeScene/HomeProductSorterView.swift +++ b/PyeonHaeng-iOS/Sources/Scenes/HomeScene/HomeProductSorterView.swift @@ -16,7 +16,7 @@ struct HomeProductSorterView: View { var body: some View { HStack { - Text(attributedString) + Text(productCountString) .font(.title2) Spacer() Button {} label: { @@ -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