Android : How to change language of device using commandLine

How to change language of device using commandLine


Changing language in Android device on-the fly is needed when we are running or executing automation script in various languages.

To achieve language change of Android device, we have two ways:


You can watch a Youtube video OR follow the step by step procedure below





1> Using adb command 
 Below command can be run from command line , to change the language of device.
   
adb shell "setprop persist.sys.language fr; setprop persist.sys.country CA; 
setprop ctl.restart zygote"

** But this procedure is having one issue, your phone should be ROOTED to make adb command into effect.  

2> Using ADB Change Language APP installed on your device (link)

Steps: 
-
Install this APP on to your device.
-
Setup adb connection to your device (How to do - follow Link )
-
Android OS 4.2 onwards (tip: you can copy the command here and paste it to your command console):
adb shell pm grant net.sanapeli.adbchangelanguage android.permission.CHANGE_CONFIGURATION
- Language change example 1, Brazilian Portuguese:
adb shell am start -n net.sanapeli.adbchangelanguage/.AdbChangeLanguage -e language pt-rBR
- Language change example 2, Canadien French:
adb shell am start -n net.sanapeli.adbchangelanguage/.AdbChangeLanguage -e language fr -e country CA

To make your work easy , create a .bat file

@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@           Create .bat file                  @@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@

You can put the change language command in .bat file and can trigger it from your code.
Create a .bat file lets say : "changelang.bat" and paste below 3 line and save it.

cd /D 
adb shell am start -n net.sanapeli.adbchangelanguage/.AdbChangeLanguage -e language %1

exit




That's it.

2 comments:

  1. hi i followed the above steps trying to change the interface language to Korean but im get the following error. can you help?

    Bad argument: java.lang.IllegalArgumentException: Unknown package: net.sanapelli.adbchangelanguage

    ReplyDelete
    Replies
    1. Hi Anu ,
      Hope this is solved as of now, if it still persist ,can you please explain me what you have done.
      Thanks!!

      Delete

Android : How to connect your Android device over Wifi using ADB command for App debugging

How to connect your Android device over Wi-Fi using ADB command Sometimes it requires to connect your Android dev...