Is your feature request related to a problem? Please describe.
Currently, LocaleHelper.getAppLocale reads the user's preferred language from KiwixDataStore using runBlocking { kiwixDataStore.prefLanguage.first() }.
Because getAppLocale and getLocalizedString can be called from synchronous contexts on Dispatchers.Main (such as UI component rendering and ViewModel helpers), using runBlocking on the main thread can block the UI thread and potentially cause UI stutters or ANRs.
Describe the solution you'd like
Refactor LocaleHelper and its call sites to fetch the preferred language asynchronously using Kotlin Coroutines (suspend functions or a dedicated background dispatcher) instead of blocking the main thread with runBlocking.
Additional context
Originally noted in PR #4705 review comment by @MohitMaliFtechiz.
Is your feature request related to a problem? Please describe.
Currently,
LocaleHelper.getAppLocalereads the user's preferred language fromKiwixDataStoreusingrunBlocking { kiwixDataStore.prefLanguage.first() }.Because
getAppLocaleandgetLocalizedStringcan be called from synchronous contexts onDispatchers.Main(such as UI component rendering and ViewModel helpers), usingrunBlockingon the main thread can block the UI thread and potentially cause UI stutters or ANRs.Describe the solution you'd like
Refactor
LocaleHelperand its call sites to fetch the preferred language asynchronously using Kotlin Coroutines (suspendfunctions or a dedicated background dispatcher) instead of blocking the main thread withrunBlocking.Additional context
Originally noted in PR #4705 review comment by @MohitMaliFtechiz.