Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translated vignette proposal : all pages link back to EN root vignette #6613

Open
ChristianWia opened this issue Nov 12, 2024 · 4 comments
Open
Labels
documentation translation issues/PRs related to message translation projects

Comments

@ChristianWia
Copy link

ChristianWia commented Nov 12, 2024

The EN vignette holds links towards translated pages (for example https://rdatatable.gitlab.io/data.table/articles/datatable-intro.html leads to FR transltion in -> https://rdatatable.gitlab.io/data.table/articles/fr/datatable-intro.html

In the translated page, there is no longer useful to reference the page itself, nor all other existing translations (for page maintenance reasons when new language is added)

So my proposal would be that all translated pages display the same equivalent of :

Translations of this document is available in

English

@rikivillalba
Copy link
Contributor

rikivillalba commented Nov 13, 2024

Some chunk could be provided that generate the link list, provided the corresponding files and directories exist
I.e.

```{r echo = FALSE}
  url = "https://rdatatable.gitlab.io/data.table/articles"
  path = dirname(knitr::current_input(TRUE))
  if (basename(path) == "vignettes") {
    lang = "en"
  } else {
    lang = basename(path)
    path = dirname(path)
  }

  translation = dir(path,
    recursive = TRUE,
    pattern = glob2rx(knitr::current_input(FALSE))
  )
  transl_lang = ifelse(dirname(translation) == ".", "en", dirname(translation))

  block = sprintf("%s\n", paste(sprintf(
    " [%s](%s) ",
    transl_lang[transl_lang != lang],
    file.path(url, sub("(?i)\\.Rmd$", ".html", translation[transl_lang != lang]))
  )))

  knitr::asis_output(block)
``` #

@rikivillalba
Copy link
Contributor

Relevant: #6455

@rikivillalba rikivillalba added documentation translation issues/PRs related to message translation projects labels Nov 13, 2024
@tdhock
Copy link
Member

tdhock commented Nov 14, 2024

the idea of automatically generated links between languages is interesting, but where would you put that code? (to avoid duplicated logic in each vignette)

@rikivillalba
Copy link
Contributor

#6618 is my proposal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation translation issues/PRs related to message translation projects
Projects
None yet
Development

No branches or pull requests

3 participants