Using Multiple Locales in an Android App

Mar 17, 2025

Toast's Android App Goes Global! Strategies for Seamless Localization of Android apps.

Introduction

Localizing a large Android app for multiple languages can feel overwhelming, especially when starting from scratch. For many projects, the challenge lies in managing the rollout of new languages while maintaining a seamless user experience and avoiding disruptions. However, by using feature flags to control the rollout process, we can introduce new languages incrementally, minimizing risk and ensuring a smooth transition. While our international presence is currently very limited, we've recently taken steps to support our US customer base by localizing one key feature of the Toast POS Platform into Spanish and Mandarin. This focused effort allowed us to gain valuable experience in the localization process.

In this blog post, we’ll explore how we solved a number of challenges regarding the localization of the Toast POS Platform. These challenges included delivering translations to specific users, addressing partially translated views outside the targeted feature, implementing a language picker for better control of the app’s language, and using incremental rollout strategies to localize our large Android project.

Challenges of Localizing a Large Android App

Localizing a large app like an Android app involves unique technical and logistical hurdles. The sheer volume of code is one challenge, making it difficult to identify and modify all translatable text. With thousands of lines of code, developers must sift through files to extract relevant strings, a process that can take significant time and is prone to errors.

As the app grows, maintaining translations across multiple languages increases in complexity. Keeping track of updates and changes across versions becomes more complicated, resulting in maintenance overhead. The introduction of new languages can also create layout issues since different languages take up varying amounts of space. For instance, a translated string might be much longer than the original, leading to crowded or broken user interfaces like the text not fitting inside the component and showing only part of it

In such cases, pseudo-localization can be a valuable tool. Pseudo-localization simulates the effects of localization without actual translation. It alters the app's strings to mimic the characteristics of various languages, adding accents, expanding text length, or even reversing text direction. At Toast, we used pseudo-localization, which helped us identify and resolve UI concerns, hardcoded text, and format conflicts before involving translations.

Below, we can see an example of the original English version with pseudo-localization enabled, causing a broken layout on the last button at the bottom due to longer text.

Incremental Localization: Start Small, Scale Up

A gradual approach to localization helps manage the complexity of adding multiple locales. Instead of localizing the entire app at once, developers can start small, focusing on a specific feature or section of the app. This limited scope allows for more control and helps detect potential issues early, such as hardcoded strings or resources that may affect other areas of the app.

While we started small and localized only one part of the app, we discovered an issue with shared strings. Certain strings, stored in a shared module, were being used across multiple features to ensure consistency in common UI elements. However, this also meant that when we translated a string in one feature, it automatically appeared translated in other areas of the app that weren’t intended to be localized yet. This resulted in partially translated views, which isn’t a great experience for the user. We resolved this by creating unique string resource keys, ensuring localizations only impacted the targeted feature. This careful scoping allowed us to minimize risks and ensured we targeted only the features we needed.

Here is a sample of shared strings with translations outside the targeted feature.

Managing Changes Without Breaking the User Experience

Maintaining stability while introducing new languages is a critical concern. When localizing an app, the translation process itself can introduce bugs or issues with shared resources across features like view with partial translations as mentioned previously.

Testing is vital throughout the localization process. While it’s important to test the feature you’re localizing, testing across the entire app is also necessary. At Toast, for this first feature work, we relied on Screen Tests in each supported language. This ensured we had the correct content for each language. We also checked other features to confirm there were no partially translated views caused by shared strings. This approach ensures that localized strings do not interfere with other features, ensures language quality, and that the app works seamlessly across all locales.

By performing comprehensive testing after each new locale is introduced, developers can detect and address potential issues before the localization is rolled out widely. This ensures that the app maintains its functionality, performance, and user experience.

In-App Language Picker

An in-app language picker enhances the user experience by giving users control over their preferred language within the app, independent of their device’s system settings. This feature is especially useful for apps with a global audience, as it allows users to switch between different languages easily, without needing to change the device’s default locale.

At Toast, we eventually moved to an in-app language picker after relying on the device's language. This picker simplified the user experience, allowing users to choose their preferred language from within the app. It eliminated the dependency on the device's system language, giving users more flexibility.

Using Feature Flags to Control Localization Rollout

By gating localization behind feature flags, developers can introduce new languages to a small group of users before a broader release. This controlled rollouts allowed us to gather valuable feedback from our testers and alpha customers. With this feedback, we were able to iterate quickly on new versions with fixes.

At Toast, we initially used feature flags to test different languages with select groups. This allowed us to resolve any problems related to translations, layout, or functionality before expanding the availability of new languages to all users. Additionally, since we didn’t have an in-app language picker at first, we relied on Android’s setApplicationLocales APIs to ensure that users could still see the app in English if the feature flag was disabled. Below is a sample of how we set the locale to English when the feature flag is disabled.

if (isMultiLingualDisabled) {                                    
  AppCompatDelegate.setApplicationLocales( 
     LocaleListCompat.forLanguageTags( 
        Locale.US.toLanguageTag() 
     ) 
  ) 
}

Key Takeaways

Localization is an ongoing process and can introduce risk to your product experience. Feature flags to incrementally roll out changes can mitigate risks and help introduce new languages smoothly. Start with small, targeted features, ensure thorough testing, and use feature flags to control the rollouts, making the process more manageable as your app scales. To prevent backsliding, consider implementing lint checks. For complete user control, you can use the  Android setApplicationLocales APIs and programmatically adjust the application’s locale settings according to the user's choice.

____________________________

This content is for informational purposes only and not as a binding commitment. Please do not rely on this information in making any purchasing or investment decisions. The development, release and timing of any products, features or functionality remain at the sole discretion of Toast, and are subject to change. Toast assumes no obligation to update any forward-looking statements contained in this document as a result of new information, future events or otherwise. Because roadmap items can change at any time, make your purchasing decisions based on currently available goods, services, and technology.  Toast does not warrant the accuracy or completeness of any information, text, graphics, links, or other items contained within this content.  Toast does not guarantee you will achieve any specific results if you follow any advice herein. It may be advisable for you to consult with a professional such as a lawyer, accountant, or business advisor for advice specific to your situation.