i18n: Mark JavaScript strings as translatable

View source: R/i18n.R

i18nR Documentation

Mark JavaScript strings as translatable

Description

Similar to echo, this function should help you to write your JavaScript portions in R. Depending on the provided values for its arguments, will return one of i18n(), i18nc(), i18np(), or i18ncp().

Usage

i18n(msgid, ..., context = NULL, plural = NULL, newline = "")

Arguments

msgid

Either a character string, the message to be translated (if applicable, its singular form), or an object of class noquote, which will be pasted as a noquote() function call.

...

Either character string which will be pasted unquoted to be used in conjunctions with placeholders in msgid, or XiMpLe.node objects of which the JavaScript variable name will be used.

context

Character string, optional context information for this string.

plural

Character string for plural form of msgid, must at least include one placeholder, and the first one has to represent an integer value in the dialog.

newline

Character string, can be set to e.g. "\n" to force a newline after the call.

Value

An object of class rk.JS.i18n.

Examples

i18n("Select data")
i18n("Comparing a single pair", "n_pairs", plural="Comparing %1 distinct pairs")

echo(i18n(noquote("A string I'll quote, later")))

rkward-community/rkwarddev documentation built on May 9, 2022, 3:02 p.m.