This Shiny module gets language that's currently selected in the language
selector. It needs to be used in the Server to save the currently active
(selected) language in a reactive. This reactive can then be passed to the
i_
function to translate the text.
langSelector(input, output, session, i18n = NULL, showSelector = TRUE)
i18n | List of language configurations; can only be set for
|
---|---|
showSelector | Boolean to specify if language selector should be displayed or not. Even if selector is not displayed, language can always be set by query parameter; default = "lang" |
String of language code of currently selected languages.
There are currently 15 languages available for translation:
code | language |
ar | Arabic |
ca | Catalan |
da | Danish |
de | German |
en | English |
es | Spanish |
fr | French |
he | Hebrew |
hi | Hindi |
it | Italian |
pt | Portuguese |
pt_BR | Portuguese (Brazil) |
ru | Russian |
sv | Swedish |
zh_CN | Chinese |
If no fallback languages are specified, translations automatically fall back onto the following languages.
original language | fallback language |
es | pt |
pt | es |
fr | pt |
de | nl |
nl | de |
if (FALSE) { i18n <- list( defaultLang = "en", availableLangs = c("en", "de") ) lang <- callModule(langSelector,"lang", i18n = i18n, showSelector = TRUE) }