Co-op Translator na command-line interface (CLI) tool wey go help you translate markdown and image files for your project go plenty languages. Dis section go explain how you fit use di tool, di different CLI options wey e get, and e go show you examples for different use cases.
[!NOTE] For full list of commands and wetin dem mean, abeg check di Command reference.
Here be some common ways wey you fit use Co-op Translator, plus di correct commands to run.
If you wan translate your whole project (markdown files and images) go one language, like Korean, use dis command:
translate -l "ko"
Dis command go translate all markdown and image files go Korean, e go add new translations but e no go delete di ones wey dey already.
[!TIP]
You wan know di language codes wey dey available for Co-op Translator? Check di Supported Languages section for di repository for more gist.
For Phi-3 CookBook, I use dis method to add di Korean translation for di markdown files and images wey dey already.
(.venv) C:\Users\sms79\dev\Phi-3CookBook>translate -l"ko"
Translating images: 100%|███████████████████████████████████████████████████| 276/276 [1:09:56<00:00, 15.37s/it]
Translating markdown files: 100%|████████████████████████████████████████████████| 153/153 [1:43:07<00:00, 241.31s/it]
If you wan translate your project go plenty languages (e.g., Spanish, French, and German), use dis command:
translate -l "es fr de"
Dis command go translate di project go Spanish, French, and German, e go add new translations but e no go touch di ones wey dey already.
For Phi-3 CookBook, after I pull di latest changes to reflect di most recent commits, I use dis method to translate di new markdown files and images wey I add.
(.venv) C:\Users\sms79\dev\Phi-3CookBook>translate -l"ko ja zh tw es fr" -a
Translating images: 100%|███████████████████████████████████████████████████| 273/273 [1:09:56<00:00, 15.37s/it]
Translating markdown files: 100%|████████████████████████████████████████████████| 6/6 [24:07<00:00, 241.31s/it]
[!NOTE] Normally, e good make you dey translate one language at a time, but for cases like dis wey you wan add specific changes, translating plenty languages at once fit make sense.
If you wan update di translations wey dey already (e.g., delete di ones wey dey and replace dem with new ones), use di -u option. Dis one go delete all di translations wey dey for di languages wey you choose and re-translate dem.
translate -l "ko" -u
Warning: Dis command go ask you to confirm before e go delete di translations wey dey already.
For Phi-3 CookBook, I use dis method to update all di Spanish translated files. I go advise make you use dis method if di original content don change well well for plenty markdown documents. But if na only small files you wan update, e better make you delete dem manually and use di -a method to add di updated translations.
(.venv) C:\Users\sms79\dev\Phi-3CookBook>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 images: 100%|████████████████████████████████████████████| 150/150 [43:46<00:00, 15.55s/it]
Translating markdown files: 100%|███████████████████████████████████| 95/95 [1:40:27<00:00, 125.62s/it]
If na only di image files for your project you wan translate, use di -img option:
translate -l "ko" -img
Dis command go translate only di images go Korean, e no go touch any markdown files.
If na only di markdown files for your project you wan translate, use di -md option:
translate -l "ko" -md
For Phi-3 CookBook, I use dis method to check for translation errors for di Korean files and e go automatically retry di translation for any file wey get problem.
(.venv) C:\Users\sms79\dev\Phi-3CookBook>translate -l"ko" -chk
Checking translated files for errors in ko...
Checking files for ko: 100%|██████████████████████████████████████████████████| 95/95 [00:01<00:00, 65.47file/s]
Retrying vsc-extension-quickstart.md for ko: 0%| | 0/17 [00:00<?, ?file/s]
Dis option dey check for translation errors. Right now, if di difference for line breaks between di original and di translated files pass six, di file go dey flagged as get translation error. I dey plan to improve dis check to make am more flexible for future.
For example, dis method dey useful to find missing parts or translations wey don spoil, and e go automatically retry di translation for di files.
But if you don already sabi di files wey get problem, e better make you delete dem manually and use di -a option to re-translate dem.
If you wan see detailed logging to troubleshoot, use di -d option:
translate -l "ko" -d
Dis command go run di translation for debug mode, e go show you extra logging info wey fit help you find di problem wey dey during di translation process.
For Phi-3 CookBook, I see one issue wey translations wey get plenty links for markdown files dey cause formatting errors, like broken translations and ignored line breaks. To find di problem, I use di -d option to see how di translation process dey work.
(.venv) C:\Users\sms79\dev\Phi-3CookBook>translate -l "ko" -d
DEBUG:openai._base_client:Request options: {'method': 'post', 'url': '/chat/completions', 'headers': {'api-key': 'af04e0bea45747d8a7b8c131c1971044'}, 'files': None, 'json_data': {'messages': [{'role': 'user', 'content': "Translate the following text to ko. NEVER ADD ANY EXTRA CONTENT OUTSIDE THE TRANSLATION. TRANSLATE ONLY WHAT IS GIVEN TO YOU.. MAINTAIN MARKDOWN FORMAT\n\n# Phi-3 Cookbook: Hands-On Examples with Microsoft's Phi-3 Models [](https://codespaces.new/microsoft/phi-3cookbook) [
Translated files now dey automatically detect and clean up when source file don update.
But if you wan manually update translation - like if you wan redo one file or override di system behavior - you fit use dis command to delete all di versions of di file for di language folders.
For Windows:
- Using Command Prompt:
- Open Command Prompt.
- Go to di folder wey di files dey with di
cdcommand.- Use dis command to delete files:
del /s *filename*Replace
filenamewith di specific part of di file name wey you dey find. Di/soption go search subdirectories too.- Using PowerShell:
- Open PowerShell.
- Run dis command:
Get-ChildItem -Path "C:\YourPath" -Filter "*filename*" -Recurse | Remove-Item -ForceReplace
"C:\YourPath"with di folder path andfilenamewith di specific name.For macOS/Linux:
- Using Terminal:
- Open Terminal.
- Go to di directory with
cd.- Use di
findcommand:find . -type f -name "*filename*" -deleteReplace
filenamewith di specific name.Always check di files well before you delete am to avoid mistake.
Once you don delete di files wey you wan replace, just run your
translate -lcommand again to update di latest file changes.
Disclaimer:
Dis dokyument don use AI transleto service Co-op Translator do di translation. Even as we dey try make am correct, abeg sabi say machine translation fit get mistake or no dey accurate well. Di original dokyument wey dey for im native language na di main source wey you go trust. For important mata, e good make professional human transleto check am. We no go fit take blame for any misunderstanding or wrong interpretation wey fit happen because you use dis translation.