Pseudolocalization: Visiting Android's Bizarro World

Pseudolocalization: Visiting Android's Bizarro World

I wrote a while ago about pseudolocalization on Android but times have changed and I wanted to give an update.

Pseudolocalization is a developer testing method that automatically translates your strings files into gibberish, with extra text and accents, in order to test the robustness of your system. Here's a screenshot from a sample app:

The Wikipedia article gives a great overview on the issues it can reveal:

  • Translated text that is significantly longer than the source language, and does not fit within the UI constraints, or which causes text breaks at awkward positions.
  • Font glyphs that are significantly larger than, or possess diacritic marks not found in, the source language, and which may be cut off vertically.
  • Languages for which the reading order is not left-to-right, which is especially problematic for user input.
  • Application code that assumes all characters fit into a limited character set, such as ASCII or ANSI, which can produce actual logic bugs if left uncaught.
  • The localization process may uncover places where an element should be localizable, but is hard coded in a source language. Similarly, there may be elements that were designed to be localized, but should not be (e.g. the element names in an XML or HTML document.)

Alright, you're sold: how do we do it?

First, enable it in your build type. Simply set pseudoLocalesEnabled in your build.gradle. Here's an example of enabling it for debug builds:

android {
  // ...Clipped rest of normal config...

  buildTypes {
    debug {
      pseudoLocalesEnabled true
    }
  }
}

Next, you need to set your phone to use one of the pseudolocales. There are two that are generated:

  • en_XA, which adds tons of glyphs as well as inflates the length of each string.
  • ar_XB, which reverses every string and sets the locale to right-to-left.

On some devices these locales are accessible in the normal language picker. If they're not, you'll have to manually set the new locale yourself. Here's a couple ways to do that:

  1. You can install a locale switching app (like MoreLocale 2).

  2. If you're using Genymotion, you can use the system app Custom Locale.

Now you can enjoy your app in Bizarro World!


"Bizarro box" by sharkhats is licensed under CC BY-NC 2.0