Share iOs string resources with Android

Cover Image for Share iOs string resources with Android

This is a story about one project where Android platform is catching up iOS when using shared string resources. And how this can be solved by custom gradle plugin.

Localization platform

At the beginning there was a requirement where string resources in the mobile app should be easily reviewable, updatable and in sync across mobile platforms.

So we started to discuss some localization platform and translation management system. There is a plenty of localization platforms. Let's mention some:

Here we can skip discussion about which platform is better than the other. We can state the fact that PoEditor variant was chosen. And on top of that, it was decided to import all existing strings from iOS including iOS specific string resource keys and parameter placeholders into the PoEditor platform. In order to save money and use free tier to maximum, Android should use imported iOS variants.

Integrate PoEditor in Android

There are some tips on how to translate iOS and Android apps in the same project.

There are also already available gradle plugins treating standard cases.

But I was in the situation described above, which means convert keys, parameters, split strings to modules, etc.

Custom PoEditor gradle plugin

For situation when there is a need for custom data post-processing, the best way is to create customized convention plugin and implement any processing specifically to the project needs.

For anyone interested in implementation details, check my GitHub repository custom PoEditor Android plugin implementation

Why using gradle plugin at all?

Why I am not using some easy scripting like python or ruby? For PoEditor there is e.g. Poesie available. So Why not to use it?

Well, that's also an option.

But by using gradle plugin I am using the advantage of the convention plugins already used by the project and let project define which module wants import shared string resources. Not mentioning advantage of writing logic in Kotlin.

With the string resources import integrated as the gradle plugin it's a small step to connect this action in the CI server and automate it.

So the sharing string resources begun.
Happy coding!