오디션 메시지 다국어 처리
This commit is contained in:
@@ -4,7 +4,7 @@ import org.springframework.stereotype.Component
|
||||
|
||||
@Component
|
||||
class SodaMessageSource {
|
||||
private val messages = mapOf(
|
||||
private val commonMessages = mapOf(
|
||||
"common.error.unknown" to mapOf(
|
||||
Lang.KO to "알 수 없는 오류가 발생했습니다. 다시 시도해 주세요.",
|
||||
Lang.EN to "An unknown error occurred. Please try again.",
|
||||
@@ -42,8 +42,56 @@ class SodaMessageSource {
|
||||
)
|
||||
)
|
||||
|
||||
private val auditionMessages = mapOf(
|
||||
"admin.audition.invalid_request_retry" to mapOf(
|
||||
Lang.KO to "잘못된 요청입니다.\n다시 시도해 주세요.",
|
||||
Lang.EN to "Invalid request. Please try again.",
|
||||
Lang.JA to "不正なリクエストです。もう一度やり直してください。"
|
||||
),
|
||||
"admin.audition.status_cannot_revert" to mapOf(
|
||||
Lang.KO to "모집전 상태로 변경할 수 없습니다.",
|
||||
Lang.EN to "Cannot change to not-started status.",
|
||||
Lang.JA to "募集前の状態に変更できません。"
|
||||
)
|
||||
)
|
||||
|
||||
private val auditionRequestMessages = mapOf(
|
||||
"admin.audition.title_required" to mapOf(
|
||||
Lang.KO to "오디션 제목을 입력하세요",
|
||||
Lang.EN to "Please enter an audition title.",
|
||||
Lang.JA to "オーディションのタイトルを入力してください。"
|
||||
),
|
||||
"admin.audition.information_min_length" to mapOf(
|
||||
Lang.KO to "오디션 정보는 최소 10글자 입니다",
|
||||
Lang.EN to "Audition information must be at least 10 characters.",
|
||||
Lang.JA to "オーディション情報は最低10文字です。"
|
||||
)
|
||||
)
|
||||
|
||||
private val auditionNotificationMessages = mapOf(
|
||||
"admin.audition.fcm.title.new" to mapOf(
|
||||
Lang.KO to "새로운 오디션 등록!",
|
||||
Lang.EN to "New audition posted!",
|
||||
Lang.JA to "新しいオーディション登録!"
|
||||
),
|
||||
"admin.audition.fcm.message.new" to mapOf(
|
||||
Lang.KO to "'%s'이 등록되었습니다. 지금 바로 오리지널 오디오 드라마 오디션에 지원해보세요!",
|
||||
Lang.EN to "'%s' is now available. Apply for the original audio drama audition now!",
|
||||
Lang.JA to "「%s」が登録されました。今すぐオリジナルオーディオドラマのオーディションに応募してみてください!"
|
||||
)
|
||||
)
|
||||
|
||||
fun getMessage(key: String, lang: Lang): String? {
|
||||
val translations = messages[key] ?: return null
|
||||
return translations[lang] ?: translations[Lang.KO]
|
||||
val messageGroups = listOf(
|
||||
commonMessages,
|
||||
auditionMessages,
|
||||
auditionRequestMessages,
|
||||
auditionNotificationMessages
|
||||
)
|
||||
for (messages in messageGroups) {
|
||||
val translations = messages[key] ?: continue
|
||||
return translations[lang] ?: translations[Lang.KO]
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user