ChangeLocale Method (Device object)

Applies to TestComplete 15.20, last modified on January 19, 2022
The information below concerns legacy mobile tests that work with mobile devices connected to the local computer. For new mobile tests, we recommend using the newer cloud-compatible approach.

Description

Changes the current locale of the device.

Declaration

ProgObj.ChangeLocale(Language, Country)

ProgObj An expression, variable or parameter that specifies a reference to one of the objects listed in the Applies To section
Language [in]    Required    String    
Country [in]    Required    String    
Result None

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

Language

Specifies the language of the locale as defined by ISO 639-1.

Country

Specifies the country of the locale as defined by ISO 3166-1.

Result Value

None.

Example

The following example demonstrates how to use the ChangeLocale method:

JavaScript, JScript

function Test()
{
  // Specify the current device
  Mobile.SetCurrent("MyDevice");

  Mobile.Device().ChangeLocale("en", "GB");
  …

}

Python

def Test():
  # Specify the current device
  Mobile.SetCurrent("MyDevice")

  Mobile.Device().ChangeLocale("en", "GB")
  # ...

VBScript

Sub Test

  ' Specify the current device
  Call Mobile.SetCurrent("MyDevice")

  Call Mobile.Device.ChangeLocale("en", "GB")
  …

End Sub

DelphiScript

procedure Test;
begin
  // Specify the current device
  Mobile.SetCurrent('MyDevice');

  Mobile.Device.ChangeLocale('en', 'GB');
  …

end;

C++Script, C#Script

function Test()
{
  // Specify the current device
  Mobile["SetCurrent"]("MyDevice");

  Mobile["Device"]["ChangeLocale"]("en", "GB");
  …

}

See Also

AndroidDevice Object
Testing Mobile Applications
Working With Android Device Settings During Test Run (Legacy)

Highlight search results