As you probably know, Lokalise provides an Android SDK featuring over-the-air localization for mobile apps. While working on localizing the Stream Vision 2 mobile app, Orangesoft, one of our customers, has recently introduced Lokalise-Loader, a Kotlin library providing an easy way of pulling Android string resources from Lokalise. In this article, we'll provide an overview of this solution.
The Android SDK enables you to generate archives with up-to-date translation data, use them when building the app, and then serve it to the end users. All in all, this process is quick and simple. However, there's one caveat: you have to repeat this on a regular basis, and if you are adding new translation strings often, it might become a chore.
Another requirement for the Stream Vision 2 app was the ability to use it to the full extent in offline mode. By default, every time a user opens a mobile app, Android will try to load the app's resources based on the system language set on the user’s device. But in this exact case, the app has to be localized by default to support offline usage. Unfortunately, there were no existing solutions available on the net; therefore, Orangesoft decided to create their own custom library, allowing users to update resources with a single click. So, they came up with the Lokalise-Loader library which provides an easy way of pulling Android translations from Lokalise.
So, does it work?
The overall idea is quite simple: Lokalise-Loader sends an API request, creates XML translation files, and places them in the project's folder. Here's a step-by-step process:
Fetch a list of all available project languages using the Languages endpoint.
The Lokalise-Loader library provides a Gradle task to load translations during builds. In order to use this task, you'll need to register it in the following way:
On top of that, it's possible to specify a list of keys to download from Lokalise. This allows you to manage specific translation keys more efficiently, especially for modular projects. This might come in handy if you would like to upload certain translations to a non-main module and prevent those resources from being duplicated in the main module. To achieve this, use the following approach:
In Stream Vision 2, the Gradle task is used in CI/CD before the release. It automatically updates the strings to the current version. This way, users without Internet access will have the newest translations while using the application. So, as you can see, Lokalise-Loader is a neat and handy library that can make your life as a developer even simpler.
That's it for today, folks! Thank you for staying with me, and until next time.
Ilya is a lead of content/documentation/onboarding at Lokalise, an IT tutor and author, web developer, and ex-Microsoft/Cisco specialist. His primary programming languages are Ruby, JavaScript, Python, and Elixir. He enjoys coding, teaching people and learning new things. In his free time he writes educational posts, participates in OpenSource projects, goes in for sports and plays music.
Ilya is a lead of content/documentation/onboarding at Lokalise, an IT tutor and author, web developer, and ex-Microsoft/Cisco specialist. His primary programming languages are Ruby, JavaScript, Python, and Elixir. He enjoys coding, teaching people and learning new things. In his free time he writes educational posts, participates in OpenSource projects, goes in for sports and plays music.
Transcreation vs Localization: Which Approach is Right for You
When Coca-Cola launched its famous “Share a Coke” campaign in China, it tanked. Since most Chinese consumers don’t go by just one name, the idea of printing common first names on bottles didn’t work well. So, the brand adapted this campaign to print social labels like “Comedian” and “Fashionista.”
UI Localization: How to Make Your App Feel Native Everywhere
When I visited Norway for the first time, my biggest challenge was driving on the right-hand side of the road. Every turn, every signal, every instinct felt off. I wasn’t exactly lost. But it took way more effort than cruising through the left-side driving lanes in India. That’s exactly how people feel when they try to navigate your website or app in a language they don’t speak fluently. Sure, they can use it. But it feels clunky, disorienting, and far from intuitive.
How to create user-friendly global experiences through UX localization
Picture this: you live in Japan and you’re planning a weekend getaway in the mountains. You download that new car rental app you’ve heard so much about from your American friends — and great, it’s in Japanese! That makes things easier. But wait a second… pick-up times are in AM/PM format, and you can never remember if 12 PM is noon or midnight. When you try to enter your address, there’s no field for the prefecture! And the app insists on knowing which U.S. state issued your driver’s li