In-App Language Picker on Android: 17 Languages Done Right

The failures in Android localisation are quiet: no crash, no log line, just English where a user chose Spanish. Here are the decisions that prevent them.

Binary Buddies · 5 min read · 5 views

Adding a language picker to an Android app looks like a string-resources task: translate the files, add a list, call a function. The failures show up afterwards, and they are quiet ones. A user picks Arabic and sees English, because the translations never reached the device. A count renders on the wrong side of its label. A plural reads wrongly in a language whose grammar has more forms than your format string can express. None of these crashes, and none of them writes anything to the logs.

We ran into this class of problem building Googly Player, our Android app for videos, music and photos. It has a full in-app language picker with 17 languages, entirely independent of the system language. This article covers how it is built and, more usefully, the specific decisions that keep it from failing silently.

If you ship an Android app to more than one locale, or you are deciding whether we are the right people to build one, this is the level of detail we work at.

17 languages, chosen inside the app

The picker does not follow the system language. A user can run their phone in one language and the app in another. The 17 languages are:

  • 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 mixes Latin, Devanagari, Arabic, Cyrillic, Bengali, Gujarati and CJK scripts, and it includes two right-to-left languages. That spread means a layout or string bug is likely to show up in at least one of them.

A picker people can actually use

Each language is listed by its endonym, its own name in its own script, as the primary label, with the English name underneath. Someone who cannot read the current interface language can still find their own. A picker that lists only English names fails exactly the person who needs it most.

The list is searchable, and it has a 'Suggested' section built from the device locale, so the most likely choice sits at the top without the user scrolling through 17 entries.

Arabic and Urdu get full right-to-left support. That includes the language names in the picker itself, which are anchored correctly for their script rather than left aligned like the Latin-script rows around them.

Applying the choice everywhere, not just in activities

The selected language is applied process-wide through AppCompatDelegate.setApplicationLocales. The reason is coverage. Setting a locale on individual activities leaves services, notifications and dialogs in whatever language the system uses. In a media player that matters, because the playback notification is one of the most visible surfaces in the app, 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's per-app setting stay in step instead of competing.

The App Bundle setting that makes the picker lie

This is the failure we would check first in any app with an in-app language picker. With a standard App Bundle configuration, Google Play uses language splits and delivers only the system-language resources to each device. Your picker then offers 17 languages, the user chooses Spanish, and the Spanish resources are not on the device. The app falls back to English. There is no crash and no log entry, and the picker looks as if it simply does nothing.

We deliberately disable language splits in the App Bundle, so every translation ships in the base APK. The cost is a larger base download. The benefit is that the picker does what it says. If your language choice is independent of the system language, your build has to ship every language to every device.

Counts are formatted, never concatenated

Strings like 'Total Videos: ' followed by a number are easy to write as concatenation: the label, then the integer appended. In Arabic and Urdu that puts the number on the wrong side of the label, because the reading direction is reversed and the surrounding text is bidirectional.

In Googly Player the count lives inside the string resource, as a format such as 'Total Videos: %d', and the number is substituted at runtime. The translator controls where the placeholder sits, so each language can position the number correctly. The same rule applies anywhere the app builds a label from a value: give the translator the whole sentence, not two halves.

Plurals need plural resources

A format string cannot express a plural, and many languages have more plural forms than English's two. Arabic needs six grammatical forms for a number, and Russian needs four. If the app only ever chooses between 'one' and 'many', those languages will read incorrectly for whole ranges of numbers.

Googly Player uses proper Android plural resources for this. Each translation supplies the forms its own language requires, and the platform selects the right one for the count. This matters in a library app, where the sentences with numbers in them, such as how many videos, tracks or photos you have, show up all the time.

The search screen is a good example. It shows sectioned results with counts, in the pattern 'Videos · 12', 'Music · 4' and 'Photos · 87'. Every one of those counts is a place where both the placement rule and the plural rule have to hold in all 17 languages.

A checklist drawn from these failures

If you are adding an in-app language picker to your own app, these are the checks that map to the problems above:

  • Choose an app language that differs from the system language and confirm that the interface, a notification and a dialog all follow it.
  • Install the release build from an App Bundle, not a debug APK, and confirm that non-system languages still load. Language splits only show up on a bundle install.
  • Switch to Arabic or Urdu and look at the picker, every count label and every list row.
  • Look for string concatenation anywhere a number meets a label, and for any plural handled by a format string.
  • On Android 13 or later, confirm that the per-app language setting under system Settings agrees with the in-app choice.

Most of these cannot be caught by unit tests on the default locale, which is why they survive into releases.

What it works with and what it needs

Googly Player is an Android app. The in-app picker works on every version the app runs on. On Android 13 and later, the language also shows up in the system's per-app language settings. The app also declares the media permissions it needs for videos, music and photos, and its prompts state in plain language that nothing is uploaded and everything stays on the device.

If you want this kind of detail applied to your own Android app, whether that is localisation, permissions or a media experience, that is the work we do. Get in touch with us and tell us which languages and Android versions you need to support.

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

Comments

Add a comment
Sign in with Google to join the conversation