Title: | Renders a Multilingual Quarto Book |
---|---|
Description: | Automate rendering and cross-linking of Quarto books following a prescribed structure. |
Authors: | Maëlle Salmon [cre, aut] , Johannes Ranke [ctb], Joel H. Nitta [ctb] , Pascal Burkhard [aut] |
Maintainer: | Maëlle Salmon <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9000 |
Built: | 2024-12-19 06:30:34 UTC |
Source: | https://github.com/ropensci-review-tools/babelquarto |
Create a starter/example quarto multilingual book or website
quarto_multilingual_book( parent_dir, project_dir, main_language = "en", further_languages = c("es", "fr"), register_languages = TRUE, site_url = "https://example.com", placement = c("sidebar", "navbar") ) quarto_multilingual_website( parent_dir, project_dir, main_language = "en", further_languages = c("es", "fr"), register_languages = TRUE, site_url = "https://example.com", placement = c("navbar", "sidebar") )
quarto_multilingual_book( parent_dir, project_dir, main_language = "en", further_languages = c("es", "fr"), register_languages = TRUE, site_url = "https://example.com", placement = c("sidebar", "navbar") ) quarto_multilingual_website( parent_dir, project_dir, main_language = "en", further_languages = c("es", "fr"), register_languages = TRUE, site_url = "https://example.com", placement = c("navbar", "sidebar") )
parent_dir |
Folder where to create the project folder. |
project_dir |
Project (book, website) folder name. |
main_language |
Code for main languages. |
further_languages |
Codes for not main languages. |
register_languages |
Whether to register languages (logical). |
site_url |
Site URL for the book/site-url or website/site-url part of the Quarto configuration. |
placement |
Where to place the language links (sidebar, navbar). |
The path to the created project.
Register further languages in Quarto config
register_further_languages(further_languages, project_path = ".")
register_further_languages(further_languages, project_path = ".")
further_languages |
Languages to be registered (character vector) |
project_path |
Path where the book/website source is located |
Nothing
Register main language in Quarto config
register_main_language(main_language = "en", project_path = ".")
register_main_language(main_language = "en", project_path = ".")
main_language |
Main language code (character, like |
project_path |
Path where the book/website source is located |
Nothing
Render a Quarto multilingual project
render_book(project_path = ".", site_url = NULL, profile = NULL) render_website(project_path = ".", site_url = NULL, profile = NULL)
render_book(project_path = ".", site_url = NULL, profile = NULL) render_website(project_path = ".", site_url = NULL, profile = NULL)
project_path |
Path where the book/website source is located |
site_url |
Base URL of the book/website. |
profile |
Quarto profile(s) to use. |
babelquarto expects a book/website folder with each qmd/Rmd present in as many languages as needed, with the same basename but,
once with only .qmd
as extension for the main language,
once with .es.qmd
(using the language code) for each other language.
You also need to register the language in the configuration file,
see register_main_language()
and register_further_languages()
:
babelquarto: mainlanguage: 'en' languages: ['es', 'fr']
directory <- withr::local_tempdir() quarto_multilingual_book(parent_dir = directory, project_dir = "blop") render_book(file.path(directory, "blop")) ## Not run: if (require("servr") && rlang::is_interactive()) { servr::httw(file.path(directory, "blop", "_book")) } ## End(Not run)
directory <- withr::local_tempdir() quarto_multilingual_book(parent_dir = directory, project_dir = "blop") render_book(file.path(directory, "blop")) ## Not run: if (require("servr") && rlang::is_interactive()) { servr::httw(file.path(directory, "blop", "_book")) } ## End(Not run)