Material-components-android: Multiple language didn't work with dark mode in 1.1.0-alpha07

Created on 10 Jul 2019  路  16Comments  路  Source: material-components/material-components-android

Description: Multiple language App work fine. After adding the dark mode option to it and use

getDelegate().setLocalNightMode(
                        AppCompatDelegate.MODE_NIGHT_YES);

to change the theme to dark, strings.xml didn't load from values-uk folder and load from values folder.

Expected behavior:
In the dark mode, strings.xml should be load from the selected language.

Source code: https://github.com/bkhezry/LanguageTest

Android API version: 28

Material Library version: 1.1.0-alpha07

Appcompat version: 1.1.0-rc01

Device: Xiaomi Redmi Note 7

bug

All 16 comments

Hello! The setLocalNightMode() functionality is part of AppCompat as opposed to the Material library. You can file a bug here instead : http://issuetracker.google.com/issues/new?component=460343

Also, you might want to try using AppCompatDelegate#setDefaultNightMode instead, which will recreate the Activity for you.

@bkhezry did you find any solution. I am also facing the same issue

@chhota89 The solution will be release in appcompat 1.2.0-alpha01 soon

After long waiting appcompat 1.2.0-alpha01 is released but after setting

getDelegate().setLocalNightMode(
                        AppCompatDelegate.MODE_NIGHT_YES);

multi-language translation still not working. I have checked the release notes but I didn't found what exact change I have to do to make it work.

@chhota89 appcompat 1.2.0-alpha01 did NOT release yet.

@bkhezry Is there a SNAPSHOT version that we can try in the meantime? Do you know where I could find it if it exists? I've been checking here for the past few weeks https://mvnrepository.com/artifact/androidx.appcompat/appcompat

@Ireristible unfortunately no. We are waiting too for this release.

@bkhezry appCompat 1.2.0-SNAPSHOT exists! I found it here. https://ci.android.com/builds/submitted/5920449/androidx_snapshot/latest/repository/

@Ireristible did you try to add it to Gradle?

@bkhezry Yes and it seems to work! 馃槻Try it for yourself.

@Ireristible No. it NOT works.

@bkhezry Oh that's a shame it didn't work for you. If it helps, the app I tested this on had targetSdkVersion = 29.

This is still a problem on 1.2.0-alpha02 release

Don't know why someone closed this but this is still happening. any updates ?

Please see the comment from when this was closed:

Hello! The setLocalNightMode() functionality is part of AppCompat as opposed to the Material library. You can file a bug here instead : http://issuetracker.google.com/issues/new?component=460343

Also, you might want to try using AppCompatDelegate#setDefaultNightMode instead, which will recreate the Activity for you.

Hello for fix this error you must use this code :
delegate.localNightMode = AppCompatDelegate.MODE_NIGHT_YES;

Was this page helpful?
0 / 5 - 0 ratings

Related issues

magnusfernandes picture magnusfernandes  路  3Comments

TdevM picture TdevM  路  3Comments

jaychang0917 picture jaychang0917  路  3Comments

zkovar picture zkovar  路  3Comments

sepehr-alipour picture sepehr-alipour  路  3Comments