Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for translating .ipynb (Jupyter Notebook) files #51

Open
2 tasks done
skytin1004 opened this issue Oct 20, 2024 · 0 comments
Open
2 tasks done

Support for translating .ipynb (Jupyter Notebook) files #51

skytin1004 opened this issue Oct 20, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@skytin1004
Copy link
Collaborator

Describe the feature you'd like

Currently, Co-op Translator supports translation of Markdown files and text within images. We propose adding support for translating Jupyter Notebook (.ipynb) files, specifically targeting Markdown and text content within the notebook while preserving code blocks.

Problem this feature solves

Many educational and research projects rely heavily on Jupyter Notebooks for documentation and tutorials. Translating these files will allow projects to reach a broader audience, especially in academic and open-source communities.

Alternatives considered

No response

Additional context

Proposed Implementation

  1. Parsing .ipynb Files:

    • Jupyter Notebooks are JSON files. We can parse the JSON structure to extract the content from markdown cells while ignoring code cells.
  2. Translating Markdown Cells:

    • After extracting text from markdown cells, the translation can proceed similarly to how Co-op Translator handles .md files.
  3. Handling Embedded Images:

    • If the notebook contains embedded images, the existing image translation functionality can be reused to extract and translate text from images.
  4. Rebuilding the Notebook:

    • Once the translation is complete, the translated text can be reinserted into the notebook, preserving the original structure and code cells.

Example Workflow

  1. Parse .ipynb file and extract text from markdown cells.
  2. Translate the extracted text using the Co-op Translator's translation engine (Azure OpenAI).
  3. Reinsert the translated text back into the notebook.
  4. Save the translated notebook in the appropriate language folder.

Please feel free to provide feedback or suggest additional features related to this request!

Are you willing to submit a pull request to implement this feature?

  • I am willing to submit a pull request

Code of Conduct

  • I agree to follow this project's Code of Conduct
@skytin1004 skytin1004 added the enhancement New feature or request label Oct 20, 2024
@skytin1004 skytin1004 self-assigned this Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant