0

I have 2 string resources in my project. Hindi and English. And it changes dynamically in app itself. I want to launch my application in hindi although default language of device is English.

If I change default language in play console to hindi then dose application launch in hindi?

Or I have to write code for same?

Please suggest

Cool Trick
  • 11
  • 3

2 Answers2

0

It's really work... fa=Persian... en=English... enter your language code in languageToLoad :

import android.app.Activity;
import android.content.res.Configuration;
import android.os.Bundle;

public class Main extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String languageToLoad  = "fa"; // your language
    Locale locale = new Locale(languageToLoad); 
    Locale.setDefault(locale);
    Configuration config = new Configuration();
    config.locale = locale;
    getBaseContext().getResources().updateConfiguration(config, 
      getBaseContext().getResources().getDisplayMetrics());
    this.setContentView(R.layout.main);
  }
}
quangminhs
  • 151
  • 5
0

This isn't handled by the Play console, you have to write code in your app. Localization in the Play console is for your app listing in the Play Store.

Nick Fortescue
  • 13,530
  • 1
  • 31
  • 37