How we built Googly Player's 17-language picker so it never silently falls back to English

An in-app language picker is a small feature with several quiet failure modes. Here is each decision behind Googly Player's 17-language picker and the specific failure it prevents.

Binary Buddies · 5 min read · 0 views
A skyline of many cities at duskDomes, towers, pagoda roofs and apartment blocks share one horizon at dusk under a rising moon, strung together with coloured lights, with one window glowing brighter than the rest.

An in-app language picker looks like one of the easier features to ship on Android. It is also one of the easiest to ship broken. The worst version of the bug goes like this: a user picks Hindi or Arabic, taps it, and everything stays in English. Nothing crashes. Nothing appears in the logs. The locale-switching code is correct, and the fault is in how the app was packaged for the store.

The other failures are smaller but visible to anyone who reads the language. A count glued onto a label lands on the wrong side of it in Arabic and Urdu. A plural written as one format string turns into broken grammar in Russian. A locale applied to screens but not to services leaves the media notification speaking the old language.

Googly Player, our Android app for videos, music and photos, ships a full in-app picker for 17 languages that works independently of the phone's system language. Below is each decision behind it and the specific failure it prevents.

Key takeaways

  • The picker covers 17 languages and lists each one by its own name in its own script, with the English name underneath.
  • The locale is applied process-wide, so services, notifications and dialogs switch along with the screens.
  • Language splits are disabled in the App Bundle; without that, Play delivers only system-language resources and the picker silently shows English.
  • Arabic and Urdu get full right-to-left layout, and every count uses a format string or a plural resource rather than concatenation.
  • On Android 13 and later, the choice also appears in the system's own per-app language setting.

Seventeen languages, chosen in the app

The picker offers 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) and Gujarati (ગુજરાતી).

The choice is entirely independent of the system language. That matters for a common situation: a phone set up in English by whoever sold or configured it, used day to day by someone who would rather read Bengali or Gujarati. Nobody should have to change the language of their whole device to use one media app comfortably, and in Googly Player they do not have to.

17languages in the in-app picker
2right-to-left languages: Arabic, Urdu
6plural forms Arabic needs
4plural forms Russian needs

A picker people can read before they switch

A language list written entirely in English assumes the user already reads English, which is exactly the user who least needs the picker. So every entry leads with its endonym, the language's name in its own script, and puts the English name underneath. Someone looking for Japanese finds 日本語; someone helping them can still find Japanese.

The list is searchable, and above it sits a Suggested section built from the device locale. In practice that means the likeliest choice is usually at the top without any scrolling, while the full list of 17 is one search or swipe away for everyone else.

How the language picker is organisedA search field sits above a Suggested section drawn from the device locale and the full list of 17 languages; each entry shows the language's own name first and its English name beneath.Inside the language pickerSearch fieldSuggestedFrom the device localeAll 17 languagesEspañolSpanishEndonym first, English beneath
Search and Suggested narrow the list; each entry names the language in its own script before its English name.

Right-to-left for Arabic and Urdu

Arabic and Urdu are written right to left, and Googly Player supports that fully rather than just swapping strings into a left-to-right layout. Mirroring the layout is the obvious part. The less obvious part is mixed content, and the picker itself is a good example: an Arabic or Urdu name sits next to Latin-script English names, and a careless layout anchors it to the wrong edge.

We anchor the language names in the picker correctly for their direction, so العربية and اردو read naturally in a list that also contains Deutsch and Italiano. The same care has to extend to every string with a number in it, which is the subject of a later section.

Lanterns over a market streetRows of paper lanterns and hanging cards in many colours sway over a street at dusk, one lantern glowing brighter than the rest.

One locale for the whole process

A locale switch that only reaches activities is the most common half-finished implementation. The screens change, but a background service keeps formatting text in the old language, the playback notification still says what it said before, and a dialog raised from somewhere unexpected comes up in English. For a media player that is especially visible, because the notification is on screen whenever music is playing.

We apply the chosen language through AppCompatDelegate.setApplicationLocales, which sets it for the whole process. Services, notifications and dialogs follow the user's choice, not just activities, so there is no corner of the app still speaking the previous language.

Where the chosen language appliesA single setApplicationLocales call sets the language for activities, services, notifications and dialogs, and on Android 13 and later the choice also appears in system Settings.One call, every partsetApplicationLocalesActivitiesServicesNotificationsDialogsAndroid 13+: also in Settings
The chosen language reaches every component of the app, not only its screens, and on newer Android it is visible to the system too.

Handing the choice to Android 13 and later

