Translate Text Messages

DESCRIPTION:

These functions are intended to translate character vectors into other languages, but that functionality is not available at this time. The function ngettext is used to provide a choice of messages depending on the value of an integer.

USAGE:

gettext(..., domain=NULL)
ngettext(n, msg1, msg2, domain=NULL)

REQUIRED ARGUMENTS:

n
an integer value used to select msg1 or msg2.
msg1
a character string to use if n=1.
msg2
a character string to use if n is not set to 1.

OPTIONAL ARGUMENTS:

...
one or more character vectors.
domain
the domain to use for language translation. This argument is ignored in this version of S-PLUS.

VALUE:

Function gettext returns a single character vector containing all values in the input ... coerced to character. If translation was enabled, they would be translated according to the given domain.
Function ngettext returns a character string, either msg1 or msg2 depending upon the value of n.

DETAILS:

These functions were added to emulate R functions, gettext and ngettext, but Native Language Support and support for domains are not included in this version of S-PLUS, so these functions have limited functionality.

SEE ALSO:

, .

EXAMPLES:

# Select the correct warning message
func1 <- function(x, y, z)
{
     miss <- c("x", "y", "z")[c(missing(x), missing(y), missing(z))]
     if(length(miss) > 0) {
          warning(sprintf(ngettext(length(miss),
               "Variable %s is missing.\n",
               "Variables %s are missing.\n"), paste(sQuote(miss),
               collapse = ", ")))
     }
}
func1(y=5)
func1(y=5,z=2)