15

I am using google-play-service-lib. How can I change language of google map i.e. show locations in korian language or Hindi Language.

Jorgesys
  • 124,308
  • 23
  • 334
  • 268
Vibhor Bhardwaj
  • 3,071
  • 5
  • 28
  • 49
  • did you got solution for Hindi language? below given examples are working for "ko" but not for "hi". – Arth Tilva Apr 01 '17 at 06:06
  • @ArthTilva This was very old query so I have forgotten about Hindi support. – Vibhor Bhardwaj Apr 06 '17 at 03:19
  • For people asking about the Hindi (hi_IN) language, check answer in: https://stackoverflow.com/questions/48862517/how-can-i-change-google-maps-language-to-hindi-in-my-app/63918493#63918493 – betofarina Sep 16 '20 at 10:59

5 Answers5

13

You can change location for Google Maps that use the Google Map API V2 by using a Locale Object. The language needs to be supported on the device being used though.

Here is the full list of supported languages.

With this code below I was able to change the language on the map to Chinese:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String languageToLoad = "zh_CN";
    Locale locale = new Locale(languageToLoad);
    Locale.setDefault(locale);
    Configuration config = new Configuration();
    config.locale = locale;
    getBaseContext().getResources().updateConfiguration(config,
            getBaseContext().getResources().getDisplayMetrics());

    setContentView(R.layout.activity_maps);

    setUpMapIfNeeded();

}

Result, language set to Chinese in the code (no manual changes) on a U.S. based phone:

Chinese Map

I was also able to get it to show Korean, use this Locale code:

 String languageToLoad = "ko_KR";

Result:

Korean Map

NOTE

It looks like the supported languages for Google Maps are listed here: https://developers.google.com/maps/faq#languagesupport

Community
  • 1
  • 1
Daniel Nugent
  • 43,104
  • 15
  • 109
  • 137
  • 2
    This code is very close to what I had already. This makes all the rest of my app use the desired locale, but not the map. Maybe it's because I use the Support library's map: getSupportFragmentManager().findFragmentById(R.id.map) – Gavriel May 31 '15 at 19:10
  • 1
    Well, it seems it works partially! Locale.setDefault(locale); seems to be the key, however it is heavily cached, so when I change the locale in the app, then it doesn't change the locale of the map. – Gavriel May 31 '15 at 19:19
  • 1
    @Gavriel Interesting. One thing to note, be sure to call it before the call to `setContentView()`, or any other type of layout inflating. – Daniel Nugent May 31 '15 at 19:23
  • Hi, i'm not able to show google map in hindi language. i've updated play service and google map as well. any idea how can i get it done. – Vaishali Sharma Nov 13 '15 at 08:25
  • @VaishaliSharma Did you try the above solution using `hi_IN`? – Daniel Nugent Nov 13 '15 at 18:35
  • this doesn't change the map language until restart the app. is there any way to clear the cache ? – sarfarazsajjad Mar 01 '16 at 09:53
  • @RameshKumar Not sure exactly why it wouldn't work in some cases. It looks like Hindi is supported if you look at the list: https://developers.google.com/maps/faq#languagesupport Be sure that the device you're testing on also supports the language. – Daniel Nugent Feb 14 '17 at 18:08
  • yes, my device is supported hindi language.but not show map in hindi – Ramesh Bhati Feb 15 '17 at 07:25
  • 1
    @DanielNugent Apologies for piling on this really old thread, but I tried the solution you have provided in this answer while using the locale "ko_KR" and it works correctly. However changing the locale to "hi" or "hi_IN" does not work. There exists an issue in google's issue tracker [here](https://issuetracker.google.com/u/1/issues/36823099) to which I have added a comment. – Bluesir9 Feb 03 '18 at 06:21
3