Android 13 introduced a per-app language setting at the system level. On those devices we hand the user's choice to the platform instead of keeping it private to the app. The result is that the language picked inside Googly Player also shows up under Settings › Apps › Googly Player › Language, and a change made in either place is the same setting.

This is a small thing that removes a support question. Users who manage languages from system Settings find Googly Player listed there like any well-behaved app, and users who never leave the app get the in-app picker. Neither group ends up with two settings that disagree with each other.

The failure with no crash and no log line

Googly Player ships to Google Play as an App Bundle. By default, an App Bundle lets Play split language resources out and deliver only the ones matching the device's system language. That is a sensible default for apps that follow the system language, and a silent disaster for an app with its own picker.

With splits on, a phone set to English receives only English resources. The user picks Hindi, the app correctly asks for Hindi strings, they are not on the device, and Android falls back to the default. Everything renders in English. There is no crash and nothing in the logs, so the bug is close to invisible in testing on a developer's own device. We deliberately disable language splits so every translation ships in the base APK.

Language splits on and offWith language splits enabled, Play delivers only system-language resources and the picker renders everything in English; with splits disabled, every translation is in the base APK and the picker renders the chosen language.Where the translations liveSplits enabledOnly system-languageresources deliveredPicker renderseverything in EnglishSplits disabledEvery translationin the base APKPicker rendersthe chosen language
The top row is the silent failure; the bottom row is how Googly Player is packaged.

Counts and plurals that read correctly

A media app is full of counts: how many videos, how many tracks, how many photos. The quick way to build those strings is concatenation, a label plus a number. In English that reads fine. In Arabic and Urdu, which run right to left, concatenation puts the number on the wrong side of the label. So in Googly Player counts are always formatted through a format string, never concatenated.

Concatenated

"Total Videos: " + n

  • Number position is fixed by the code
  • Lands on the wrong side in Arabic and Urdu

Formatted

"Total Videos: %d"

  • Each translation places the number itself
  • Reads correctly in right-to-left languages

Formatting fixes position, not grammar. A single format string has one shape, but languages change the noun with the number in different ways: Arabic needs six grammatical forms for a number and Russian needs four. No format string can express that, so countable strings use Android's plural resources, where each language supplies exactly the forms its grammar requires.

Plural forms by languageArabic needs six grammatical forms for a number and Russian four, which is why counts in the app use plural resources.Grammatical forms per numberArabic6 formsRussian4 formsPlural resources, per language
One format string has one shape; Arabic and Russian need several, so each language gets its own plural resource.

What it takes to use it

The picker lives inside Googly Player, our media app that plays and organises videos, music and photos on the device, with a single global search across all three. There is nothing to install for languages: because every translation ships in the base APK, all 17 are on the phone from the first launch, whatever the system language is.

  1. Open the language picker

    It is a full in-app picker, separate from the phone's own language setting.

  2. Check Suggested, or search

    The Suggested section reflects the device locale; the search field finds any of the 17 languages quickly.

  3. Pick the language by its own name

    Each entry shows the endonym first and the English name underneath. The whole app switches, including notifications and dialogs.

  4. On Android 13 or later, use system Settings if you prefer

    The same choice is available under Settings › Apps › Googly Player › Language.

For teams weighing us for their own Android work, the list above is the checklist we apply: endonyms and search in the picker, correct right-to-left anchoring, a process-wide locale, platform handoff on Android 13 and later, language splits off in the App Bundle, and formatted counts with real plural resources. None of it is exotic. Each item is there because skipping it produces a failure that a user in one of those 17 languages will see.

Questions

Does Googly Player's language have to match my phone's language?

No. The in-app language picker is entirely independent of the system language, so the phone can stay in one language while Googly Player runs in another.

Will the playback notification and dialogs change language too?

Yes. The language is applied process-wide through AppCompatDelegate.setApplicationLocales, so services, notifications and dialogs follow the choice, not just the main screens.

Is every language available even if Play installed the app on an English phone?

Yes. Language splits are disabled in the App Bundle, so every translation ships in the base APK and the picker never falls back to English for lack of resources.

Does Arabic and Urdu support include right-to-left layout?

Yes. Both get full right-to-left support, including correctly anchored names in the picker and counts formatted so the number appears on the correct side of its label.

Can I change Googly Player's language from Android Settings?

On Android 13 and later, yes: the choice appears under Settings › Apps › Googly Player › Language and stays in step with the in-app picker.

  • #Android localisation
  • #Android plurals
  • #Googly Player
  • #binary buddies
  • #in-app language picker

Comments

Add a comment
Sign in with Google to join the conversation