diff --git a/SodaLive/Sources/I18n/I18n.swift b/SodaLive/Sources/I18n/I18n.swift index 4f715c7..63dbcda 100644 --- a/SodaLive/Sources/I18n/I18n.swift +++ b/SodaLive/Sources/I18n/I18n.swift @@ -467,6 +467,63 @@ enum I18n { static var buy: String { pick(ko: "소장하기", en: "Buy", ja: "購入する") } static var purchase: String { pick(ko: "구매하기", en: "Purchase", ja: "購入する") } } + + // 마이페이지 > 프로필 수정 내 소셜 링크 섹션 + enum ProfileUpdate { + // 라벨 + static var instagram: String { pick(ko: "인스타그램", en: "Instagram", ja: "インスタグラム") } + static var youtube: String { pick(ko: "유튜브", en: "YouTube", ja: "YouTube") } + static var website: String { pick(ko: "웹사이트", en: "Website", ja: "ウェブサイト") } + static var blog: String { pick(ko: "블로그", en: "Blog", ja: "ブログ") } + + // 플레이스홀더 + static var instagramUrlPlaceholder: String { + pick(ko: "인스타그램 URL", en: "Instagram URL", ja: "インスタグラムURL") + } + static var youtubeUrlPlaceholder: String { + pick(ko: "유튜브 URL", en: "YouTube URL", ja: "YouTubeのURL") + } + static var websiteUrlPlaceholder: String { + pick(ko: "웹사이트 URL", en: "Website URL", ja: "ウェブサイトのURL") + } + static var blogUrlPlaceholder: String { + pick(ko: "블로그 URL", en: "Blog URL", ja: "ブログのURL") + } + + // 소개글 입력 플레이스홀더 + static var introductionPlaceholder: String { + pick(ko: "소개글을 입력하세요", en: "Enter your introduction", ja: "自己紹介を入力してください") + } + + // 프로필/비밀번호 업데이트 관련 토스트/검증 메시지 + static var profileUpdated: String { + pick(ko: "프로필이 변경되었습니다.", en: "Profile has been updated.", ja: "プロフィールが更新されました。") + } + + static var passwordCurrentRequired: String { + pick(ko: "현재 비밀번호를 입력하세요.", en: "Please enter your current password.", ja: "現在のパスワードを入力してください。") + } + static var passwordNewRequired: String { + pick(ko: "변경할 비밀번호를 입력하세요.", en: "Please enter a new password.", ja: "新しいパスワードを入力してください。") + } + static var passwordNotMatch: String { + pick(ko: "비밀번호가 일치하지 않습니다.", en: "Passwords do not match.", ja: "パスワードが一致しません。") + } + static var passwordRuleHint: String { + pick(ko: "영문, 숫자 포함 8자 이상의 비밀번호를 입력해 주세요.", en: "Enter a password of at least 8 characters with letters and numbers.", ja: "英字と数字を含む8文字以上のパスワードを入力してください。") + } + static var passwordUpdated: String { + pick(ko: "비밀번호가 변경되었습니다.", en: "Password has been changed.", ja: "パスワードが変更されました。") + } + + static var profileImageUpdateFailed: String { + pick( + ko: "프로필 이미지를 업데이트 하지 못했습니다.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다.", + en: "Could not update the profile image.\nIf the problem persists, please contact customer support.", + ja: "プロフィール画像を更新できませんでした。\n問題が続く場合はカスタマーサポートにお問い合わせください。" + ) + } + } } // MARK: - 내부 헬퍼 diff --git a/SodaLive/Sources/MyPage/Profile/ProfileUpdateView.swift b/SodaLive/Sources/MyPage/Profile/ProfileUpdateView.swift index 2de0dcb..3a06bbb 100644 --- a/SodaLive/Sources/MyPage/Profile/ProfileUpdateView.swift +++ b/SodaLive/Sources/MyPage/Profile/ProfileUpdateView.swift @@ -171,29 +171,29 @@ struct ProfileUpdateView: View { func InstagramAndYoutubeAccountView() -> some View { VStack(spacing: 16.7) { UserTextField( - title: "인스타그램", - hint: "인스타그램 URL", + title: I18n.ProfileUpdate.instagram, + hint: I18n.ProfileUpdate.instagramUrlPlaceholder, isSecure: false, variable: $viewModel.instagramUrl ) UserTextField( - title: "유튜브", - hint: "유튜브 URL", + title: I18n.ProfileUpdate.youtube, + hint: I18n.ProfileUpdate.youtubeUrlPlaceholder, isSecure: false, variable: $viewModel.youtubeUrl ) UserTextField( - title: "웹사이트", - hint: "웹사이트 URL", + title: I18n.ProfileUpdate.website, + hint: I18n.ProfileUpdate.websiteUrlPlaceholder, isSecure: false, variable: $viewModel.websiteUrl ) UserTextField( - title: "블로그", - hint: "블로그 URL", + title: I18n.ProfileUpdate.blog, + hint: I18n.ProfileUpdate.blogUrlPlaceholder, isSecure: false, variable: $viewModel.blogUrl ) diff --git a/SodaLive/Sources/MyPage/Profile/ProfileUpdateViewModel.swift b/SodaLive/Sources/MyPage/Profile/ProfileUpdateViewModel.swift index 5f667d1..a4fdc00 100644 --- a/SodaLive/Sources/MyPage/Profile/ProfileUpdateViewModel.swift +++ b/SodaLive/Sources/MyPage/Profile/ProfileUpdateViewModel.swift @@ -48,7 +48,7 @@ final class ProfileUpdateViewModel: ObservableObject { var refresh: () -> Void = {} - let placeholder = "소개글을 입력하세요" + let placeholder = I18n.ProfileUpdate.introductionPlaceholder func getMyProfile() { isLoading = true @@ -86,13 +86,13 @@ final class ProfileUpdateViewModel: 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 } } @@ -142,7 +142,7 @@ final class ProfileUpdateViewModel: ObservableObject { if let _ = decoded.data, decoded.success { self.refresh() - self.errorMessage = "프로필이 변경되었습니다." + self.errorMessage = I18n.ProfileUpdate.profileUpdated self.isShowPopup = true DispatchQueue.main.asyncAfter(deadline: .now() + 1) { @@ -152,13 +152,13 @@ final class ProfileUpdateViewModel: 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 } } @@ -171,25 +171,25 @@ final class ProfileUpdateViewModel: ObservableObject { func updatePassword() { if currentPassword.trimmingCharacters(in: .whitespaces).isEmpty { - errorMessage = "현재 비밀번호를 입력하세요." + errorMessage = I18n.ProfileUpdate.passwordCurrentRequired isShowPopup = true return } if newPassword.trimmingCharacters(in: .whitespaces).isEmpty { - errorMessage = "변경할 비밀번호를 입력하세요." + errorMessage = I18n.ProfileUpdate.passwordNewRequired isShowPopup = true return } if newPassword != newPasswordConfirm { - errorMessage = "비밀번호가 일치하지 않습니다." + errorMessage = I18n.ProfileUpdate.passwordNotMatch isShowPopup = true return } if !validatePassword() { - errorMessage = "영문, 숫자 포함 8자 이상의 비밀번호를 입력해 주세요." + errorMessage = I18n.ProfileUpdate.passwordRuleHint isShowPopup = true return } @@ -218,7 +218,7 @@ final class ProfileUpdateViewModel: ObservableObject { let decoded = try jsonDecoder.decode(ApiResponse.self, from: responseData) if let _ = decoded.data, decoded.success { - self.errorMessage = "비밀번호가 변경되었습니다." + self.errorMessage = I18n.ProfileUpdate.passwordUpdated self.isShowPopup = true self.currentPassword = "" self.newPassword = "" @@ -231,13 +231,13 @@ final class ProfileUpdateViewModel: 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 } } @@ -303,19 +303,19 @@ final class ProfileUpdateViewModel: 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) } else { - self.errorMessage = "프로필 이미지를 업데이트 하지 못했습니다.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다." + self.errorMessage = I18n.ProfileUpdate.profileImageUpdateFailed self.isShowPopup = true self.isLoading = false }