Skip to main content

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
Note:
  • 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