inSileco / inSileco.github.io

:globe_with_meridians: Our blog powered by blogdown
https://blog.insileco.io/
GNU General Public License v3.0
8 stars 1 forks source link

Support 2 or more languages #4

Closed KevCaz closed 3 years ago

KevCaz commented 7 years ago

We all are french speaker (and we have a Brasilian guy on board), so I think it makes sense that some sections of our common website become bilingual. We have discussed about it today with @david-beauchesne who, by the way, needs such feature for another website. Note that @ahasverus has already done such thing for his web page; the site of YinHui Xie (the creator of the knitr package), which likely uses Rmarkdown, supports such feature.

I guess I can do something using a JS script and there are likely a bunch of solutions available on line. So if you think about a good strategy, please comment below!!

KevCaz commented 7 years ago

Commit d59a13419b33085b8b6a44b54e602f848a20b234 introduces a R script that uses the slclang field in the yaml-header of a web page to add flags as selectors to the desired langages (and a custom js script to select langage just as @ahasverus did). Currently, it works only under the following conditions:

Let's give a minimal working example of a .Rmd file that should be convert into a bilingual webpage:

 ---
 title: "Your page"
slclang:
  - us
  - fr
 ---

 ```{r, echo=FALSE, results="asis", message=FALSE}
      source("Rscripts/slcLang.R")
     slcLang("index.Rmd") 
 ```

### Section US {lang=us}

### Section FR {lang=fr}

There are currently a couple of drawbacks. For instance, if the field title of yaml-header is used, the title won't be multi-lingual.

KevCaz commented 3 years ago

No need for this, hugo supports this https://gohugo.io/content-management/multilingual/ the main issue being doing the translation!!!