다국어 설정 시 날짜 포맷이 섞이는 버그 수정

앱 내 설정 언어와 디바이스 언어가 다를 때 날짜 포맷에 여러 언어가
섞여서 표시되는 문제를 해결하기 위해 앱 설정 언어를 명시적으로
적용하도록 수정. 래핑된 컨텍스트를 사용하여 리소스를 가져오고
날짜 변환 시에도 해당 로케일을 전달하도록 개선.
This commit is contained in:
2026-01-21 16:52:39 +09:00
parent 5adfecf689
commit b1075eee16
10 changed files with 96 additions and 42 deletions

View File

@@ -59,6 +59,8 @@ import kr.co.vividnext.sodalive.mypage.auth.BootpayResponse
import kr.co.vividnext.sodalive.mypage.can.charge.CanChargeActivity
import kr.co.vividnext.sodalive.search.SearchActivity
import kr.co.vividnext.sodalive.settings.event.EventDetailActivity
import kr.co.vividnext.sodalive.settings.language.LanguageManager
import kr.co.vividnext.sodalive.settings.language.LocaleHelper
import kr.co.vividnext.sodalive.settings.notification.MemberRole
import kr.co.vividnext.sodalive.splash.SplashActivity
import org.koin.android.ext.android.inject
@@ -1255,12 +1257,15 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::infl
}, 300)
}
} else {
val locale = Locale(LanguageManager.getEffectiveLanguage(requireContext()))
val wrappedContext = LocaleHelper.wrap(requireContext())
val beginDateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH)
beginDateFormat.timeZone = TimeZone.getTimeZone("UTC")
val beginDate = beginDateFormat.parse(it.beginDateTimeUtc)!!
val now = Date()
val dateFormat = SimpleDateFormat("yyyy-MM-dd, HH:mm", Locale.getDefault())
val dateFormat = SimpleDateFormat("yyyy-MM-dd, HH:mm", locale)
val diffTime: Long = now.time - beginDate.time
val hours = (diffTime / (1000 * 60 * 60)).toInt()
val mins = (diffTime / (1000 * 60)).toInt() % 60
@@ -1284,7 +1289,7 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::infl
LivePaymentDialog(
activity = requireActivity(),
layoutInflater = layoutInflater,
title = getString(R.string.live_paid_title),
title = wrappedContext.getString(R.string.live_paid_title),
startDateTime = if (hours >= 1) {
dateFormat.format(beginDate)
} else {
@@ -1295,19 +1300,19 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::infl
} else {
null
},
desc = getString(R.string.live_paid_desc, it.price),
desc = wrappedContext.getString(R.string.live_paid_desc, it.price),
desc2 = if (hours >= 1) {
getString(R.string.live_paid_warning, hours, mins)
wrappedContext.getString(R.string.live_paid_warning, hours, mins)
} else {
null
},
confirmButtonTitle = getString(R.string.live_paid_confirm),
confirmButtonTitle = wrappedContext.getString(R.string.live_paid_confirm),
confirmButtonClick = {
handler.postDelayed({
liveViewModel.enterRoom(roomId, onEnterRoomSuccess)
}, 300)
},
cancelButtonTitle = getString(R.string.cancel),
cancelButtonTitle = wrappedContext.getString(R.string.cancel),
cancelButtonClick = {}
).show(screenWidth)
}