A guide as a Quarto book;
Interest in using DeepL API;
Use of Git and GitHub to collaborate.
How to publish a multilingual Quarto book;
How to use DeepL API to translate Markdown.
First we made sure that it would not be native to Quarto very soon: https://github.com/quarto-dev/quarto-cli/issues/275
Each chapter: filepath.qmd
and filepath.es.qmd
.
babelquarto::register_main_language("en")
babelquarto::register_further_languages(c("es", "pt"))
babelquarto::render_book()
_quarto.yml
With the help of babelquarto::register_
,
Build the two sites.
Add links with {xml2} XPath to modify HTML.
Translating Markdown from scratch? 😭
Copy and paste into DeepL or Google Translate? 😭
Use babeldown and then review by humans! 🎉
Respect the Markdown format.
Send text to the DeepL API.
Register with DeepL.
Hello World.
Sys.setenv(DEEPL_API_KEY = keyring::key_get("deepl"))
Sys.setenv("DEEPL_API_URL" = "https://api.deepl.com")
babeldown::deepl_translate_markdown_string(
"Je suis contente d'être à **Barcelone**",
source_lang = "fr",
target_lang = "en-us",
formality = "prefer_less"
)
[1] "I'm happy to be at **Barcelona**"
Better support of multilingual websites with babelquarto;
Use of git diff with babeldown.
babelquarto https://docs.ropensci.org/babelquarto/
babeldown https://docs.ropensci.org/babeldown/
Our workflow with Git, GitHub and babeldown https://ropensci.org/blog/2023/09/26/how-to-translate-a-hugo-blog-post-with-babeldown/