View source: R/utils-translate.R
fill_translation_vars | R Documentation |
Apply template items to translated strings
fill_translation_vars(the_data)
the_data |
a list of global variables (either |
There are two kinds of templating we use:
variable templating indicated by {key}
where key
represents a
variable that exists within the global data and is replaced.
link templating indicated by <(text to wrap)>
where we replace the
<()>
with a known URL or HTML markup. This allows the translators to
translate text without having to worry about HTML markup.
the translated list with templated data filled out
dat <- list(
a = "a barn",
b = "a bee",
minutes = 5,
translate = list(
one = "a normal translated string (pretend it's translated from another language)",
two = "a question: are you (A) {a}, (B) {b}",
EstimatedTime = "Estimated time: {icons$clock} {minutes}",
license = "Licensed under {license} by the authors",
ThisLessonCoC = "This lesson operates under our <(Code of Conduct)>"
)
)
asNamespace("sandpaper")$fill_translation_vars(dat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.