Change Device language via ADB

前端 未结 11 2342
温柔的废话
温柔的废话 2020-11-28 12:16

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

相关标签:
11条回答
  • 2020-11-28 12:51

    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/

    0 讨论(0)
  • 2020-11-28 12:54

    Try this

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

    You need a rooted device.

    0 讨论(0)
  • 2020-11-28 13:01

    You cant do that with the adb on your device. Your adb outside the device, I mean on your computer connected with usb, can change it with passing a permission before changing the language.

    On your device directly, you need a rooted device.

    0 讨论(0)
  • 2020-11-28 13:02

    On Emulator: When changed language manually, it stopped working and had to do wipe data of Emulator in AVD manager to make it 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 in the end if some commands in script below this command depend on device to be ready.

    0 讨论(0)
  • 2020-11-28 13:04

    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.

    0 讨论(0)
提交回复
热议问题