feat(chat): 채팅 모듈 하드코딩 문구를 I18n 키로 통일한다

This commit is contained in:
Yu Sung
2026-03-31 16:30:48 +09:00
parent 222520d5e9
commit 47085dc1ca
27 changed files with 464 additions and 128 deletions

View File

@@ -51,7 +51,11 @@ struct ChatRoomView: View {
.lineLimit(1)
.truncationMode(.tail)
Text(viewModel.characterType.rawValue)
Text(
viewModel.characterType == .Clone
? I18n.Chat.Character.typeClone
: I18n.Chat.Character.typeCharacter
)
.appFont(size: 10, weight: .bold)
.foregroundColor(.white)
.padding(.horizontal, 4)
@@ -100,8 +104,8 @@ struct ChatRoomView: View {
Text(
viewModel.characterType == .Character
? "보이스온 AI캐릭터톡은 대화의 자유도가 높아 대화에 참여하는 당신은 누구든 될 수 있습니다.\n세계관 속 캐릭터로 대화를 하거나 새로운 인물로 캐릭터와 당신만의 스토리를 만들어보세요.\n※ AI캐릭터톡은 오픈베타 서비스 중이며, 캐릭터의 대화가 어색하거나 불완전할 수 있습니다."
: "AI Clone은 크리에이터의 정보를 기반으로 대화하지만, 모든 정보를 완벽하게 반영하거나 실제 대화와 일치하지 않을 수 있습니다."
? I18n.Chat.Room.noticeForCharacter
: I18n.Chat.Room.noticeForClone
)
.appFont(size: 12, weight: .regular)
.foregroundColor(.white)
@@ -186,7 +190,7 @@ struct ChatRoomView: View {
HStack(spacing: 0) {
ZStack(alignment: .leading) {
if viewModel.messageText.isEmpty {
Text("메시지를 입력하세요.")
Text(I18n.Chat.Room.messagePlaceholder)
.appFont(size: 14, weight: .regular)
.foregroundColor(Color(hex: "78909C"))
}
@@ -289,7 +293,7 @@ struct ChatRoomView: View {
ActivityIndicatorView()
.frame(width: 100, height: 100)
Text("대화 초기화 중...")
Text(I18n.Chat.Room.resettingMessage)
}
}
.frame(maxWidth: .infinity, maxHeight: .infinity)

View File

@@ -19,7 +19,7 @@ final class ChatRoomViewModel: ObservableObject {
@Published var chatRoomBgImageId: Int = 0
@Published private(set) var characterId: Int64 = 0
@Published private(set) var characterProfileUrl: String = ""
@Published private(set) var characterName: String = "Character Name"
@Published private(set) var characterName: String = I18n.Chat.Room.defaultCharacterName
@Published private(set) var characterType: CharacterType = .Character
@Published private(set) var chatRoomBgImageUrl: String? = nil
@Published private(set) var roomId: Int = 0 {
@@ -113,7 +113,7 @@ final class ChatRoomViewModel: ObservableObject {
DEBUG_LOG("finish")
case .failure(let error):
self.showSendingMessage = false //
self.errorMessage = error.localizedDescription
self.errorMessage = I18n.Common.commonError
self.isShowPopup = true
ERROR_LOG(error.localizedDescription)
}
@@ -127,14 +127,13 @@ final class ChatRoomViewModel: ObservableObject {
self.messages.append(contentsOf: data.messages)
self.updateQuota(nextRechargeAtEpoch: data.nextRechargeAtEpoch)
} else {
self.errorMessage = decoded.message ??
"다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self.errorMessage = decoded.message ?? I18n.Common.commonError
self.isShowPopup = true
}
self.showSendingMessage = false //
} catch {
self.showSendingMessage = false
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self.errorMessage = I18n.Common.commonError
self.isShowPopup = true
}
}
@@ -183,7 +182,7 @@ final class ChatRoomViewModel: ObservableObject {
if let message = decoded.message {
self?.errorMessage = message
} else {
self?.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self?.errorMessage = I18n.Common.commonError
}
self?.isShowPopup = true
@@ -192,7 +191,7 @@ final class ChatRoomViewModel: ObservableObject {
self?.isLoading = false
} catch {
self?.isLoading = false
self?.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self?.errorMessage = I18n.Common.commonError
self?.isShowPopup = true
}
}
@@ -260,7 +259,7 @@ final class ChatRoomViewModel: ObservableObject {
if let message = decoded.message {
self?.errorMessage = message
} else {
self?.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self?.errorMessage = I18n.Common.commonError
}
self?.isShowPopup = true
@@ -269,7 +268,7 @@ final class ChatRoomViewModel: ObservableObject {
self?.isLoading = false
} catch {
self?.isLoading = false
self?.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self?.errorMessage = I18n.Common.commonError
self?.isShowPopup = true
}
}
@@ -304,7 +303,7 @@ final class ChatRoomViewModel: ObservableObject {
if let message = decoded.message {
self?.errorMessage = message
} else {
self?.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self?.errorMessage = I18n.Common.commonError
}
self?.isShowPopup = true
@@ -313,7 +312,7 @@ final class ChatRoomViewModel: ObservableObject {
self?.isLoading = false
} catch {
self?.isLoading = false
self?.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self?.errorMessage = I18n.Common.commonError
self?.isShowPopup = true
}
}
@@ -348,14 +347,14 @@ final class ChatRoomViewModel: ObservableObject {
if let message = decoded.message {
self?.errorMessage = message
} else {
self?.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self?.errorMessage = I18n.Common.commonError
}
self?.isShowPopup = true
}
} catch {
ERROR_LOG(String(describing: error))
self?.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self?.errorMessage = I18n.Common.commonError
self?.isShowPopup = true
}
}
@@ -381,7 +380,7 @@ final class ChatRoomViewModel: ObservableObject {
private func resetData() {
characterProfileUrl = ""
characterName = "Character Name"
characterName = I18n.Chat.Room.defaultCharacterName
characterType = .Character
chatRoomBgImageUrl = nil
roomId = 0
@@ -427,7 +426,7 @@ final class ChatRoomViewModel: ObservableObject {
if let message = decoded.message {
self?.errorMessage = message
} else {
self?.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self?.errorMessage = I18n.Common.commonError
}
self?.isShowPopup = true
@@ -436,7 +435,7 @@ final class ChatRoomViewModel: ObservableObject {
self?.isLoading = false
} catch {
self?.isLoading = false
self?.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self?.errorMessage = I18n.Common.commonError
self?.isShowPopup = true
}
}

View File

@@ -130,7 +130,7 @@ struct AiMessageItemView: View {
.foregroundColor(.button)
}
Text("눌러서 잠금해제")
Text(I18n.Chat.Room.unlockImagePrompt)
.appFont(size: 18, weight: .bold)
.foregroundColor(.white)
}

View File

@@ -59,7 +59,7 @@ struct TypingIndicatorItemView: View {
}
}
}
.accessibilityLabel(Text("입력 중"))
.accessibilityLabel(Text(I18n.Chat.Room.typingAccessibilityLabel))
}
.padding(.horizontal, 10)
.padding(.vertical, 8)

