Clone wiki

Form Translator / Home


I wrote this Add-On for my sister because in her job she has sometimes to stupidly copy translated texts into forms that are already filled with the original texts. Because she already gets a translation table in .xls/.ods form now, all she needs to do is to save it as .csv and load it with my plugin. :)

My motto is: Work that is so stupid that you can teach a computer how to do it you should never do manually.

I guess this Add-On might not be of use to anyone else.

JavaScript CSV Library

However, something that might be of worth to someone else is the JavaScript CSV library I wrote for this Add-On. I'm not sure if this is a 100% correct CSV implementation but I managed to read a few test CSV files I created using See: lib/csv.js


Refactor the Jetpack module somehow so that it resides inside CSV and then you can do this:

var csv = 'foo,bar,"\nbaz\n",egg\nbacon and spam,"tomato and ""spam""",""""';
var data = CSV.parse(csv);

alert(csv == CSV.stringify(data));

You can not only pass a string but also a Jetpack TextReader or an object that supports this interface:

	eof:  function () -> boolean
	next: function () -> string of length 1 or empty string on eof
	peek: function () -> string of length 1 or empty string on eof
	mark: function () -> start recording of read characters
	getmarked: function () -> return recorded characters as string and clear recording