ropensci-review-tools / babelquarto

Renders a Multilingual Quarto Project (Book or Website)
https://docs.ropensci.org/babelquarto/
Other
40 stars 7 forks source link

Using quarto profile leads to language version not being able to rendered #37

Closed ntluong95 closed 4 months ago

ntluong95 commented 7 months ago

Currently, in order to render only few chapters of the book for testing purpose, I need to comment on chapters in _quarto.yml file. It might not be the optimal way, as you may want to have different profiles that tweak specifically just some params in the config file. The solution is using quarto PROJECT profile. However, babelquarto::render_book() doesn't render language chapters although it tries to loop through languages vector (instead of index.fr.qmd, it renders index.qmd again). So I guess there was something wrong when it tries to catch the language params? Here is the content of _quarto.yml file

project:
  type: book
  output-dir: html_outputs

profile:
   default: small
   group: 
     - [full, small]

babelquarto:
  languagecodes:
  - name: vn
    text: "Tiếng Việt"
  - name: fr
    text: "Français"
  - name: es
    text: "Español"
  - name: jp
    text: "日本"
  - name: tr
    text: "Türkçe"
  - name: pt
    text: "Português"
  - name: ru
    text: "Русский"
  - name: de
    text: "Deutsch"
  - name: en
    text: "English"

  mainlanguage: 'en'
  languages: ['fr','es', 'vn', 'jp', 'pt', 'tr', 'ru']    

title-vn: Cẩm nang dịch tễ học với R
title-fr: Le Epi R Handbook
title-es: EpiRhandbook en español
title-jp: 疫学のための R ハンドブック
title-tr: Epidemiyologun R Rehberi
title-pt: Manual de R para Epidemiologistas
title-ru: Справочник эпидемиолога R
title-de: EpiRhandbook auf Deutsch
lang: en

format:
  html: 
    include-in-header:
      - banner.html
    theme:
      light: cosmo
      dark: [cosmo, theme-dark.scss]

and in _quarto-small.yml, I specify chapters I want to render

book:
  title: "The Epidemiologist R Handbook"
  search: 
    type: textbox

  sharing: ["twitter", "facebook", "linkedin"]
  sidebar:
        logo: "images/Applied_Epi_logo.png"
        tools:
                - icon: twitter
                  href: "https://twitter.com/appliedepi"
                - icon: linkedin
                  href: "https://www.linkedin.com/company/appliedepi/"
                # - icon: github
                #   menu:
                #         - text: Source Code
                #           url: "https://github.com/appliedepi/epihandbook_quarto"
                #         - text: Report a Bug
                #           url: "https://github.com/appliedepi/epihandbook_quarto/issues/new"

  date: today
  date-format: "MMM D, YYYY"
  favicon: "images/Applied_Epi_logo.png"

  chapters:
  # INTRO & CONTRIBUTORS
  - index.qmd                              # objectives, how to read, authors, acknowledgements

  # ABOUT BOOK
  - part: "About this book"
    part-vn: "Về cuốn sách này"
    part-fr: "À propos de ce livre"
    part-es: "Acerca de este libro"
    part-jp: "本書について"
    part-tr: "Bu kitap hakkında"
    part-pt: "Sobre este livro"
    part-ru: "Об этой книге"
    part-de: "Über dieses Buch"
    chapters:
    - new_pages/editorial_style.qmd          # editorial style
    - new_pages/data_used.qmd                # data used
maelle commented 6 months ago

Indeed, at the moment babelquarto does not merge the configuration files from different profiles.

maelle commented 4 months ago

I'm working on a PR adding support for profiles but for the languages only.

To experiment, I recommend creating minimal books using babelquarto::quarto_multilingual_book() for instance.

I am closing this issue in order to keep my focus on the priorities, but I do appreciate your contributions and reports. :pray: