---
title: How to do localisation testing for mobile apps
description: Find out how to perform localisation testing with mobile apps. Change
  your language or locale with Appium, XCUITest and Espresso.
source_url:
  html: https://testingbot.com/resources/articles/localized-testing-mobile-app
  md: https://testingbot.com/resources/articles/localized-testing-mobile-app.md
---

![How to do localisation testing for mobile apps](https://testingbot.com/assets/resources/articles/12.webp)

# Language and locale automated testing on mobile apps

Find out how to perform localisation testing with mobile apps. Change your language or locale with Appium, XCUITest and Espresso.

By [Jochen D.](https://testingbot.com/about/jochen-d)2021-11-10

 Share on Facebook 

 Share on Twitter 

 Post on Reddit 

 Share link 

Localization testing allows you to test your native mobile app on iOS and Android devices with various language and localization settings.   
 It is important to make sure that your mobile app works correctly on devices with other languages and locales, both functionally and in terms of design.

Some languages might use longer sentences than English, which might break your UI.   
 For example, you have a sentence in your app that fits perfectly inside the UI for English, but the translation in Portuguese is too long, causing the sentence to go beyond the allowed size.   
 Another example is where your app displays a number, currency, or date in a different format due to other locale settings. Setting various locale settings during your tests will allow you to test all these scenarios.

In this article we'll focus on how to perform language and locale testing, with both Appium, XCUItest (iOS) and Espresso (Android).

## Table of Contents

- [What is the difference between language and locale?](https://testingbot.com#difference)
- [How to change the language in an Appium test?](https://testingbot.com#language)
- [How to change the locale in an Appium test?](https://testingbot.com#locale)
- [How to set a different language or locale with XCUITest?](https://testingbot.com#xcuitest)
- [How to change the language or locale with Espresso?](https://testingbot.com#espresso)

## What is the difference between language and locale?

The terms locale and language are often used in the same context, but they have different meanings.

The term language indicates the language on the device. It is the language used in the UI of the device's OS and can often be changed in the Settings menu of your OS.   
 Examples of a language are: English, French, Portugese, Dutch, Spanish, Chinese and more. iOS supports more than 30 languages, while Android supports a larger amount of languages.

Locale refers to regional settings, for a specific country or place. This includes settings such as currency format, number format, or date formats.   
 Countries can share the same language, but have different locale settings.

To get a list of available locales on Android, you can use this snippet of code:

```java
for (Locale locale : Locale.getAvailableLocales()) {
	Log.d("LOCALES", locale.getLanguage() + "_" + locale.getCountry() + " [" + locale.getDisplayName() + "]");
}
```

## How to change the language in an Appium test?

Appium provides a `language` capability, which you can use to pass in the desired language code (ISO 639-1) of the app under test.

When you compile your `IPA` or `APK` file, you can indicate which languages you want to support and provide the translated content.   
 For Android, translated content usually appears in [strings.xml](https://developer.android.com/studio/write/translations-editor) files, while on iOS you can use [XCode's localization features](https://developer.apple.com/documentation/xcode/localization).

```java
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("language", "es");
```

To fetch a all translated strings for a specific language, you can use the `app_strings` command:

```javascript
let appStrings = driver.getStrings("<language_code>");
```

## How to change the locale in an Appium test?

To change the locale, you can use Appium's `locale` capability, which accepts [region codes](https://www.iban.com/country-codes).

By changing the locale, you can test regional settings, such as currency formats, date formats, time and calendar formats.   
 All these settings are country/region specific and can be tested with Appium's `locale` capability.

```java
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("locale", "fr_CA");
```

> Changing the language or locale will change the settings on a device level for Android, and on an app-level for iOS.

## How to set a different language or locale with XCUITest?

XCUITest offers two arguments which you can use to set the language or locale:

- `-AppleLanguages`
- `-AppleLocale`

To use this in XCUITest, you can pass in a language or locale of your choosing like this:

```swift
XCUIApplication().launchArguments += [“-AppleLanguages”, “(fr)”]
XCUIApplication().launchArguments += [“-AppleLocale”, “fr_FR”]
XCUIApplication().launch()
```

In the example above, we set the language to French and the locale to France/French.   
 XCUITest will open the app with these settings. If your app has localized strings for this language, your app should display in the correct language.

Apple provides some more information about setting up and testing localized apps in their [Testing your International App documentation](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPInternational/TestingYourInternationalApp/TestingYourInternationalApp.html#//apple_ref/doc/uid/10000171i-CH7-SW2).

## How to change the language or locale with Espresso?

During an Espresso test, you can programmaticaly switch the language or locale of the app.   
 Please see the example below on how to achieve this:

```java
private void setLocale(String language, String country) {
    Locale locale = new Locale(language, country);
    // here we update locale for date formatters
    Locale.setDefault(locale);
    // here we update locale for app resources
    Resources res = getContext().getResources();
    Configuration config = res.getConfiguration();
    config.locale = locale;
    res.updateConfiguration(config, res.getDisplayMetrics());
}
```

This function accepts a language and country, it will update the locale and resources during the Espresso test.

## Sidebar

### TestingBot Cloud Testing

Run automated, manual and visual tests on remote browsers and devices. Sign up for a free trial.

[Free Trial](https://testingbot.com/users/sign_up)

### Latest articles

[![Automated Testing with Puppeteer](https://testingbot.com/assets/resources/articles/11-416015eb394d928299663409dccd67993b0a664f4b3ff456803fefc6bf1f325a.webp)](https://testingbot.com/resources/articles/automated-testing-with-puppeteer)

#### [Automated Testing with Puppeteer](https://testingbot.com/resources/articles/automated-testing-with-puppeteer)

Puppeteer combined with a test framework provides a great...

[Read article →](https://testingbot.com/resources/articles/automated-testing-with-puppeteer)

[![Tutorial on debugging Cypress tests](https://testingbot.com/assets/resources/articles/10-7ae9f6d9435bea1c54ec815ad535dc4a590086e6165263a9eba3441635d55726.webp)](https://testingbot.com/resources/articles/how-to-debug-cypress-tests)

#### [Tutorial on debugging Cypress tests](https://testingbot.com/resources/articles/how-to-debug-cypress-tests)

This article will focus on how to debug your Cypress test...

[Read article →](https://testingbot.com/resources/articles/how-to-debug-cypress-tests)

[![Working with cookies - Selenium WebDriver](https://testingbot.com/assets/resources/articles/9-5a522a91a2140dbb74c2c0b484c669aed90159647c66f1ab98cb1b11579fea6e.webp)](https://testingbot.com/resources/articles/handling-cookies-with-selenium)

#### [Working with cookies - Selenium WebDriver](https://testingbot.com/resources/articles/handling-cookies-with-selenium)

Handling cookies with Selenium WebDriver is a common task...

[Read article →](https://testingbot.com/resources/articles/handling-cookies-with-selenium)

## Other Articles

[![Automated Testing with Puppeteer](https://testingbot.com/assets/resources/articles/11-416015eb394d928299663409dccd67993b0a664f4b3ff456803fefc6bf1f325a.webp)](https://testingbot.com/resources/articles/automated-testing-with-puppeteer "Automated Testing with Puppeteer")

### [Automated Testing with Puppeteer](https://testingbot.com/resources/articles/automated-testing-with-puppeteer)

Puppeteer combined with a test framework provides a great way to run automated browser tests. Follow this guide for more information.

[Read article →](https://testingbot.com/resources/articles/automated-testing-with-puppeteer)

[![Tutorial on debugging Cypress tests](https://testingbot.com/assets/resources/articles/10-7ae9f6d9435bea1c54ec815ad535dc4a590086e6165263a9eba3441635d55726.webp)](https://testingbot.com/resources/articles/how-to-debug-cypress-tests "Tutorial on debugging Cypress tests")

### [Tutorial on debugging Cypress tests](https://testingbot.com/resources/articles/how-to-debug-cypress-tests)

This article will focus on how to debug your Cypress tests with Cypress debugger and other developer tools.

[Read article →](https://testingbot.com/resources/articles/how-to-debug-cypress-tests)

[![Working with cookies - Selenium WebDriver](https://testingbot.com/assets/resources/articles/9-5a522a91a2140dbb74c2c0b484c669aed90159647c66f1ab98cb1b11579fea6e.webp)](https://testingbot.com/resources/articles/handling-cookies-with-selenium "Working with cookies - Selenium WebDriver")

### [Working with cookies - Selenium WebDriver](https://testingbot.com/resources/articles/handling-cookies-with-selenium)

Handling cookies with Selenium WebDriver is a common task, since most websites use cookies. In this guide, we'll show you how to do this with Selenium.

[Read article →](https://testingbot.com/resources/articles/handling-cookies-with-selenium)

[![How to use the Actions Class In Selenium](https://testingbot.com/assets/resources/articles/8-f84768dacc47dbc268338db641c2c210f5da0b9d258f4ea8592d298b015473bf.webp)](https://testingbot.com/resources/articles/what-are-selenium-actions "How to use the Actions Class In Selenium")

### [How to use the Actions Class In Selenium](https://testingbot.com/resources/articles/what-are-selenium-actions)

Selenium WebDriver comes with an Action Class, which allows you to simulate user input events, such as mouse and keyboard actions.

[Read article →](https://testingbot.com/resources/articles/what-are-selenium-actions)

## Ready to start testing?
[Start a free trial](https://testingbot.com/users/sign_up)
