Am currently working on a rewrite of a LaTeX project into R Markdown, which has had some people interested in translating it to a multitude of languages.
The project is written in bookdown, but can't seem to find anything in the documentation pointing me in the right direction.
It will build the website and requisite files using Gitlab CI after someone makes a change. What is the best way to add other languages to the project?
You mean write one book with different languages ?
If so, there is no special mechanism to do that currently I think. You can fork the project and translate everything. bookdown will allow you to translate also some internal feature : see
Thank you very much cderv, had seen the internationalization page and should have mentioned it.
Am aware separate repositories is actually how the bookdown book does it. However, can see this getting messy. Is there any way to make a 'translations' folder in the project, then get the project to render a 'subproject' for each copy? Quite new to Rmd, so please forgive me on my limited terminology knowledge.
I believe you can have one github project to host two bookdown projects. However, the bookdown project won't share the same configuration file as currently the _bookdown.yml does handle only one language.
But you can have several file, and use config_file argument in render_book to change it according to the book you are writing.
I believe all that could be ochestrate in a Makefile, or a _render.R file that would execute when building the book from the IDE. This script coud contains the code to render both books - you just have to code the workflow in this main script.
So yes this is possible, but it would be TWO bookdown project, not one.
I would love to see this as a figure of bookdown @cderv. I don't suppose it would be too difficult to implement, but it would help a LOT of projects, and allow for more people to use Rmarkdown + bookdown to write books, not just reports. An icon at the top like the ones you already have that would serve for different language versions of the Rmd files would be absolutely fantastic! Can this please be considered?
Thank you. Yes sorry I didn't word that correctly. I am actually writing a book that I will self-publish with Rmarkdown and bookdown, and albeit non-fiction, it has nothing to do with R or programming or data-analysis in general. I think it's an amazing piece of software!
I could only find this, so I will create a feature request. Thanks
Managed to figure this out, albeit rather messily. For all those looking in future, a Makefile won't work since it won't detect that there are targets that still need to be built.
Got strange errors when attempting to change the output directory in the Rscript line.
Instead, created build.sh that does this instead (albeit somewhat messily).
# Build English version
Rscript -e "bookdown::render_book('index.Rmd', 'all')"
# Translation Example: Build Russian Version
mkdir -p _book/ru
cd translations/ru/
Rscript -e "bookdown::render_book('index.Rmd', 'all')"
cp -r _book/* ../../_book/ru/
Any suggestions are very welcome as just threw this together after literal hours of make frustration.