Shipping a 17-language in-app picker on Android, done right

An in-app language picker can look finished and still render English everywhere. These are the Android traps we designed around in Googly Player, from App Bundle splits to Arabic plurals.

Binary Buddies · 5 min read · 3 views

Most Android apps follow the system language, and that works until someone wants the app in a language their phone isn't set to. Then you need an in-app picker. A picker is easy to build and easy to get subtly wrong. The common failures are strings in the wrong order, a language list nobody can read, and a release build that ignores the choice entirely.

We built a 17-language picker into Googly Player, our video, music and photo app for Android. It is entirely independent of the system language. This article covers how it works and the specific traps we designed around. Some of them throw no exception and leave nothing in the logs, so you only find them by looking at a release build in a language you don't speak.

What the picker covers

The app ships 17 languages, chosen from a full in-app list rather than inferred from the device:

  • English, Hindi (हिन्दी), Spanish (Español), Arabic (العربية)
  • French (Français), Bengali (বাংলা), Portuguese (Português), Russian (Русский)
  • Urdu (اردو), Indonesian (Bahasa Indonesia), German (Deutsch), Japanese (日本語)
  • Turkish (Türkçe), Vietnamese (Tiếng Việt), Korean (한국어), Italian (Italiano), Gujarati (ગુજરાતી)

The set includes two right-to-left languages, Arabic and Urdu, and several languages with plural rules far more complex than English. Both facts shaped the engineering decisions below.

A picker people can actually read

Each language is listed by its endonym, its own name in its own script, as the primary label. The English name sits underneath. Someone who has landed in a screen of unfamiliar text can still find their language, because it is written the way they would write it.

The list is searchable and has a 'Suggested' section at the top, based on the device locale. That puts the likely answer one tap away without hiding the other sixteen.

Arabic and Urdu need extra care here. In a right-to-left layout the language names have to be anchored correctly, or the list looks broken in exactly the languages it is meant to serve. We handle that in the picker itself, as part of full RTL support for both languages.

Applying the choice process-wide

We apply the selected language through AppCompatDelegate.setApplicationLocales. Because it is applied to the whole process, it covers services, notifications and dialogs as well as activities. That matters for a media player: the playback notification is a prominent piece of UI, and it is not an activity. A per-activity locale override would leave it in the wrong language.

On Android 13 and later we hand the choice to the platform. The selection then also appears under Settings › Apps › Googly Player › Language, so the in-app picker and the system per-app language setting agree instead of competing.

The App Bundle setting that breaks it silently

This is the trap most likely to cost you a day. With default App Bundle behaviour, Play delivers only the system-language resources to a device. Your picker then offers 17 languages, the user chooses one, and the app renders everything in English. There is no crash and nothing in the logs.

We deliberately disable language splits in the App Bundle, so every translation ships in the base APK. The cost is a somewhat larger base install. The benefit is that the picker does what it says. If you build an in-app language picker, check this setting before you test anything else, and test a release build installed through the bundle path, not a debug build that contains every resource anyway.

Formatting counts instead of concatenating them

Our screens show counts such as 'Total Videos: 12'. We never build these by joining a label and a number in code. The string is a resource with a placeholder, the equivalent of Total Videos: %d, and the number is passed in as a formatted argument.

The reason is directional. Concatenating "Total Videos: " + n puts the number on the wrong side of the label in Arabic and Urdu. A format string lets each translation place the number where its own language puts it. Global Search shows the same discipline in its section headings, which carry counts such as 'Videos · 12', 'Music · 4' and 'Photos · 87'.

Plurals need plural resources

A format string cannot express how many grammatical forms a language has for a number. Arabic needs six. Russian needs four. English gets by with two, which is why hand-rolled 'item' and 'items' logic survives in so many codebases until the first translation arrives.

We use proper plural resources throughout. The translator for each language supplies the forms that language needs, and the platform picks the right one at runtime from the number. The code stays free of per-language branching, and adding a language does not mean touching logic.

A checklist for your own app

If you are adding an in-app picker to an Android app, these are the checks we would run, drawn from what we did:

  1. Apply the locale with AppCompatDelegate.setApplicationLocales, so services, notifications and dialogs follow it.
  2. On Android 13+, let the platform own the setting so it shows up in system app settings.
  3. Disable language splits in the App Bundle, then verify on a bundle-delivered install that a non-system language actually renders.
  4. Label languages by endonym, with the English name beneath, and make the list searchable.
  5. Test Arabic and Urdu for layout, including how names are anchored in the picker.
  6. Replace every string concatenation that includes a number with a formatted resource.
  7. Replace format-string pluralisation with plural resources.

What it needs and how to reach us

The language picker is part of Googly Player and needs nothing extra to run: the translations are in the base APK. The Settings › Apps › Googly Player › Language entry appears on Android 13 and later, where the choice is handed to the platform. The in-app picker is the way to choose a language on earlier versions.

If you are weighing us for Android work that includes localisation, the list above is the level of detail you can expect from us. Googly Player also has an in-app Report Bug / Request Feature channel for problems with a specific translation or layout.

  • #Android localization
  • #Android plural resources
  • #Googly Player
  • #RTL Android
  • #in-app language picker

Comments

Add a comment
Sign in with Google to join the conversation