i18n {datamods} | R Documentation |
Internationalization
Description
Simple mechanism to translate labels in a Shiny application.
Usage
i18n(x, translations = i18n_translations())
i18n_translations(package = packageName(parent.frame(2)))
set_i18n(value, packages = c("datamods", "esquisse"))
Arguments
x |
Label to translate. |
translations |
Either a |
package |
Name of the package where the function is called, use |
value |
Value to set for translation. Can be:
|
packages |
Name of packages for which to set i18n, default to esquisse and datamods |
Value
i18n()
returns a character
, i18n_translations()
returns a list
or a data.frame
.
Examples
library(datamods)
# Use with an objet
my.translations <- list(
"Hello" = "Bonjour"
)
i18n("Hello", my.translations)
# Use with options()
options("i18n" = list(
"Hello" = "Bonjour"
))
i18n("Hello")
# With a package
options("datamods.i18n" = "fr")
i18n("Browse...", translations = i18n_translations("datamods"))
# If you call i18n() from within a function of your package
# you don't need second argument, e.g.:
# i18n("Browse...")