Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pwittchen/android-resource-converter

Scripts converting Android *.xml resources with translations to *.csv file and backwards
https://github.com/pwittchen/android-resource-converter

android converter csv python resource xml

Last synced: 2 months ago
JSON representation

Scripts converting Android *.xml resources with translations to *.csv file and backwards

Awesome Lists containing this project

README

        

# 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

```txt
$ ./xml2csv.py
```
**Example**
```txt
$ ./xml2csv.py resources
```

**Sample output**

`translations.csv`

```txt
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

```txt
$ ./csv2xml.py .csv
```
**Example**
```txt
$ ./csv2xml.py translations.csv
```

**Sample output**

`strings_english.xml`

```xml

Hello World!
My application

```

`strings_polish.xml`

```xml

Witaj Świecie!
Moja aplikacja

```

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