View File

@@ -23,7 +23,7 @@ struct ChatQuotaNoticeItemView: View {
.appFont(size: 18, weight: .bold)
.foregroundColor(.white)
Text("기다리면 무료 이용이 가능합니다.")
Text(I18n.Chat.Room.quotaWaitForFreeNotice)
.appFont(size: 18, weight: .bold)
.foregroundColor(.white)
}
@@ -39,7 +39,7 @@ struct ChatQuotaNoticeItemView: View {
.appFont(size: 24, weight: .bold)
.foregroundColor(Color(hex: "263238"))
Text("(채팅 12개) 바로 대화 시작")
Text(I18n.Chat.Room.quotaPurchaseAction(chatCount: 12))
.appFont(size: 24, weight: .bold)
.foregroundColor(Color(hex: "263238"))
.padding(.leading, 4)

View File

@@ -26,7 +26,7 @@ struct ChatBgSelectionView: View {
var body: some View {
BaseView(isLoading: $viewModel.isLoading) {
VStack(spacing: 0) {
DetailNavigationBar(title: String(localized: "배경 이미지 선택")) {
DetailNavigationBar(title: I18n.Chat.Room.backgroundSelectionTitle) {
isShowing = false
}
//
@@ -79,7 +79,7 @@ struct ChatBgSelectionView: View {
}
if selectedBgImageId == item.id {
Text("현재 배경")
Text(I18n.Chat.Room.currentBackground)
.appFont(size: 12, weight: .regular)
.foregroundColor(.white)
.padding(.horizontal, 6)

View File

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

View File

@@ -17,7 +17,7 @@ struct ChatSettingsView: View {
var body: some View {
VStack(spacing: 0) {
DetailNavigationBar(title: String(localized: "대화 설정")) {
DetailNavigationBar(title: I18n.Chat.Room.settingsTitle) {
isShowing = false
}
@@ -25,7 +25,7 @@ struct ChatSettingsView: View {
VStack(spacing: 0) {
VStack(spacing: 0) {
Toggle(isOn: $isHideBg) {
Text("배경 이미지 끄기")
Text(I18n.Chat.Room.hideBackgroundImage)
.appFont(size: 18, weight: .bold)
.foregroundColor(Color(hex: "B0BEC5"))
}
@@ -42,7 +42,7 @@ struct ChatSettingsView: View {
VStack(spacing: 0) {
HStack {
Text("배경 이미지 변경")
Text(I18n.Chat.Room.changeBackgroundImage)
.appFont(size: 18, weight: .bold)
.foregroundColor(Color(hex: "B0BEC5"))
.padding(.horizontal, 24)
@@ -61,16 +61,16 @@ struct ChatSettingsView: View {
HStack(spacing: 0) {
VStack(alignment: .leading, spacing: 6) {
Text("대화 초기화")
Text(I18n.Chat.Room.resetConversationTitle)
.appFont(size: 18, weight: .bold)
.foregroundColor(Color(hex: "B0BEC5"))
HStack(alignment: .top, spacing: 0) {
Text("⚠️ ")
Text(I18n.Chat.Room.resetWarningPrefix)
.appFont(size: 16, weight: .regular)
.foregroundColor(.white.opacity(0.7))
Text("지금까지의 대화가 모두 초기화 되고, 이용자가 새로운 캐릭터가 되어 새롭게 대화를 시작합니다.")
Text(I18n.Chat.Room.resetWarningDescription)
.appFont(size: 16, weight: .regular)
.foregroundColor(.white.opacity(0.7))
.fixedSize(horizontal: false, vertical: true)

View File

@@ -14,7 +14,7 @@ struct TalkView: View {
var body: some View {
BaseView(isLoading: $viewModel.isLoading) {
if viewModel.talkRooms.isEmpty {
Text("대화 중인 톡이 없습니다")
Text(I18n.Chat.Talk.emptyMessage)
.appFont(size: 20, weight: .regular)
.foregroundColor(.white)
} else {

View File

@@ -61,7 +61,7 @@ final class TalkViewModel: ObservableObject {
if case let .failure(error) = completion {
ERROR_LOG(error.localizedDescription)
DispatchQueue.main.async {
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self.errorMessage = I18n.Common.commonError
self.isShowPopup = true
}
} else {
@@ -90,16 +90,15 @@ final class TalkViewModel: ObservableObject {
if let message = decoded.message {
self.errorMessage = message
} else {
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self.errorMessage = I18n.Common.commonError
}
self.isShowPopup = true
}
} catch {
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self.errorMessage = I18n.Common.commonError
self.isShowPopup = true
}
}
.store(in: &subscription)
}
}