Imperial-EE-Microsoft / co_op_translator

Easily automate multilingual translations for your projects with co_op_translator, powered by advanced LLM technology.
https://techcommunity.microsoft.com/t5/educator-developer-blog/localizing-github-repositories-with-llms/ba-p/4216434
MIT License
1 stars 2 forks source link

Optimize translation process with task batching and flexible CLI modes #22

Closed skytin1004 closed 2 months ago

skytin1004 commented 2 months ago

Improved Resilience in Translation Process

(Solved #21)

Example:

# Resuming from where the process left off after an interruption:
translate -add -l "ko"

Batch image and markdown translation tasks in groups of 5 for efficient async processing.

Update progress bar in real-time using tqdm_asyncio.gather for both images and markdown files.

Here is an example:

(.venv) C:\Users\sms79\dev\co_op_translator\src\co_op_translator\test_repo>poetry run translate -l "es" -u
Warning: The update command will delete all existing translations for 'es' and re-translate everything.
Do you want to continue? Type 'yes' to proceed: yes
Proceeding with update...
Translating remaining images: 100%|████████████████████████████████████████████| 3/3 [00:46<00:00, 15.55s/it]
Translating remaining markdown files: 100%|███████████████████████████████████| 1/1 [02:05<00:00, 125.62s/it]

Ensure proper handling of translated files and skipping existing translations when using --add mode.

Added CLI support for modes: --add, --update, --images, --markdown.

Example Commands

Here are some example commands to demonstrate how the CLI modes can be used:


# Adds a new translation in Spanish without deleting existing translations
translate -l 'es' --add

# Updates only French markdown files by deleting and re-translating
translate -l 'fr' --update --markdown

# Adds a new translation for Korean images only
translate -l 'ko' --images
skytin1004 commented 2 months ago

I have reviewed the changes and everything looks good.