i18n: Translate

View source: R/i18n.R

i18nR Documentation

Translate

Description

Translates text into a language determined by the current testing session. Translation is carried out using a dictionary defined at test creation (see i18n_dict). The function can typically only be used within a call to new_timeline, which defines the dictionary in which to look up i18n. Calling i18n outside this context will typically result in an error.

Usage

i18n(x, html = TRUE, sub = character())

Arguments

x

Character scalar identifying the term to be translated.

html

Boolean; whether or not the translation output should be parsed as HTML or as plain text (the default is TRUE, corresponding to HTML parsing).

sub

A named character vector or list defining substitutions to make within the translation output. The text of the translation output may contain passages such as {{var1}}; if sub = c(var1 = "Hello"), then {{var1}} will be replaced with the text Hello.

Value

The translated output, typically a character scalar or a shiny::HTML() output.


pmcharrison/psychTestR documentation built on Sept. 30, 2023, 6:27 p.m.