LiewJunTung / Android-strings-xml-csv-converter

Convert Android translatable strings.xml into csv and back
MIT License
124 stars 32 forks source link

CSV to XML conversion may fail with a success message #2

Closed AAverin closed 9 years ago

AAverin commented 9 years ago

I see no content being generated in my XML files even though I get a Success message.

AAverin commented 9 years ago

Actually it fails all the time a doesn't provide any hints on why.

LiewJunTung commented 9 years ago

Hello AAverin, thanks for the feedback. I have fixed the get error message. For the error you encounter, I assumed that you are using Google Spreadsheet. Google Speadsheet automatically remove the space " " when you convert CSV to Google Spreadsheet format. So you have to make sure you got a space " " or "null" in the data you want it to be left alone while avoiding such errors.

727c395

AAverin commented 9 years ago

Do I need to add spaces manually or there is some kind of settings on Google Spreadsheet? Also, why should I have spaces or null if there is no value in the column?

LiewJunTung commented 9 years ago

it's the way with Groovy's XmlParser works. If you have a empty value in the CSV like this ,, It will skip this part and whatever that's inside is not added to an array I used to store value. It is very dependant on exact length of every single arrays. So whichever arrays that are not in sync with the other arrays will result in wrong data or ArrayOutOfBoundException. So I use null or space as temporary measures.

I'm not sure if there are any settings that replace empty value in GSpreadsheet. Perhaps I should use null instead of space in the generated csv. So yeah, you should put in the spaces or null manually.