Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Device language via ADB

I want to change language via ADB. I try:

adb shell setprop persist.sys.language fr;setprop persist.sys.country CA;stop;sleep 5;start

but I get errors:

setprop: command not found
stop: missing job name
Try `stop --help' for more information.
start: missing job name
Try `start --help' for more information.

what is wrong? I want to do this on physical device

like image 544
user3258796 Avatar asked Feb 11 '14 20:02

user3258796


3 Answers

Your errors have nothing to do with adb. You just lack understanding of how your local shell processes your command. What you are doing is running these commands locally (on your PC):

adb shell setprop persist.sys.language fr
setprop persist.sys.country CA
stop
sleep 5
start

and the error messages you see are from local shell (i.e. there is no setprop executable on your system and start and stop commands have non-optional parameters.

the correct command would be

adb shell "setprop persist.sys.language fr; setprop persist.sys.country CA; setprop ctl.restart zygote"

or in more recent Android versions:

adb shell "setprop persist.sys.locale fr-CA; setprop ctl.restart zygote"
like image 75
Alex P. Avatar answered Sep 20 '22 07:09

Alex P.


You can change the locale/language for testing purposes without rooting the device, also on newer (4.2+) devices. You have to create an application that changes the device locale. Or, you can use a helper app, e.g. ADB Change Language.

Next, on 4.2+ devices, you have to use grant the app CHANGE_CONFIGURATION permission via adb, adb shell pm grant <package_name> android.permission.CHANGE_CONFIGURATION.

Finally, you can use adb commands (launch activity) to switch locale.

like image 38
Juuso Ohtonen Avatar answered Sep 21 '22 07:09

Juuso Ohtonen


There is few solutions.It works for me.


1.

adb shell am start -a android.settings.LOCALE_SETTINGS (You could see the language menu, then choose language by appium)


2.

download adbchangelanguage on google store

adb shell pm grant net.sanapeli.adbchangelanguage android.permission.CHANGE_CONFIGURATION
adb shell am start -n net.sanapeli.adbchangelanguage/.AdbChangeLanguage -e language zh -e country TW

https://gist.github.com/douglasselph/b9998e69998759c6cceec1df1aa96ac5


3.

using appium then set desired capabilities (language and locale) http://appium.io/docs/en/writing-running-appium/caps/

like image 40
KNewman Liuu Avatar answered Sep 20 '22 07:09

KNewman Liuu