直接前往內容

最常造訪的網頁

最近瀏覽的網頁

navigation

Test Your App with Pseudolocales

A pseudolocale is a locale that is designed to simulate characteristics of languages that cause UI, layout, and other translation-related problems when an app is translated. Pseudolocales are created by instant and automatic translations that are readable in English for all localizable messages. Un-pseudolocalized text points to untranslatable messages in your source code. Pseudolocales save time and money because you can make adjustments to the UI text and its layout before you commit your messages to the source repository to be sent for translation later. For a list of potential translation problems, see Spot Localization Issues.

Figure 1. English (XA) pseudolocale

The (Android) pseudolocale names follow standard locale naming conventions, and their locale IDs can be parsed by any BCP 47 compliant programming language. In this sense, pseudolocales are just like any other locales such as French, Chinese, Russian, and so on.

The Android platform provides the following two pseudolocales to represent Left-to-right (LTR) and right-to-left (RTL) languages:

Figure 2. AR (XB) pseudolocale

English (XA): Adds Latin accents to the base English UI text, expands the original text by adding non-accented text, and brackets each message unit to expose potential issues from expanded text. Potential issues can be layout breakage and badly formed message syntax as shown by one sentence split into multiple parts displaying as multiple bracketed messages. The English (XA) pseudolocale is shown in figure 1.

AR (XB): Sets the text direction of the original left-to-right messages to the right-to-left direction, which reverses the order of the characters in the original message. The AR (XB) pseudolocale is shown in figure 2.

Pseudolocales can help you make an RTL version of your app, even if you do not write or speak any RTL languages.

Enable pseudolocales

Pseudolocales are usually added to developer-oriented builds. When you choose a pseudolocale on your device, all of the apps that support pseudolocales take on the characteristics of the selected pseudolocale including all the system apps such as Settings app and Quick Settings panel.

To use the Android pseudolocales, you must be running Android 4.3 (API level 18) or higher and have developer options enabled on your device.

The following procedure explains how to enable pseudolocales:

  1. In Android Studio enable pseudolocales for a specific app by adding the following configuration to your build.gradle file, as follows:

    android {
      ...
      buildTypes {
        debug {
          pseudoLocalesEnabled true
        }
      }
    

  2. Build and run your app.

    Figure 3. Select a pseudolocale

  3. Use the Settings app to select a pseudolocale according to your Android version, as follows:

    Android 5.0 or later:

    1. On the device, open the Settings app and tap Languages and input > Language preferences.
    2. In the Language preferences list, press the tab to move a pseudolocale to the top of the list to make it the active language (see figure 3).

    Android 4.4.4 or earlier:

    1. On the device, open the Settings app and tap Languages and input > Language preferences > Add a language.
    2. Tap a pseudolocale to add it to the Language preferences list.
    3. In the Language preferences list, press the tab to move a pseudolocale to the top of the list to make it the active language (see figure 3).

Spot localization issues

Pseudolocales provide a time-saving and effective way to spot potential localizability issues in the UI by helping you to identify problems in the following areas:

本網站使用 Cookie 儲存你在此指定的語言和顯示選項偏好設定。

掌握有關 Android 開發人員的最新消息和實用訣竅,協助你製作最受歡迎的 Google Play 內容。

* 必填欄位

訂閱成功!

在 WeChat 上追蹤 Google Developers

你要以瀏覽這個網站嗎?

你要求以顯示這個網頁,但你為此網站指定的語言偏好設定為

是否要變更語言偏好設定並改用瀏覽網站?稍後如要變更語言偏好設定,請利用位在每個網頁最下方的語言選單來調整設定。

你的 API 層級必須達 以上才能存取這個級別

本說明文件已隱藏,因為你為該文件選取的 API 層級為 。使用左側導覽列上方的選取工具即可變更說明文件的 API 層級。

如需進一步瞭解如何為應用程式指定 API 層級的相關資訊,請參閱 Supporting Different Platform Versions (支援不同的平台版本) (英文)。

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)