saveTranslation: saveTranslation, readTranslation and cleanTranslation

Description Usage Arguments Value Examples

View source: R/saveTranslation.R

Description

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
saveTranslation(
  file,
  ascii = FALSE,
  version = 2,
  compress = TRUE,
  refhook = NULL
)

readTranslation(file, refhook = NULL, append = TRUE)

cleanTranslation()

Arguments

file

a connection or the name of the file where the R object is saved to or read from.

ascii

a logical. If TRUE or NA, an ASCII representation is written; otherwise (default), a binary one is used. See the comments in the help for save.

version

the workspace format version to use. NULL specifies the current default version (3). The only other supported value is 2, the default from R 1.4.0 to R 3.5.0.

compress

a logical specifying whether saving to a named file is to use "gzip" compression, or one of "gzip", "bzip2" or "xz" to indicate the type of compression to be used. Ignored if file is a connection.

refhook

a hook function for handling reference objects.

append

logical: append to current translation environment (default: TRUE)

Value

nothing

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# read a german PO file from the package directory into the internal translation object
fd <- bind(de=system.file("shiny", "app2", "myproject_de_DE.po", package="gettext"))
readPofile(fd)
# show a copy of the internal translation object
getTranslation()
# save the internal translation object to a file
file <- sprintf("%s/translation.RDS", tempdir(TRUE))
saveTranslation(file)
# deletes all entries in the internal translation object
cleanTranslation()
getTranslation() # should be empty
# loads an previously saved internal translation object from a file
readTranslation(file)
getTranslation() 

sigbertklinke/gettext documentation built on Feb. 17, 2020, 10:37 a.m.