Utility to convert CSV data into Android and iOS string resource formats.
Prepare a CSV file with 1st column as comment
, 2nd one as untranslatable
, 3rd one as key
, and subsequent columns as locales e.g.
comment | untranslatable | key | en | es | it |
---|---|---|---|---|---|
comment_1 | false | welcome_text | welcome | bienvenidos | benvenuto |
comment_2 | true | bye_text | goodbye | adiós | arrivederci |
./gradlew run --args="-f path/to/your_file.csv -os {platform} -d {delimiter}"
Delimiter is default to comma ,
Example:
// Android
./gradlew run --args="-f src/main/resources/sample.csv -os android -d ;"
// iOS
./gradlew run --args="-f src/main/resources/test.csv -os ios -d ,"
// same as
./gradlew run --args="-f src/main/resources/test.csv -os ios"
- For Android:
Output result:
./gradlew run --args="-f src/main/resources/sample.csv -os android -d ;"
exported ├── values-en │ ├── strings.xml ├── values-de │ ├── strings.xml ├── values-vi │ ├── strings.xml
- For iOS:
Output result:
./gradlew run --args="-f src/main/resources/test.csv -os ios -d ,"
exported ├── en.lproj │ ├── Localizable.strings ├── de.lproj │ ├── Localizable.strings ├── vi.lproj │ ├── Localizable.strings
You can use this project as a starting point for further customization to meet your need.
Record.kt
: Model class to hold row dataReader.kt
: Reads data from.csv
file and returns a 2d array.Parser.kt
: Gets 2d array data as input and returns a list ofRecord
objectWriter.kt
: Writes to file for eachRecord
entry, based on format for a specific platform.Converter.kt
: PutRecord.kt
Reader.kt
Parser.kt
Writer.kt
all together for converting process.
- Better exception handling
- Build to command line binary
- Document