Giter Club home page Giter Club logo

android-resource-converter's Introduction

Android Resource Converter

Simple Python scripts converting Android xml resources with translations to csv file and backwards

Motivation

In international projects sometimes there's a need to send resource files to the client in order to have translated strings. Client doesn't have to understand XML notation and editing two or more files at the same time is inconvenient. It's easier to send file which can be edited in MS Excel or Libre Office Calc.

Scripts in this repository are able to convert Android xml resources to a single *.csv file ready to open in software for common users. In addition, there's another script, which can generate xml resource files from *.csv file. Scripts were tested on Linux (Ubuntu 14.04 LTS)

Requirements

To satisfy requirements, run the following command:

$ pip install -r requirements.txt

Usage

Generating *.csv file

$ ./xml2csv.py <directory_with_xml_files>

Example

$ ./xml2csv.py resources

Sample output

translations.csv

key strings_english.xml strings_polish.xml
hello_world Hello World!    Witaj Świecie!
app_name    My application  Moja aplikacja

Note: These "space" delimiters are fine and can be modified in the script. Nevertheless, Libre Office Calc reads it properly.

Generating *.xml files

$ ./csv2xml.py <file_with_translations>.csv

Example

$ ./csv2xml.py translations.csv

Sample output

strings_english.xml

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<resources>
  <string name="hello_world">Hello World!</string>
  <string name="app_name">My application</string>
</resources>

strings_polish.xml

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<resources>
  <string name="hello_world">Witaj Świecie!</string>
  <string name="app_name">Moja aplikacja</string>
</resources>

Caveats

  • Scripts may bahave differently on MS Windows system and may need some adjustments
  • Output of the scripts may be different on MS Windows system and may need some adjustments

android-resource-converter's People

Contributors

hadilq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

android-resource-converter's Issues

translations.csv file not delimted

I tried running the xml2csv command and the translation file it creates does not look like a proper csv file in LibreOffice. The columns are not being generated properly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.