검색 화면 하드 코딩된 텍스트 다국어 전환

This commit is contained in:
Yu Sung
2026-01-23 05:27:26 +09:00
parent 9533b06d1e
commit 02d767d5d8
4 changed files with 45 additions and 17 deletions

View File

@@ -61,6 +61,34 @@ enum I18n {
ja: "2文字以上で入力してください" ja: "2文字以上で入力してください"
) )
} }
static var tabUnified: String {
pick(ko: "통합", en: "All", ja: "統合")
}
static var tabCreator: String {
pick(ko: "채널", en: "Channel", ja: "チャンネル")
}
static var tabContent: String {
pick(ko: "콘텐츠", en: "Content", ja: "コンテンツ")
}
static var tabSeries: String {
pick(ko: "시리즈", en: "Series", ja: "シリーズ")
}
static var noResults: String {
pick(
ko: "검색 결과가 없습니다.",
en: "No results found.",
ja: "検索結果がありません。"
)
}
static var more: String {
pick(ko: "더보기 >", en: "More >", ja: "もっと見る >")
}
} }
enum ContentDetail { enum ContentDetail {
static var creatorOtherContents: String { static var creatorOtherContents: String {

View File

@@ -23,7 +23,7 @@ struct SearchUnifiedView: View {
VStack(spacing: 30) { VStack(spacing: 30) {
if !creatorList.isEmpty { if !creatorList.isEmpty {
SearchUnifiedItemView( SearchUnifiedItemView(
title: "채널", title: I18n.Search.tabCreator,
itemList: creatorList, itemList: creatorList,
onTapMore: onTapMoreCreator onTapMore: onTapMoreCreator
) )
@@ -33,7 +33,7 @@ struct SearchUnifiedView: View {
if !contentList.isEmpty { if !contentList.isEmpty {
SearchUnifiedItemView( SearchUnifiedItemView(
title: "콘텐츠", title: I18n.Search.tabContent,
itemList: contentList, itemList: contentList,
onTapMore: onTapMoreContent onTapMore: onTapMoreContent
) )
@@ -43,7 +43,7 @@ struct SearchUnifiedView: View {
if !searchList.isEmpty { if !searchList.isEmpty {
SearchUnifiedItemView( SearchUnifiedItemView(
title: "시리즈", title: I18n.Search.tabSeries,
itemList: searchList, itemList: searchList,
onTapMore: onTapMoreSeries onTapMore: onTapMoreSeries
) )
@@ -81,7 +81,7 @@ struct SearchUnifiedItemView: View {
} }
} }
Text("더보기 >") Text(I18n.Search.more)
.appFont(size: 13.3, weight: .medium) .appFont(size: 13.3, weight: .medium)
.foregroundColor(.grayee) .foregroundColor(.grayee)
.padding(.vertical, 10) .padding(.vertical, 10)

View File

@@ -19,10 +19,10 @@ struct SearchView: View {
@State private var isFocused: Bool = false @State private var isFocused: Bool = false
let tabItemList = [ let tabItemList = [
SearchViewTabItem(title: "통합", tab: .UNIFIED), SearchViewTabItem(title: I18n.Search.tabUnified, tab: .UNIFIED),
SearchViewTabItem(title: "채널", tab: .CREATOR), SearchViewTabItem(title: I18n.Search.tabCreator, tab: .CREATOR),
SearchViewTabItem(title: "콘텐츠", tab: .CONTENT), SearchViewTabItem(title: I18n.Search.tabContent, tab: .CONTENT),
SearchViewTabItem(title: "시리즈", tab: .SERIES) SearchViewTabItem(title: I18n.Search.tabSeries, tab: .SERIES)
] ]
var body: some View { var body: some View {
@@ -126,7 +126,7 @@ struct SearchView: View {
viewModel.searchUnifiedContentList.isEmpty && viewModel.searchUnifiedContentList.isEmpty &&
viewModel.searchUnifiedSeriesList.isEmpty && viewModel.searchUnifiedSeriesList.isEmpty &&
viewModel.keyword.count > 2 { viewModel.keyword.count > 2 {
Text("검색 결과가 없습니다.") Text(I18n.Search.noResults)
.appFont(size: 18.3, weight: .medium) .appFont(size: 18.3, weight: .medium)
.foregroundColor(.white) .foregroundColor(.white)
.padding(.top, 20) .padding(.top, 20)

View File

@@ -120,14 +120,14 @@ final class SearchViewModel: ObservableObject {
if let message = decoded.message { if let message = decoded.message {
self.errorMessage = message self.errorMessage = message
} else { } else {
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." self.errorMessage = I18n.Common.commonError
} }
self.isShowPopup = true self.isShowPopup = true
} }
} catch { } catch {
DEBUG_LOG("error: \(error)") DEBUG_LOG("error: \(error)")
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." self.errorMessage = I18n.Common.commonError
self.isShowPopup = true self.isShowPopup = true
} }
} }
@@ -167,14 +167,14 @@ final class SearchViewModel: ObservableObject {
if let message = decoded.message { if let message = decoded.message {
self.errorMessage = message self.errorMessage = message
} else { } else {
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." self.errorMessage = I18n.Common.commonError
} }
self.isShowPopup = true self.isShowPopup = true
} }
} catch { } catch {
ERROR_LOG("test: \(error)") ERROR_LOG("test: \(error)")
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." self.errorMessage = I18n.Common.commonError
self.isShowPopup = true self.isShowPopup = true
} }
} }
@@ -214,14 +214,14 @@ final class SearchViewModel: ObservableObject {
if let message = decoded.message { if let message = decoded.message {
self.errorMessage = message self.errorMessage = message
} else { } else {
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." self.errorMessage = I18n.Common.commonError
} }
self.isShowPopup = true self.isShowPopup = true
} }
} catch { } catch {
ERROR_LOG("test: \(error)") ERROR_LOG("test: \(error)")
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." self.errorMessage = I18n.Common.commonError
self.isShowPopup = true self.isShowPopup = true
} }
} }
@@ -261,14 +261,14 @@ final class SearchViewModel: ObservableObject {
if let message = decoded.message { if let message = decoded.message {
self.errorMessage = message self.errorMessage = message
} else { } else {
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." self.errorMessage = I18n.Common.commonError
} }
self.isShowPopup = true self.isShowPopup = true
} }
} catch { } catch {
ERROR_LOG("test: \(error)") ERROR_LOG("test: \(error)")
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." self.errorMessage = I18n.Common.commonError
self.isShowPopup = true self.isShowPopup = true
} }
} }