Search code examples
androidlocale

Android - Forcing application language with configuration.locale does not change app_name in launcher


I have the following code to force use of English as application language.

Configuration configuration =
    getApplicationContext().getResources().getConfiguration();

configuration.locale = Locale.ENGLISH;

getApplicationContext().getResources().updateConfiguration(
    configuration, getApplicationContext().getResources().getDisplayMetrics());

The problem is that it works inside activities, but the name in launcher and app_name on titlebar don't change, they stay with system locale.

How can I change those names too?


Solution

  • How can I change those names too?

    The user can go into Settings and change their locale.

    You, as a developer, can use updateConfiguration() to trick Android into using a different language's resources for your own process. You cannot affect other apps that way, and the home screen is another app.