알림/오디션 메시지 다국어 분리
알림/오디션 오류 응답 메시지를 키 기반 다국어로 분리
This commit is contained in:
@@ -17,7 +17,7 @@ class AlarmController(private val service: AlarmService) {
|
|||||||
fun getSlotQuantityAndPrice(
|
fun getSlotQuantityAndPrice(
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||||
) = run {
|
) = run {
|
||||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
|
||||||
|
|
||||||
ApiResponse.ok(
|
ApiResponse.ok(
|
||||||
service.getSlotQuantityAndPrice(memberId = member.id!!)
|
service.getSlotQuantityAndPrice(memberId = member.id!!)
|
||||||
@@ -29,7 +29,7 @@ class AlarmController(private val service: AlarmService) {
|
|||||||
@PathVariable("container") container: String,
|
@PathVariable("container") container: String,
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||||
) = run {
|
) = run {
|
||||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
|
||||||
|
|
||||||
ApiResponse.ok(
|
ApiResponse.ok(
|
||||||
service.buyExtraSlot(
|
service.buyExtraSlot(
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ class AlarmService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
throw SodaException("이미 구매하셨습니다")
|
throw SodaException(messageKey = "alarm.error.already_purchased")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class AuditionController(private val service: AuditionService) {
|
|||||||
@PathVariable id: Long,
|
@PathVariable id: Long,
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||||
) = run {
|
) = run {
|
||||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
|
||||||
|
|
||||||
ApiResponse.ok(service.getAuditionDetail(auditionId = id))
|
ApiResponse.ok(service.getAuditionDetail(auditionId = id))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class AuditionApplicantController(private val service: AuditionApplicantService)
|
|||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?,
|
||||||
pageable: Pageable
|
pageable: Pageable
|
||||||
) = run {
|
) = run {
|
||||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
|
||||||
|
|
||||||
ApiResponse.ok(
|
ApiResponse.ok(
|
||||||
service.getAuditionApplicantList(
|
service.getAuditionApplicantList(
|
||||||
@@ -42,7 +42,7 @@ class AuditionApplicantController(private val service: AuditionApplicantService)
|
|||||||
@RequestPart("request") requestString: String,
|
@RequestPart("request") requestString: String,
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||||
) = run {
|
) = run {
|
||||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
|
||||||
|
|
||||||
ApiResponse.ok(
|
ApiResponse.ok(
|
||||||
service.applyAuditionRole(
|
service.applyAuditionRole(
|
||||||
|
|||||||
@@ -47,11 +47,11 @@ class AuditionApplicantService(
|
|||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
fun applyAuditionRole(contentFile: MultipartFile?, requestString: String, member: Member) {
|
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 request = objectMapper.readValue(requestString, ApplyAuditionRoleRequest::class.java)
|
||||||
|
|
||||||
val auditionRole = roleRepository.findByIdOrNull(id = request.roleId)
|
val auditionRole = roleRepository.findByIdOrNull(id = request.roleId)
|
||||||
?: throw SodaException("잘못된 요청입니다.\n다시 시도해 주세요.")
|
?: throw SodaException(messageKey = "audition.error.invalid_request_retry")
|
||||||
|
|
||||||
val existingApplicant = repository.findActiveApplicantByMemberIdAndRoleId(
|
val existingApplicant = repository.findActiveApplicantByMemberIdAndRoleId(
|
||||||
memberId = member.id!!,
|
memberId = member.id!!,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class AuditionRoleController(private val service: AuditionRoleService) {
|
|||||||
@PathVariable id: Long,
|
@PathVariable id: Long,
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||||
) = run {
|
) = run {
|
||||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
|
||||||
|
|
||||||
ApiResponse.ok(
|
ApiResponse.ok(
|
||||||
service.getAuditionRoleDetail(
|
service.getAuditionRoleDetail(
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class AuditionRoleService(
|
|||||||
) {
|
) {
|
||||||
fun getAuditionRoleDetail(auditionRoleId: Long, memberId: Long): GetAuditionRoleDetailResponse {
|
fun getAuditionRoleDetail(auditionRoleId: Long, memberId: Long): GetAuditionRoleDetailResponse {
|
||||||
val roleDetailData = repository.getAuditionRoleDetail(auditionRoleId = auditionRoleId)
|
val roleDetailData = repository.getAuditionRoleDetail(auditionRoleId = auditionRoleId)
|
||||||
?: throw SodaException("잘못된 요청입니다.\n다시 시도해 주세요.")
|
?: throw SodaException(messageKey = "audition.error.invalid_request_retry")
|
||||||
|
|
||||||
val isAlreadyApplicant = applicantRepository.isAlreadyApplicant(
|
val isAlreadyApplicant = applicantRepository.isAlreadyApplicant(
|
||||||
auditionRoleId = auditionRoleId,
|
auditionRoleId = auditionRoleId,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class AuditionVoteController(
|
|||||||
@RequestBody request: VoteAuditionApplicantRequest,
|
@RequestBody request: VoteAuditionApplicantRequest,
|
||||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||||
) = run {
|
) = run {
|
||||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
if (member == null) throw SodaException(messageKey = "common.error.bad_credentials")
|
||||||
|
|
||||||
ApiResponse.ok(
|
ApiResponse.ok(
|
||||||
service.voteAuditionApplicant(
|
service.voteAuditionApplicant(
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class AuditionVoteService(
|
|||||||
) {
|
) {
|
||||||
fun voteAuditionApplicant(applicantId: Long, timezone: String, container: String, member: Member) {
|
fun voteAuditionApplicant(applicantId: Long, timezone: String, container: String, member: Member) {
|
||||||
val applicant = applicantRepository.findByIdOrNull(applicantId)
|
val applicant = applicantRepository.findByIdOrNull(applicantId)
|
||||||
?: throw SodaException("잘못된 요청입니다.\n다시 시도해 주세요.")
|
?: throw SodaException(messageKey = "audition.error.invalid_request_retry")
|
||||||
|
|
||||||
val defaultZoneId = ZoneId.of("Asia/Seoul")
|
val defaultZoneId = ZoneId.of("Asia/Seoul")
|
||||||
val clientZoneId = try {
|
val clientZoneId = try {
|
||||||
@@ -43,7 +43,7 @@ class AuditionVoteService(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if (voteCount > 100) {
|
if (voteCount > 100) {
|
||||||
throw SodaException("오늘 응원은 여기까지!\n하루 최대 100회까지 응원이 가능합니다.\n내일 다시 이용해주세요.")
|
throw SodaException(messageKey = "audition.vote.max_daily_reached")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (voteCount > 0) {
|
if (voteCount > 0) {
|
||||||
|
|||||||
@@ -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(
|
private val auditionMessages = mapOf(
|
||||||
"admin.audition.invalid_request_retry" to mapOf(
|
"admin.audition.invalid_request_retry" to mapOf(
|
||||||
Lang.KO to "잘못된 요청입니다.\n다시 시도해 주세요.",
|
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(
|
private val settlementRatioMessages = mapOf(
|
||||||
"admin.settlement_ratio.invalid_creator" to mapOf(
|
"admin.settlement_ratio.invalid_creator" to mapOf(
|
||||||
Lang.KO to "잘못된 크리에이터 입니다.",
|
Lang.KO to "잘못된 크리에이터 입니다.",
|
||||||
@@ -1504,10 +1536,14 @@ class SodaMessageSource {
|
|||||||
fun getMessage(key: String, lang: Lang): String? {
|
fun getMessage(key: String, lang: Lang): String? {
|
||||||
val messageGroups = listOf(
|
val messageGroups = listOf(
|
||||||
commonMessages,
|
commonMessages,
|
||||||
|
alarmMessages,
|
||||||
auditionMessages,
|
auditionMessages,
|
||||||
auditionRequestMessages,
|
auditionRequestMessages,
|
||||||
auditionNotificationMessages,
|
auditionNotificationMessages,
|
||||||
auditionRoleMessages,
|
auditionRoleMessages,
|
||||||
|
auditionClientMessages,
|
||||||
|
auditionApplicantMessages,
|
||||||
|
auditionVoteMessages,
|
||||||
settlementRatioMessages,
|
settlementRatioMessages,
|
||||||
adminCanMessages,
|
adminCanMessages,
|
||||||
adminChatBannerMessages,
|
adminChatBannerMessages,
|
||||||
|
|||||||
Reference in New Issue
Block a user