androidandroid-studioandroid-gradle-pluginandroid-resourcesandroid-module

Best way to extract and translate multiple strings.xml files from a big Android project


I have a huge Android project, composed of several modules.

Ideally, I would like a fully automated way to extract all current strings.xml files, from all submodules and all resource qualifiers - to be put in a separate folder, but remaining under their folder structure.

I would like to provide this result (Extracted string files) to translation - and then when I receive the result back, automatically relocate all the updates files into the project.

For example, if I have in my project:

ModuleA:
   src/main/res/value/strings.xml
   src/main/res/value-fr/strings.xml
   src/main/res/value-es/strings.xml

ModuleB:
   src/main/res/value/strings.xml
   src/main/res/value-fr/strings.xml
   src/main/res/value-es/strings.xml

Then the result should be the same string.xml files in the same folder structure - but relocated into a new folder without the rest of the project.

Is there any known / existing way to manipulate complex projects and their strings.xml files, or do I have to write my own script from scratch?


Solution

  • I ended up using a slightly modified version of https://github.com/TomasKypta/android-lang-tool to work with a single Android module,

    And then writing a convenience Python script to run this on multiple known modules in my big project and setting the input/output paths accordingly (hard coded paths according to my modules), so I get the whole project's string XLS files exported for translation and easy to import back.

    This is extremely useful and I get to track which strings don't have a translation in a certain language in a way that translators can work with (without having to make them install Android Studio...), still lacking some version control for strings when something gets modified / the translation is still old.