carpentries / glosario-r

glosario create and retrieve multilingual glossaries.
https://carpentries.github.io/glosario-r
Other
6 stars 5 forks source link

Document how to set the language used by glosario in Rmd document headers #14

Open beatrizmilz opened 3 years ago

beatrizmilz commented 3 years ago

The function gdef() generates the link to the term in glosario in the page in english. For example:

`r glosario::gdef('tidyverse', 'tidyverse')`

The link created is: https://carpentries.github.io/glosario/en/#tidyverse

Can we have an argument lang , so the function could create a link to pages in other languages?

Reference of the function: https://carpentries.github.io/glosario-r/reference/gdef.html

Thank you!

fmichonneau commented 3 years ago

Hi @beatrizmilz,

The documentation needs to be improved here. For now, this function reads the metadata from the Rmarkdown file hearder to select the language.

so if your RMarkdown document has:

---
glosario:
   language: 'pt'
---

in its header, the definitions will be displayed in Portuguese.

That being said, having a per-definition language selector might also be helpful.

beatrizmilz commented 3 years ago

It worked! Thank you so much @fmichonneau !

If that's ok, I can try to make a PR and add this information on documentation. This is the file, right? https://github.com/carpentries/glosario-r/blob/master/R/gdef.R

fmichonneau commented 3 years ago

Yes, this is the right file. That would be very useful. Thank you!