---
# System prepended metadata

title: Internationalization (i18n) Testing
tags: [English]

---

---
tags: English
---
# Internationalization (i18n) Testing
This document introduces how to use SideeX to record test cases once for one language, and then playback for the other languages automatically.

## Step 1: Setup WebDriver
I18n testing can only be done through WebDriver. The first step is to setup WebDriver.

- If you are using SideeX Recorder for i18n testing, refer to [Playback through WebDriver for Cross-Browser Testing](/@sideex/book/%2F%40sideex%2Fwebdriver).
- If you are using SideeX Runner for i18n testing, refer to [SideeX Runner](/@sideex/book/%2F%40sideex%2Frunner).

:::warning
Note that, currently only **Chrome** and **Firefox** are supported for i18n testing. Please **DO NOT** enable other unsupported browsers.
:::

## Step 2: Prepare Language JSON Files
The language files are in JSON format. If your language files are not of JSON format, please convert them into JSON format first. The JSON format is as follows:
```json
{
  "ima": {
    "ge": "画像"
  },
  "user": ["佐藤", "鈴木", "高橋", "田中", "渡邊"]
}
```
The name-value pairs can be nested. In the example, the value of `ima.ge` is `画像` which is expected to be displayed for Japanese users. 

![](https://i.imgur.com/YSi7x3g.png)


## Step 3: Import the Language JSON Files
- If you are using SideeX Recorder for i18n testing, open SideeX Option page, tick off the languages for which you want to test and upload the JSON files.
![](https://i.imgur.com/liJLMsK.png =300x)
Then, turn on `Playback through WebDriver` and `Internationalization Testing with WebDriver` in Basic Settings
    ![](https://i.imgur.com/WH8MQvb.png =x300)


- If you are using SideeX Runner, refer to the [SideeX Runner](/@sideex/book/%2F%40sideex%2Frunner) document to see how to import the language files using the config file.

    



## Step 4: Use `@{I18N_VAR_NAME}` in the Recorded Test Case

To use the values defined in the imported language files, use the format `@{I18N_VAR_NAME}` in the commands recorded in the test case. For example, we are going to verify if the `Image` element on the Google homepage correctly presents as `画像` on a browser in Japanese. We modify the recorded test case by using `@{ima.ge}` in the `Value` field of the `verifyText` command in SideeX Recorder panel.
![](https://i.imgur.com/MG5UiM4.png)
:::info
Note: A value of names in a language file can be an array. In the example, the value of `user` is an array `["佐藤", "鈴木", "高橋", "田中", "渡邊"]`, and use `@{user.0}`, `@{user.1}`,`@{user.3}` and `@{user.4}` to refer to each element in the array.
:::

## Step 5: Play the Test Case for i18n Testing
The final step is to start i18n testing by playing the modified test case through SideeX Recorder or SideeX Runner. The test case will be executed mutiple times, one for each language selected at the Option page. The browser will be opened in different language each time. 

The following screenshot shows the browser opening the Google homepage in Japanese and the text of `//div[2]/a[1]` is going to be verified against the value, `画像`, defined in the imported language file.

![](https://i.imgur.com/ZRf5Iwr.png =400x)

After playback, the test results are shown in multiple test reports. Each report shows individual test result for each language, and the language is annotated in the summary section of the test report.

![](https://i.imgur.com/iIzEnug.png =400x)
