Labels are displayed in English when dark mode is turn on in android multi-language application in kotlin

Viewed 190

I have created a multi-language android application in kotlin.

My whole app works perfectly with all language change option.

I have implemented the Dark mode features in my app and it's work perfectly when I turn on dark mode my whole app theme set as a dark mode and when I turn off dark mode my whole app theme set as light mode, but when my application language is Gujarati at that time I have turned the dark mode and my whole app language is Gujarati and whole data return for only Gujarati language and also when I detect what is the current language of my application at that time I got the 'gu' that is perfect but my whole application labels are changing into the English language and when I turned off dark mode whole app labels are set as it is in Gujarati language, so that's the issue that I have tried so many solutions but I didn't find any perfect solution about this issue.

I don't know why my app labels are changed when I change the dark mode is on?

Help me with this issue if anyone can know about the solution.

Code for dark mode on

AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
            delegate.applyDayNight()

Code for dark mode off

AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
            delegate.applyDayNight()

Implement the following code in the onCreate method inside the Application class

AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.getDefaultNightMode())
0 Answers
Related