Building a 17-Language Picker on Android That Works

Language splits, string concatenation and plural forms all fail silently outside English. These are the choices we made so our 17-language picker holds up.

Binary Buddies · 5 min read · 2 views

An in-app language picker looks like a small feature. You list some languages, save a choice, and restart the activity. Then it ships, and on a real device installed from a store the whole app renders in English. Nothing crashes and nothing appears in the logs. The picker saved the choice and the app simply never had the strings.

The failures that remain after you fix that are quieter. A label and a number come out in the wrong order in Arabic. A notification ignores the language you picked. A plural reads wrongly in Russian. None of these are visible from an English-language test device, so they tend to reach users first.

We built a 17-language picker into Googly Player, our Android app for videos, music and photos. This article covers the specific decisions that make it work, and the failure each one prevents. If you are building something similar, these are the places to check.

A picker that is independent of the system language

The picker is a full in-app control, entirely independent of the system language. Someone with a phone set to English can run the app in Hindi, and the reverse. The 17 languages are English, Hindi, Spanish, Arabic, French, Bengali, Portuguese, Russian, Urdu, Indonesian, German, Japanese, Turkish, Vietnamese, Korean, Italian and Gujarati.

Each language is listed by its endonym, meaning its own name in its own script, as the primary label, with the English name underneath. Someone who cannot read English can still find العربية or ગુજરાતી in the list. The list is searchable, and a 'Suggested' section at the top is based on the device locale, so the most likely choice is usually one tap away.

Applying the choice to the whole process

We apply the selected language through AppCompatDelegate.setApplicationLocales. That call works process-wide, so the choice reaches services, notifications and dialogs as well as activities. This matters for a media player, because the media notification is one of the most visible surfaces the app has, and it is not an activity.

On Android 13 and later, the choice is handed to the platform. The language then also appears under Settings › Apps › Googly Player › Language, so the in-app picker and the system per-app setting stay consistent. A user who changes it in either place gets the same result.

The App Bundle setting that makes the picker work

This is the failure from the opening. With default App Bundle behaviour, Play delivers language splits, which means only the resources for the system language reach the device. If the picker then asks for Hindi on an English-language phone, those strings are not installed. The app falls back to English with no crash and nothing in the logs.

We deliberately disable language splits in the App Bundle, so every translation ships in the base APK. It is a build configuration change, not a code change, and it is easy to miss because debug builds installed directly from a development machine contain all the resources and behave correctly. If your picker works in development and fails from the store, check this first.

Right-to-left for Arabic and Urdu

Arabic and Urdu get full RTL support. That covers layout mirroring, and it also covers a detail inside the picker itself: the language names are correctly anchored in RTL. The picker is the one screen where a user sees names in many scripts side by side, so the alignment of each name has to be right for the list to read cleanly.

Testing RTL only in the language you have switched to is not enough. The picker has to behave correctly while it is displaying all 17 languages, including when it is itself in Arabic or Urdu.

Formatted counts, never concatenated

Counts in the interface are formatted through string resources, never concatenated. We write the label as Total Videos: %d and not as 'Total Videos: ' + n. The reason is word order. Concatenation fixes the number to one side of the label, and in Arabic and Urdu that puts it on the wrong side.

With a format string, the translator controls where the number goes. The same applies to the sectioned results in our global search, which show headings such as 'Videos · 12', 'Music · 4' and 'Photos · 87'. Any text that mixes words and numbers is a candidate for the same treatment.

Plurals need plural resources

A format string cannot express grammatical number in every language. Arabic needs six grammatical forms for a number and Russian needs four. English needs two, which is why a simple conditional passes every English test and still fails elsewhere.

We use proper plural resources for these cases, so each language supplies the forms it needs. The practical rule is to treat any 'one item / many items' branch in code as a bug in a 17-language app. Move it into a plural resource and let each locale define its own forms.

A checklist drawn from these decisions

If you are adding an in-app language picker to your own Android app, these are the points we would verify, in roughly this order:

  • Language splits are disabled in the App Bundle, and a store-installed build on a device with a different system language shows the chosen language.
  • The locale is set with AppCompatDelegate.setApplicationLocales, so notifications, services and dialogs follow it.
  • On Android 13+, the setting appears in the system per-app language screen and matches the in-app choice.
  • Language names are shown as endonyms, with the English name beneath, and the list is searchable.
  • Arabic and Urdu run RTL, including the picker's own labels.
  • No user-visible string is built by concatenating a label and a number.
  • Every count-dependent string uses a plural resource.

What it needs to run

The picker relies on AppCompatDelegate.setApplicationLocales, so the app needs AppCompat. On Android 13 and later, the platform handles the per-app language setting and exposes it under system settings. On earlier versions, the in-app picker does the work.

The other requirement is in the build, not on the device: language splits must be disabled in your App Bundle configuration, so that all 17 translations are present in the base APK. Everything else, including the endonym list, search, locale suggestions and RTL anchoring, is part of the app itself and needs no extra permission.

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

Comments

Add a comment
Sign in with Google to join the conversation