multi language blog quarto with babelquarto

Author

Tony Duan

Published

July 3, 2025

install package

pak::pak("ropensci-review-tools/babelquarto")

load package

library(babelquarto)

set main language

register_main_language(
  main_language = "en",
  project_path = website_dir
)

add new language

register_further_languages(c("cn"), website_dir)

add new language qmd

file name example:for example “index.cn.qmd”

using LLM to create new lanuage qmd file

“translate all qmd to chinese and write to new qmd file.file name example index.cn.qmd ellmer.cn.qmd and so on” in gemini

render all document

we need to render the .qmd files to HTML. If you are used to using Quarto, you may expect to do this with quarto render or quarto preview, but those do not work with babelquarto.

Instead, we use babelquarto::render_website().

babelquarto::render_website()

view

Now we’d like to view the rendered website in a browser. Once again, quarto preview cannot be used here. Instead, use servr::httw().

servr::httw(path(website_dir, "doc"))

Reference

https://github.com/joelnitta/example-babelquarto

https://joelnitta.com/posts/2024-12-06_babelquarto/

https://docs.ropensci.org/babelquarto/