Translating plugins

The rkwarddev package is capable of producing external plugins with full i18n support. For instance, all relevant functions generating XML objects offer an optional parameter to specify i18n_context or noi18n_label:

varComment <- rk.XML.varselector(id.name="vars", i18n=list(comment="Main variable selector"))
varContext <- rk.XML.varselector(id.name="vars", i18n=list(context="Main variable selector"))
cboxNoi18n <- rk.XML.cbox(label="Power", id.name="power", i18n=FALSE)
    

The above examples produce output like this:

# varComment
<!-- i18n: Main variable selector -->
  <varselector id="vars" />

# varContext
<varselector id="vars" i18n_context="Main variable selector" />

# cboxNoi18n
<checkbox id="power" noi18n_label="Power" value="true" />
    

There's also support for translatable JS code. In fact, the package tries add i18n() calls by default in places where this is usually helpful. The rk.JS.header() function is a good example:

jsHeader <- rk.JS.header("Test results")
    

This produces the following JS code:

new Header(i18n("Test results")).print();
    

But you can also manually mark strings in your JS code as translatable, by using the i18n() function just like you would if you wrote the JS file directly.