Set localization options

To test a localized version of your app, you can configure language, locale, and timezone for your Appium tests.

Language

Set Appium’s language capability with an appropriate language code to test localized strings in your app.

Capability Description Values
language Set the language of the app under test. Example: ‘fr’
You can find appropriate language code

Example

DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("language", "fr");
var capabilities = {
	'language': 'fr'
}
DesiredCapabilities capability = new DesiredCapabilities();
capability.SetCapability("language", "fr");
$capabilities = new DesiredCapabilities();
$capabilities->setCapability("language", "fr");
desired_cap = {
	'language': 'fr
}
desired_caps = {
    'language': 'fr'
}

Retrieve your app’s localized strings

To retrieve your app’s localized strings for a particular language, use Appium’s app_strings command.

Map<String, String> appStrings = driver.getAppStringMap(
    "<language_code>"
);
let appStrings = driver.getStrings("<language_code>");
Dictionary<string, object> appStrings = driver.GetAppStringDictionary(
    "<language_code>"
);
$strings = $driver->appStrings("<language_code>");
appStrings = self.driver.app_strings(
    "<language_code>"
)
@driver.app_strings("<language_code>")

Locale

Set Appium’s locale capability with an appropriate country code to display or format data such as dates, time, decimal separators, and calendar according to the specified country’s regional conventions.

Capability Description Values
locale Set locale for iOS and Android. Android: ‘CA’ (country name abbreviation)
iOS: ‘fr_CA’
You can find appropriate region code

Example

DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("locale", "fr_CA");
var capabilities = {
	'locale': 'fr_CA'
}
DesiredCapabilities capability = new DesiredCapabilities();
capability.SetCapability("locale", "fr_CA");
$capabilities = new DesiredCapabilities();
$capabilities->setCapability("locale", "fr_CA");
desired_cap = {
	'locale': 'fr_CA'
}
desired_caps = {
    'locale': 'fr_CA'
}
Note:
  • language and locale change settings at a device level on Android and an app level on iOS
  • To ensure application under test uses localized strings and displays dates, times, and calendar in an appropriate format, pass both language and locale in desired capabilities

Timezone

You can set the device timezone in order to configure your tests to run on a custom timezone.

Capability Description Values
browserstack.timezone Configure tests to run on a custom time zone on Android devices. Example:
New_York (for America/New_York)
Los_Angeles (for America/Los_Angeles)
La_Rioja (for America/Argentina/La_Rioja)
You can view the complete list of timezones on wikipedia.

Example

DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("browserstack.timezone", "UTC");
var capabilities = {
	'browserstack.timezone': 'UTC'
}
DesiredCapabilities capability = new DesiredCapabilities();
capability.SetCapability("browserstack.timezone", "UTC");
$capabilities = new DesiredCapabilities();
$capabilities->setCapability("browserstack.timezone", "UTC");
desired_cap = {
	'browserstack.timezone': 'UTC'
}
desired_caps = {
    'browserstack.timezone': 'UTC'
}
Note:
  • The device timezone feature is not supported on iOS and Xiaomi, Huawei, Oppo, and Vivo devices on Android.
  • Timezone, language and locale features are only available with a BrowserStack Paid plan. You can check paid plans here.

We're sorry to hear that. Please share your feedback so we can do better







Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better







Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked






Thank you for your valuable feedback!

Talk to an Expert
Talk to an Expert