WittmannF / jupyter-translate

Library for translating jupyter notebook (.ipynb) files
https://pypi.org/project/jupyter-translate/
MIT License
28 stars 17 forks source link

some problems with jupyter notebooks and with quarto jupyter notebooks #14

Open Schildkroetenprogrammierer opened 1 month ago

Schildkroetenprogrammierer commented 1 month ago

Great tool! I works very good, but I see the following problems:

  1. nested lists lose their nestedness (cell 16). The indentation should be preserved.
  2. horizontal line throw an error (cell 17)
  3. Embedded code throws errors (cell 24), but this can be solved by adding '''(code) '''
  4. \begin{equation} is translated, which does not work (cell 26), "$$" is replaced by \begin{equation} and is no workaround.
  5. Markup tables throw an error (cell 28), presumably of ------- for the horizontal line?
  6. Converting a quarto-jupternotebook with jupyter-translate runs very good. But: If you have a figure you write:
    #| label: fig-polar
    #| fig-cap: "A line plot on a polar axis"

    Unfortnualtelly the command label and the figure reference fig-polar are translated, which should be prevented. The figure caption "A line plot on a polar axis" is translated, which is good. Perhaps a user defined list of words(=commands) which should not be transleted would be possible.

Schildkroetenprogrammierer commented 1 month ago

The cell numbers of my post above refer to the given file "test_Notebook_en.ipynb" of your repository.

  1. --mymemory doesn't work: Using jupyter_translate test_Notebook_en.ipynb --target pt --translator='mymemory' leads to "ValueError: Translator 'mymemory' not supported."
  2. Could DeepL (with API-Key) be provided as an engine?
WittmannF commented 1 month ago

Hi! Thanks for the suggestions! We are currently low in bandwidth for updating the tool. In the meantime, can you check if the legacy version fixes any of those issues?

Schildkroetenprogrammierer commented 1 month ago

legacy version (in the folder lecacy) has the same errors. For point 7 I found a solution, the readme-file could be adjusted. The right command for mymemory is: jupyter_translate test_Notebook_en_ipynb --target pt-PT --translator=mymemory --source en-GB