Takes a named set of options and optionally an already created options object. If both are set, named options will overwrite any options in the object.
traduire_options(..., options = NULL)
Named options
language The default language for the translation
default_namespace The default namespace to use. If not
given, then i18next
assumes the namespace
translation
debug Logical, indicating if i18next's debug output should
be turned on. This will result in lots of output via
message
about various i18next actions.
resource_pattern A pattern to use for on-demand loading of
translation resources. Only works if translations
is
NULL
at present.
namespaces A vector of namespaces to load. Namespaces not
listed here may not be loaded as expected (use debug =
TRUE
to work out what is going on). The default (NULL
)
will use i18next's logic, which is to use translation
as
the only loaded namespace. This creates some issues if
default_namespace
is set here, as the default namespace
will not be loaded. A future version of this package will
probably do better with the logic here.
languages A vector of languages to preload. You can
always add additional languages using the load_language
method. Note that the adding a language here does not (yet)
mean that failure to load the language is an error.
fallback The fallback language to use. The options here
are to use a character string (a single fallback to use for all
languages), a character vector (a series of languages to use in
turn, listed from first to try to last to try) or a named list
of language-fallback mappings, e.g., list("de-CH": c("fr",
"it"), "es": "fr")
.
escape Logical, indicating if the translation output should be, by default, escaped (see the i18next interpolation documentation). The i18next implementation is to prevent xss attacks, and so is disabled by default in traduire.
traduire_options object
A 'traduire_options' object
These options are passed to i18next.
opts <- traduire::traduire_options()
opts <- traduire::traduire_options(language = "fr")
opts <- traduire::traduire_options(default_namespace = "tr", options = opts)