readPofile: readPofile

Description Usage Arguments Value Note Examples

View source: R/readPofile.R

Description

Reads one or more PO file into the library internal translation object. If file has been created with bind then several files with different domains and languages can be read at once.

Usage

1
2
3
4
5
6
7
readPofile(
  file,
  lang = getOption("gettext.lang"),
  domain = getOption("gettext.domain"),
  append = FALSE,
  encoding = "UTF-8"
)

Arguments

file

character vector with file names or bind object

lang

character: language code (default: getOption('gettext.lang'), usually "en")

domain

character: text domain (default: getOption('gettext.domain'), usually NA)

append

logical: append POfile to internal translation environment or overwrite (default)

encoding

character: encoding to be assumed for input files. It is used to mark character strings as known to be in Latin-1 or UTF-8: it is not used to re-encode the input (default: "UTF-8")

Value

invisibly the internal used bind object

Note

Make sure that your PO files are stored with encoding UTF-8. You may check this under Linux with file -bi myproject.po and under Windows if you drag and drop your myproject.po to Firefox

Examples

1
2
3
4
5
file <- system.file("shiny", "app2", "myproject_de_DE.po", package="gettext")
# force austrian german, use default domain
readPofile(file, lang="de_AT") 
# detect language and domain from file name
readPofile(bind(file), append=TRUE)

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