Detect system Language setting list in android device

HI,

I have sped some time on searching my doubt but not found.
I want to select one language from given selected language list.
So please let me know it is possible?

Thanks in advance.

Hi @bhalodia.bhavdip,

You could try opening the Android Settings app during your test and navigating to the language settings to change the currently selected language:

import com.kms.katalon.core.configuration.RunConfiguration
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile

// You will need a real .apk file here in order to launch successfully, even if you're not testing it
String appFile = "/fullpathtomyfile/mobile-beta.apk"

// The app info for the built-in app you really want to test
RunConfiguration.setMobileDriverPreferencesProperty("appPackage", 'com.android.settings')
RunConfiguration.setMobileDriverPreferencesProperty("appActivity", 'com.android.settings.Settings')

// Start the application, but it will actually use the appPackage from above
Mobile.startApplication(appFile, false)

// Insert your code here to navigate through the settings and choose the language you want

// When we're finished with the settings application
Mobile.closeApplication()

// Set the desired capabilities for the application you actually want to test
RunConfiguration.setMobileDriverPreferencesProperty("appPackage", 'com.mypackage')
RunConfiguration.setMobileDriverPreferencesProperty("appActivity", 'com.mypackage.myapplication.Login')

// Start your application to be tested
Mobile.startApplication(appFile, false)

Hope this helps,

Chris

Hi @Chris_Trevarthen
Do you know another way like java language

I try this, but it returns computer’s language

String aaa = Locale.getDefault().getDisplayLanguage()

println(aaa)

Do you know how to use it in groovy?

I find this
Android ADB commands to get the device properties Ask

Then I do this command

adb shell getprop ro.product.locale.language

also could get the system language, but only get the original setting,its not what i want

I get this command ,could show the user’s language

adb shell getprop user.language
adb shell getprop user.region

To see details , use this command

adb shell getprop