Android Localization – My first CLI with Rust
This blog post is about introducing a CLI to automate parts of Android localization. The readme, source & binaries can be found in the repository. For background story, read on -
My professional Android developer days started about 5.5 years ago @ Fieldwire. The tools & libraries available to ease development have come a long way since then. One thing that I felt could use more love was an easy way to automate the localization process. The typical localization flow in my workplace once we hit code freeze for a new version is -
- Dev creates a spreadsheet of strings & locales combo to be localized
- Product manager uses an external service to get it localized
- Dev transfers the localized strings back to values-xx/strings.xml files
The pain points for the Android team has been the manual work in extracting out the strings to be localized (1) & putting back the localized strings (3). It is time-consuming, boring & also there is a chance of copy paste errors. I wrote a NPM script which has been serving us well for the past 3 years but because of my shoddy work (I was really new to NPM & the whole JS ecosystem then 😅) & lack of tests, it has been a bit challenging to refactor or add new features.
I wanted to rewrite that script to be more extendible & robust & decided to go with Rust for this, since I have been wanting to write more than just toy programs with it and also because its support for building CLIs is very impressive. It was a fun exercise that helped me get a stronger understanding of some of the Rust concepts I wasn’t sure about. I believe the CLI is now in a good enough spot to be open-sourced - Android Localization.
There are a couple of gradle plugins that can help do this & more - 1, 2. The reasons as to why I wrote another utility are -