We only need to change the location in the application to get the Map´s descriptions with different language. We have to add validations to avoid the use of deprecated methods:

 @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        String language= "hi"; //Hindi language!.
        Locale locale = new Locale(language);
        Locale.setDefault(locale);
        Configuration config = new Configuration();

        if(Build.VERSION.SDK_INT>Build.VERSION_CODES.JELLY_BEAN){
           config.setLocale(locale);
           getContext().createConfigurationContext(config);
        }else { //deprecated 
           config.locale = locale;
           getResources().updateConfiguration(config, getResources().getDisplayMetrics());
        }

...
...

...

Very important to say that all the languages are not supported, this is an example in Russian language:

introducir la descripción de la imagen aquí

We can get the code languages from:

https://www.transifex.com/explore/languages/

Jorgesys
  • 124,308
  • 23
  • 334
  • 268
1

Just change the locale on the device. If translations are available, they will be shown automatically.

A screenshot of my US phone with the locale switched to Korean:

Community
  • 1
  • 1
Kevin Krumwiede
  • 9,868
  • 4
  • 34
  • 82
  • 3
    Does this work? I tried changing the device's locale to Italian, Spanish, French, but Google Maps is always shown in English. – Giulio Piancastelli May 06 '14 at 13:58
  • Yes, I tested it before I answered. I changed the locale on my phone to Korean, and my own Maps test app mostly changed to Korean, even the names of minor streets in my city. I used this app to change locale: https://play.google.com/store/apps/details?id=com.bruce.setlocale – Kevin Krumwiede May 06 '14 at 15:43
  • 2
    Note: The app chooses its language when it starts. You may have to force stop the app and restart it to get it to change languages. – Kevin Krumwiede May 06 '14 at 16:03
  • @GiulioPiancastelli i am having the same experience as you. Did you find a solution? – rfsk2010 Jul 02 '14 at 12:50
  • @rfsk2010 I haven't tried the application suggested by Kevin. I would expect the map locale to change without using third party applications to help it. As things currently stand, I have yet to find a solution, sorry. – Giulio Piancastelli Jul 02 '14 at 19:44
  • The purpose of the third-party app I mentioned is to change the locale of the device, not the map specifically. Once the locale is changed, **all** apps that have resources for that locale should automatically start using them. (With the caveat that they must be restarted, which may mean force closing them.) – Kevin Krumwiede Jul 03 '14 at 04:25
  • Is there a way to change the map's language programmatically from my app (without changing the system locale)? – Gavriel Oct 07 '14 at 20:56
  • 1
    @Gavriel It's a little late! But I just posted an answer that changes the map language programmatically if you're still interested. – Daniel Nugent May 26 '15 at 07:18
1

hope this easy solution for changing map language helps someone:

simply add call setUpMapLocale() in your activity onCreate():

 private fun setUpMapLocale() {
        val languageToLoad = "iw_IL" // your desired language locale
        val locale = Locale(languageToLoad)
        Locale.setDefault(locale)
        baseContext.resources.configuration.setLocale(locale)
    }

so i just had to call setLocale() on the existing configuration attached to baseContext resources

Yarin Shitrit
  • 297
  • 4
  • 16
0

With new Google Map Render Support now you will get this, Need to follow a few steps,

  1. Update Google Map Dependency

    implementation 'com.google.android.gms:play-services-maps:18.1.0'

  2. Create New Class that Extends the Application, and initialize a new Map Renderer.

     class MyApplication : Application() {
            override fun onCreate() {
            super.onCreate()
            MapsInitializer.initialize(
                applicationContext,
                MapsInitializer.Renderer.LATEST,
                object : OnMapsSdkInitializedCallback {
                override fun onMapsSdkInitialized(p0: MapsInitializer.Renderer) {
                     Log.e("MapsInitializer", p0.name)
                 }
             })
     }
    

    }

  3. Register MyApplication class in Manifest.

<application
    android:name="com.extra.MyApplication"
    android:label="@string/app_name"
    android:screenOrientation="portrait"
    android:theme="@style/AppTheme">

enter image description here

Kintan Patel
  • 1,230
  • 8
  • 15