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
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"
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.
There is few solutions.It works for me.
adb shell am start -a android.settings.LOCALE_SETTINGS
(You could see the language menu, then choose language by appium)
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
using appium then set desired capabilities (language and locale) http://appium.io/docs/en/writing-running-appium/caps/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With