Change device language via ADB

I want to change the language through ADB. I'm trying to:

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's wrong? I want to do this on a physical device

+10
source share
10 answers

Your errors have nothing to do with adb . You just do not have enough understanding of how your local shell processes your command. You execute 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 from the local shell (i.e., your system does not have the setprop , and the start and stop commands have optional parameters.

the right team will be

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

or in later versions of Android:

 adb shell "setprop persist.sys.locale fr-CA; setprop ctl.restart zygote" 
+25
source

You can change the language / language for testing without rooting the device, including on newer (4. 2+) devices. You must create an application that changes the language of the device . Or you can use an auxiliary application, for example, ADB Change Language .

Next, on 4. 2+ devices, you must use the CHANGE_CONFIGURATION permission application through adb, adb shell pm grant <package_name> android.permission.CHANGE_CONFIGURATION .

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

+14
source

try it

 adb shell "su -c 'setprop persist.sys.language fr; setprop persist.sys.country CA; stop; sleep 5; start' 

You need an embedded device.

+2
source

It's everywhere just saying

setprop will only work on an AVD or root physical device

An alternative is to use the settings in Launcher.

A rooted device or AVD this works:

 <android-sdk path>/platform-tools/adb shell root@generic :/ # getprop persist.sys.language getprop persist.sys.language en root@generic :/ # setprop persist.sys.language fr setprop persist.sys.language fr root@generic :/ # setprop persist.sys.country CA setprop persist.sys.country CA root@generic :/ # stop stop root@generic :/ # start start root@generic :/ # sleep 5 sleep 5 root@generic :/ # getprop |grep lang getprop |grep lang [persist.sys.language]: [fr] root@generic :/ # getprop |grep country getprop |grep country [persist.sys.country]: [CA] root@generic :/ # 
+2
source

Follow these steps:

  • Create a google Intel x86 API emulator
  • Run the emulator by running the command:

     adb root 
  • Run the following shell command via adb :

     adb -e shell "su root; setprop persist.sys.locale pt-PT; stop; sleep 2; start" 

    then exit the shell that restarts the emulator.

  • We need the locales for the screenshots:

     de_DE en_EN fr_FR ko_KO pt_PT es_ES ja_JA 
+1
source

For Android M or later, you need to use:

 setprop ro.product.locale xx-XX setprop persist.sys.locale xx-XX 

xx - language, XX - country

0
source

The decision to do this without root. You can use something like this function below. The function is included in the settings and uses the user interface to change the locale settings.

https://github.com/dtmilano/AndroidViewClient/blob/480ab93dbd01296a68c1ce7109ceb8275d1ed8a7/src/com/dtmilano/android/viewclient.py#L1302

The difficulty is getting to the right language when you are in another language. You might think that the language always supports the same index on the list, but unfortunately not. So you should have a solution like this.

Con : You need to tweak it a bit to work with different phones, the settings may have a different order.

0
source

On the emulator: when changing the language manually, it stopped working and had to erase the emulator data in the AVD manager so that it would work again.

And the script used:

 adb shell "su 0 setprop persist.sys.locale ja";adb shell "su 0 setprop ctl.restart zygote" 

May add , sleep 20 at the end, if some of the commands in the script below this command depend on the availability of the device.

0
source

There are several solutions. This works for me.


1.

Shell adb am start -a android.settings.LOCALE_SETTINGS (You can see the language menu, then select the language by appium)


2.

download adbchangelanguage in 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 the desired features (language and locale) http://appium.io/docs/en/writing-running-appium/caps/

0
source

You cannot do this with adb on your device. Your adb is out of the device, I mean on your computer connected to usb, it can change it with the transfer of permission before changing the language.

Your device directly requires a root device.

-5
source

All Articles