From 58f7a8654bcbceebf16a252ca0f6a6926b1244e1 Mon Sep 17 00:00:00 2001 From: Klaus Date: Tue, 23 Dec 2025 17:45:47 +0900 Subject: [PATCH] =?UTF-8?q?=EC=95=8C=EB=A6=BC/=EC=98=A4=EB=94=94=EC=85=98?= =?UTF-8?q?=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=EB=8B=A4=EA=B5=AD=EC=96=B4=20?= =?UTF-8?q?=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 알림/오디션 오류 응답 메시지를 키 기반 다국어로 분리 --- .../sodalive/alarm/AlarmController.kt | 4 +-- .../vividnext/sodalive/alarm/AlarmService.kt | 2 +- .../sodalive/audition/AuditionController.kt | 2 +- .../applicant/AuditionApplicantController.kt | 4 +-- .../applicant/AuditionApplicantService.kt | 4 +-- .../audition/role/AuditionRoleController.kt | 2 +- .../audition/role/AuditionRoleService.kt | 2 +- .../audition/vote/AuditionVoteController.kt | 2 +- .../audition/vote/AuditionVoteService.kt | 4 +-- .../sodalive/i18n/SodaMessageSource.kt | 36 +++++++++++++++++++ 10 files changed, 49 insertions(+), 13 deletions(-) diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/alarm/AlarmController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/alarm/AlarmController.kt index 2428b4f2..e5821569 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/alarm/AlarmController.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/alarm/AlarmController.kt @@ -17,7 +17,7 @@ class AlarmController(private val service: AlarmService) { fun getSlotQuantityAndPrice( @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? ) = run { - if (member == null) throw SodaException("로그인 정보를 확인해주세요.") + if (member == null) throw SodaException(messageKey = "common.error.bad_credentials") ApiResponse.ok( service.getSlotQuantityAndPrice(memberId = member.id!!) @@ -29,7 +29,7 @@ class AlarmController(private val service: AlarmService) { @PathVariable("container") container: String, @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? ) = run { - if (member == null) throw SodaException("로그인 정보를 확인해주세요.") + if (member == null) throw SodaException(messageKey = "common.error.bad_credentials") ApiResponse.ok( service.buyExtraSlot( diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/alarm/AlarmService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/alarm/AlarmService.kt index 9881eedc..67dbc60a 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/alarm/AlarmService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/alarm/AlarmService.kt @@ -53,7 +53,7 @@ class AlarmService( } else -> { - throw SodaException("이미 구매하셨습니다") + throw SodaException(messageKey = "alarm.error.already_purchased") } } diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/audition/AuditionController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/audition/AuditionController.kt index 527d4f17..f1579d74 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/audition/AuditionController.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/audition/AuditionController.kt @@ -32,7 +32,7 @@ class AuditionController(private val service: AuditionService) { @PathVariable id: Long, @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? ) = run { - if (member == null) throw SodaException("로그인 정보를 확인해주세요.") + if (member == null) throw SodaException(messageKey = "common.error.bad_credentials") ApiResponse.ok(service.getAuditionDetail(auditionId = id)) } diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/audition/applicant/AuditionApplicantController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/audition/applicant/AuditionApplicantController.kt index 9caeb2d9..af101659 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/audition/applicant/AuditionApplicantController.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/audition/applicant/AuditionApplicantController.kt @@ -23,7 +23,7 @@ class AuditionApplicantController(private val service: AuditionApplicantService) @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?, pageable: Pageable ) = run { - if (member == null) throw SodaException("로그인 정보를 확인해주세요.") + if (member == null) throw SodaException(messageKey = "common.error.bad_credentials") ApiResponse.ok( service.getAuditionApplicantList( @@ -42,7 +42,7 @@ class AuditionApplicantController(private val service: AuditionApplicantService) @RequestPart("request") requestString: String, @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? ) = run { - if (member == null) throw SodaException("로그인 정보를 확인해주세요.") + if (member == null) throw SodaException(messageKey = "common.error.bad_credentials") ApiResponse.ok( service.applyAuditionRole( diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/audition/applicant/AuditionApplicantService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/audition/applicant/AuditionApplicantService.kt index 92c410e5..d7a8e7de 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/audition/applicant/AuditionApplicantService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/audition/applicant/AuditionApplicantService.kt @@ -47,11 +47,11 @@ class AuditionApplicantService( @Transactional fun applyAuditionRole(contentFile: MultipartFile?, requestString: String, member: Member) { - if (contentFile == null) throw SodaException("녹음 파일을 확인해 주세요.") + if (contentFile == null) throw SodaException(messageKey = "audition.applicant.content_file_required") val request = objectMapper.readValue(requestString, ApplyAuditionRoleRequest::class.java) val auditionRole = roleRepository.findByIdOrNull(id = request.roleId) - ?: throw SodaException("잘못된 요청입니다.\n다시 시도해 주세요.") + ?: throw SodaException(messageKey = "audition.error.invalid_request_retry") val existingApplicant = repository.findActiveApplicantByMemberIdAndRoleId( memberId = member.id!!, diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/audition/role/AuditionRoleController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/audition/role/AuditionRoleController.kt index 5f7a48bb..03943982 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/audition/role/AuditionRoleController.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/audition/role/AuditionRoleController.kt @@ -17,7 +17,7 @@ class AuditionRoleController(private val service: AuditionRoleService) { @PathVariable id: Long, @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? ) = run { - if (member == null) throw SodaException("로그인 정보를 확인해주세요.") + if (member == null) throw SodaException(messageKey = "common.error.bad_credentials") ApiResponse.ok( service.getAuditionRoleDetail( diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/audition/role/AuditionRoleService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/audition/role/AuditionRoleService.kt index c1e05d3b..72d83b06 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/audition/role/AuditionRoleService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/audition/role/AuditionRoleService.kt @@ -11,7 +11,7 @@ class AuditionRoleService( ) { fun getAuditionRoleDetail(auditionRoleId: Long, memberId: Long): GetAuditionRoleDetailResponse { val roleDetailData = repository.getAuditionRoleDetail(auditionRoleId = auditionRoleId) - ?: throw SodaException("잘못된 요청입니다.\n다시 시도해 주세요.") + ?: throw SodaException(messageKey = "audition.error.invalid_request_retry") val isAlreadyApplicant = applicantRepository.isAlreadyApplicant( auditionRoleId = auditionRoleId, diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/audition/vote/AuditionVoteController.kt b/src/main/kotlin/kr/co/vividnext/sodalive/audition/vote/AuditionVoteController.kt index 434783be..a8a6cde3 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/audition/vote/AuditionVoteController.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/audition/vote/AuditionVoteController.kt @@ -19,7 +19,7 @@ class AuditionVoteController( @RequestBody request: VoteAuditionApplicantRequest, @AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member? ) = run { - if (member == null) throw SodaException("로그인 정보를 확인해주세요.") + if (member == null) throw SodaException(messageKey = "common.error.bad_credentials") ApiResponse.ok( service.voteAuditionApplicant( diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/audition/vote/AuditionVoteService.kt b/src/main/kotlin/kr/co/vividnext/sodalive/audition/vote/AuditionVoteService.kt index fa0ea928..cbe3150b 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/audition/vote/AuditionVoteService.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/audition/vote/AuditionVoteService.kt @@ -20,7 +20,7 @@ class AuditionVoteService( ) { fun voteAuditionApplicant(applicantId: Long, timezone: String, container: String, member: Member) { val applicant = applicantRepository.findByIdOrNull(applicantId) - ?: throw SodaException("잘못된 요청입니다.\n다시 시도해 주세요.") + ?: throw SodaException(messageKey = "audition.error.invalid_request_retry") val defaultZoneId = ZoneId.of("Asia/Seoul") val clientZoneId = try { @@ -43,7 +43,7 @@ class AuditionVoteService( ) if (voteCount > 100) { - throw SodaException("오늘 응원은 여기까지!\n하루 최대 100회까지 응원이 가능합니다.\n내일 다시 이용해주세요.") + throw SodaException(messageKey = "audition.vote.max_daily_reached") } if (voteCount > 0) { diff --git a/src/main/kotlin/kr/co/vividnext/sodalive/i18n/SodaMessageSource.kt b/src/main/kotlin/kr/co/vividnext/sodalive/i18n/SodaMessageSource.kt index acf9e416..04940ef5 100644 --- a/src/main/kotlin/kr/co/vividnext/sodalive/i18n/SodaMessageSource.kt +++ b/src/main/kotlin/kr/co/vividnext/sodalive/i18n/SodaMessageSource.kt @@ -42,6 +42,14 @@ class SodaMessageSource { ) ) + private val alarmMessages = mapOf( + "alarm.error.already_purchased" to mapOf( + Lang.KO to "이미 구매하셨습니다", + Lang.EN to "You have already purchased this", + Lang.JA to "すでに購入済みです" + ) + ) + private val auditionMessages = mapOf( "admin.audition.invalid_request_retry" to mapOf( Lang.KO to "잘못된 요청입니다.\n다시 시도해 주세요.", @@ -114,6 +122,30 @@ class SodaMessageSource { ) ) + private val auditionClientMessages = mapOf( + "audition.error.invalid_request_retry" to mapOf( + Lang.KO to "잘못된 요청입니다.\n다시 시도해 주세요.", + Lang.EN to "Invalid request.\nPlease try again.", + Lang.JA to "不正なリクエストです。\nもう一度お試しください。" + ) + ) + + private val auditionApplicantMessages = mapOf( + "audition.applicant.content_file_required" to mapOf( + Lang.KO to "녹음 파일을 확인해 주세요.", + Lang.EN to "Please check the recording file.", + Lang.JA to "録音ファイルを確認してください。" + ) + ) + + private val auditionVoteMessages = mapOf( + "audition.vote.max_daily_reached" to mapOf( + Lang.KO to "오늘 응원은 여기까지!\n하루 최대 100회까지 응원이 가능합니다.\n내일 다시 이용해주세요.", + Lang.EN to "That's all for today!\nYou can vote up to 100 times per day.\nPlease try again tomorrow.", + Lang.JA to "今日はここまでです!\n1日に最大100回まで応援できます。\n明日またご利用ください。" + ) + ) + private val settlementRatioMessages = mapOf( "admin.settlement_ratio.invalid_creator" to mapOf( Lang.KO to "잘못된 크리에이터 입니다.", @@ -1504,10 +1536,14 @@ class SodaMessageSource { fun getMessage(key: String, lang: Lang): String? { val messageGroups = listOf( commonMessages, + alarmMessages, auditionMessages, auditionRequestMessages, auditionNotificationMessages, auditionRoleMessages, + auditionClientMessages, + auditionApplicantMessages, + auditionVoteMessages, settlementRatioMessages, adminCanMessages, adminChatBannerMessages,