DEV Community

Bonggi Cho
Bonggi Cho

Posted on

Shipping a camera app in four languages: what per-app locales on Android don't handle

I maintain a small free camera app for Android — BboshaCam (Korean name 뽀샤캠). No subscription, no in-app purchase, no watermark, and the interface ships in Korean, English, Japanese and Chinese. That last part took more work than the camera itself.

(Self-promo disclosure: it's my app, and the Play link is at the bottom.)

Here's what I ran into, in case you are localizing an Android app of your own.

Per-app language on Android 13+ is necessary, but it is not a language switch

Android 13 added per-app language preferences. Declare locales_config.xml and point the manifest at it:

<!-- res/xml/locales_config.xml -->
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
  <locale android:name="ko" />
  <locale android:name="en" />
  <locale android:name="ja" />
  <locale android:name="zh-CN" />
  <locale android:name="zh-TW" />
</locale-config>
Enter fullscreen mode Exit fullscreen mode
<application android:localeConfig="@xml/locales_config" ... />
Enter fullscreen mode Exit fullscreen mode

That surfaces your app in Settings → System → Languages → App languages. Two gaps: there is no switch inside your app, and anything below Android 13 never sees the setting at all.

In-app switching: AppCompatDelegate.setApplicationLocales

On AppCompat 1.6.0+ this is backported below Android 13 and persists the choice:

AppCompatDelegate.setApplicationLocales(
    LocaleListCompat.forLanguageTags("zh-TW")
)
Enter fullscreen mode Exit fullscreen mode

To have the stored locale applied before the first Activity reads resources, opt into auto storage in the manifest:

<service
    android:name="androidx.appcompat.app.AppLocalesMetadataHolderService"
    android:enabled="false"
    android:exported="false">
    <meta-data android:name="autoStoreLocales" android:value="true" />
</service>
Enter fullscreen mode Exit fullscreen mode

Two things bit me in a camera app specifically.

The activity is recreated. CameraX use cases have to be rebound, and a preview that restarts mid-session reads as a crash to the user. Keeping the selected mode and lens in a ViewModel made the switch invisible: the preview comes back on the same mode.

Store listing locales are a separate translation. Play listing locales (ko-KR, en-US, ja-JP, zh-TW, zh-CN) have nothing to do with your resource locales. My listing is still mostly Korean, so a Chinese user meets a Korean title, installs, and then has to find the switch inside the app.

Strings built outside an Activity keep the app default

Dialogs, toasts, notifications, and anything you build from the application context do not follow the activity's locale:

val config = Configuration(context.resources.configuration)
config.setLocale(locale)
val localized = context.createConfigurationContext(config)
Enter fullscreen mode Exit fullscreen mode

I routed every user-facing string on those paths through one helper. Miss one and the app speaks two languages in the same session, which looks worse than being English-only.

Why the switch sits on the first screen

In a camera app the shutter is pressed in a hurry and labels are read at a glance: mode names, exposure, "hold still". If those are in a language you cannot read, the app is unusable however good the photo is. So the mode names and the language switch share the first screen, and nothing is hidden under settings.

What the app is, honestly

BboshaCam (뽀샤캠) is free with ads, Android 7.0 and up, no iPhone version.

  • Four modes: Portrait, Photo, Landscape, Night.
  • Brightness, colour tone, skin, clarity and filters on the same screen right after the shutter, so no second app is involved.
  • Animal filters (dog, cat).
  • No face reshaping: no jaw slimming, no eye enlarging. It only touches brightness, tone and skin texture.
  • Not a pro camera: no manual shutter or ISO, no RAW, no cloud sync.

Google Play: https://play.google.com/store/apps/details?id=io.cho.bbocam&hl=en

If you are doing the same thing - an in-app language switch in a camera or gallery app - the store listing localization is what I would do earlier next time. It is cheap, and it stands in front of the user before your app ever runs.

Top comments (2)

Collapse
 
userxnom profile image
Abdullah Naseer •

The CameraX rebind detail is the one that would have caught me out — a preview restarting mid-session reading as a crash is a rough failure mode for a camera app. When the locale switches and the activity recreates, do in-progress settings like the selected filter survive, or do you have to restore them after the rebind? The zh-TW vs zh-CN split in the store listing is a good catch too; most people assume the listing follows the app's resources.

Collapse
 
mosmox_studio profile image
Mosmox Studio •

The point about the preview restarting reading as a crash is a good one. Did you see the locale switch cause trouble while a video was being recorded, or do you block switching during capture? Curious how you handled that case.