https://kotlinlang.org logo
Title
n

Napa Ram

02/01/2022, 12:33 PM
Hey Guys, i am facing issue while changing language from English to Arabic and vice-versa. the issue is screen is blinking and after changing a language as i am selecting a language from dropdown
f

Filip Wiesner

02/01/2022, 12:35 PM
It's because everything needs to recompose. By changing the language you are changing the layout direction from LTR to RTL.
And
LocalLayoutDirection
is
staticCompositionLocalOf
so the whole UI tree needs to recompose even if nothing changed.
n

Napa Ram

02/01/2022, 12:58 PM
Is there any better way to hide blinking screen it's looking too odd
f

Filip Wiesner

02/01/2022, 1:00 PM
Hmmm, maybe some loading non-Compose dialog? 🤔 I am not sure, sorry
g

GeorgeS-Litesoft

02/01/2022, 2:31 PM
The key is that you must not apply the language change until after the specific language is selected in such a way that the user can't easily select another (e.g. the drop down is closed).
Of note: on one project I did we supported 8 languages (3 of which were asian which normally are not L2R-T2B, but which have begun accepting a limited form of L2R-T2B), all were implemented with L2R-T2B! Arabic was not supported. IMO, the solution is to put labels above the fields, and not try to do label-field L2R or R2L!