Live playstore app not translating my texts
Asked Answered
E

2

6

I made an application with 2 string files. 1. strings.xml inside values 2. strings.xml inside values-kn

The code to translate when my user selects kannada is as follows:

Locale locale = new Locale(language);
    Locale.setDefault(locale);
    Configuration config = new Configuration();
    config.locale = locale;
    getBaseContext()
            .getResources()
            .updateConfiguration(config, getBaseContext()
                    .getResources()
                    .getDisplayMetrics());

This code works fine when I make a debug build or a release build and run it on different android phones. But when I upload the app bundle to the play store it does not update my language in that build. I also added a translation in the play store for kn-in but still I am not being able to translate my texts in the app to kannada.

Can somebody please explain what I am doing wrong here or am I missing out on something? This problem has been eating my brains out.

Ecbolic answered 14/1, 2019 at 13:50 Comment(0)
E
14

Basically the problem with my build was, I was trying out the new release bundle feature and uploading it to the play store.

So If you are using the latest App Bundle tool when you're publishing then it removes localization files based on the user's phone settings when it's been installing.

I got this extremely useful tutorial which teaches you how to change the apps language on the fly and also on the comments section of it the answer to my problem lied.

To solve my problem all I had to do was:

Put this inside android tag in build.gradle file inside the app folder.

android {
//...
//... removed for brevity
     bundle {
        language {
           enableSplit = false
        }
    }
}

Hope it helps some one out there who might run into this problem. Cheers!

Ecbolic answered 24/1, 2019 at 11:5 Comment(0)
M
0

Based on the Google I/O 2018 Google Play will be responsible to download the selected language on the fly.

In the rare case, where a user switches to a new language that we weren't aware of before, Play will dynamically deliver relevant splits to their device. (https://youtu.be/0raqVydJmNE?t=13m9s)

Based on the accepted answer, we can set it false but it is not required in the real scenario. User can rarely change the language and app bundle help us to minimise the app size by splitting resources.

Marishamariska answered 7/12, 2021 at 13:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.