FooSoft / yomichan

Japanese pop-up dictionary extension for Chrome and Firefox.
https://foosoft.net/projects/yomichan
Other
1.07k stars 229 forks source link

Imported dictionary XML export and import function #681

Open 511141 opened 4 years ago

511141 commented 4 years ago

@toasted-nutbread Is it possible to add an XML export (And subsequently import) function for quick modifications the dictionaries already imported? I see you have it all here: https://github.com/FooSoft/yomichan/blob/d7aaab685ee23ebcd60b69211b02f6a66f57fa17/ext/bg/js/dictionary-importer.js

toasted-nutbread commented 4 years ago

Sure it's possible, but it may not be optimal.

511141 commented 4 years ago
  • XML is likely not the best data format for it. The data is already structured as JSON, so that would be better. What is your use case for XML? Could JSON be used?

To open up in a spreadsheet program for ease of data manipulation. Whilst you can modify the JSON files, would the average user be able to do this?

  • The dictionary files themselves can be extracted to view the raw JSON data already, if that's useful to you.

What's the difference between extracting them from the app and the JSON files before importing into the app?

FooSoft commented 4 years ago

As @toasted-nutbread mentioned, you can already open the dictionary ZIP files and update the JSON data inside of them to your heart's content; there would not be any value in exporting previously imported dictionaries into Yomichan. The difference in doing this before and after import is that you can already do the former, and the latter would require a non-trivial amount of code to be written for the same result.

The JSON files are text, exactly like the XML format is. I don't think you would be able to open the dictionary data in a spreadsheet application, even if it were in XML format unless you converted it to some sort of tabular representation first... Which would also probably make most sense to do pre-import.