Examples¶
These examples use the real CLI and Python API entry points from this repository.
Translate Markdown with the CLI¶
This translates Markdown files only and writes output under:
Translate notebooks only¶
Notebook links can later be normalized with:
Translate images only¶
Image translation requires both an LLM provider and Azure AI Vision.
Preview without writing files¶
Dry runs are useful when checking token estimates, migration plans, or CI wiring.
Repair low-confidence translations¶
First evaluate translations:
Then retranslate Markdown files below the threshold:
Run from Python¶
from co_op_translator.api import run_translation
run_translation(
language_codes="ko ja",
root_dir="./course",
markdown=True,
yes=True,
)
Translate multiple roots from Python¶
from co_op_translator.api import run_translation
run_translation(
language_codes="ko",
markdown=True,
root_dirs=[
"./docs",
"./labs",
],
)
Use explicit output groups¶
from co_op_translator.api import run_translation
run_translation(
language_codes="ja",
markdown=True,
groups=[
("./course-a", "./localized/course-a"),
("./course-b", "./localized/course-b"),
],
)
Preserve glossary terms¶
from co_op_translator.api import run_translation
run_translation(
language_codes="fr",
markdown=True,
glossaries=[
"Co-op Translator",
"Azure AI Foundry",
"GitHub Actions",
],
)
Glossary terms are scoped to the API call and restored afterward.
CI-friendly translation command¶
This auto-confirms prompts and saves DEBUG-level logs under logs/.