Change Device language via ADB

前端 未结 11 2360
温柔的废话
温柔的废话 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:39

    The solution to do it without rooting. You can use something like this the below function. The function goes into settings and exercises the UI to change the locale settings.

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

    The tricky part is to get to the right language when you are in a different language. You would think the language always maintain the same index in the list, but unfortunately not. So you have to have a solution like this.

    Con: You my have to tweak it a little for handling different phones, the settings may have a different order.

提交回复
热议问题