carpentries / varnish

Template for pkgdown site
https://carpentries.github.io/varnish/
Other
7 stars 25 forks source link

Add l10n support #105

Closed zkamvar closed 9 months ago

zkamvar commented 9 months ago

This is to be paired with carpentries/sandpaper#546.

NOTE: this should be released after carpentries/sandpaper#546

This replaces bare text elements with {{ translate.Key }} where translate.Key is a keyword written in PascalCase to the translation variable in {sandpaper}

For example, the words "Instructor Notes" have the key {{ translate.InstructorNotes }} because the data for the mustache template will contain a list called "translate", which will contain an item called "InstructorNotes" containing the translation for "Instructor Notes":

dat <- list(
  translate = list(
    InstructorNotes = tr_("Instructor Notes")
  )
)

We are assuming that these elements will be available, which is why we do not test for them.

There are some elements that contain HTML and are escaped (e.g. {{& translate.EstimatedTime }}.

zkamvar commented 9 months ago

The sandpaper PR has been merged, so I will now merge this.