Recipe: Pipe Combinations
yaku reads from stdin and writes to stdout, making it a natural fit for Unix pipelines.
Translate a PDF
Section titled “Translate a PDF”Use markitdown to extract text from PDFs, then translate:
markitdown report.pdf | yaku --to en --format mdTranslate a web page
Section titled “Translate a web page”Use curl to fetch a page and translate its content:
curl -s https://example.com | yaku --to enFor Markdown content:
curl -s https://raw.githubusercontent.com/user/repo/main/README.md | \ yaku --to en --format mdTranslate GitHub issues
Section titled “Translate GitHub issues”Use the GitHub CLI to fetch and translate issues:
# Translate an issue bodygh issue view 123 --json body -q .body | yaku --to en
# Translate all comments on an issuegh api repos/owner/repo/issues/123/comments \ --jq '.[].body' | yaku --to enTranslate API responses
Section titled “Translate API responses”# Translate JSON API responsecurl -s https://api.example.com/products | yaku --to en --format json
# Translate and pipe to jq for formattingcurl -s https://api.example.com/data | \ yaku --to en --format json | jq '.'Translate clipboard content
Section titled “Translate clipboard content”# macOS: translate clipboard and replacepbpaste | yaku --to en | pbcopy
# Linux (xclip)xclip -selection clipboard -o | yaku --to en | xclip -selection clipboardTranslate and write to file
Section titled “Translate and write to file”# Using -o flagecho "Bonjour" | yaku --to en -o greeting.txt
# Using shell redirectionecho "Bonjour" | yaku --to en > greeting.txt
# Translate multiple files with a loopfor f in docs/ja/*.md; do yaku --to en -f "$f" -o "docs/en/$(basename "$f")"doneTranslate man pages
Section titled “Translate man pages”man ls | col -b | yaku --to en | lesscol -b strips formatting codes from man page output.
Chain with text processing
Section titled “Chain with text processing”# Translate only the first 100 lineshead -100 large-doc.md | yaku --to en --format md
# Translate, then count wordsyaku --to en -f article.ja.md | wc -w
# Extract strings from code, translategrep -Eo '"[^"]*"' src/strings.go | yaku --to en- Use
--formatwhen piping. Without a file extension to detect, yaku defaults to plain text. Set--format md,--format json, or--format yamlexplicitly. - Filter before translating. Use
head,tail, orgrepto reduce input size. This saves tokens and time. - Use
-oinstead of>for file output. The-oflag prints a confirmation message to stderr, making it clearer that the file was written.