Description Usage Arguments Details Value Note Author(s) See Also Examples
Read, write, and generate translations of diagnostic messages
1 2 3 4 5 6 7 8  | read_translation(language, pkg = ".", domain = "R")
write_translation(translation, pkg = ".", verbose = getOption("verbose"))
make_translation(language, translator, team = " ", pkg = ".",
  domain = "R", verbose = getOption("verbose"))
sync_translations(pkg = ".", verbose = getOption("verbose"))
 | 
language | 
 A character string specifying a language, as either: (1) “ll”, an ISO 639 two-letter language code (lowercase), or (2) “ll_CC”, an ISO 639 two-letter language code (lowercase) and ‘CC’ is an ISO 3166 two-letter country code (uppercase).  | 
pkg | 
 The directory of an R package to extract diagnostic messages from. Path is passed to   | 
domain | 
 A character string specifying the “domain” of the messages. Either “R” (the default) or “C”. This is case insensitive.  | 
translation | 
 An object of class   | 
verbose | 
 A logical. Should the function be chatty?  | 
translator | 
 A character string the name and email of a translation of the form   | 
team | 
 Optionally, a character string specifying contact information for a “translation team”.  | 
read_translation and write_translation provide basic input and output functionality for translation (.po) files. If called from with an R package directory, the locations of these fies are identified automatically. read_po provides a lower-level interface for reading a specific file.
The behavior of make_translation depends on context. If the requested translation already exists, it is updated against the template (.pot) file and loaded into memory. If the translation does not already exist, the function creates a "po" translation object from the message template (.pot) file (if one does not exist, it is created). The language and translator arguments are mandatory in the latter case and only used to update values in an existing file if they differ from the existing values. language must be an allowed language code (see language_codes); the “Plural-Forms” metadata field is generated automatically from the language value (see plural_forms).
sync_translations() updates the template file (via sync_template and then updates existing translation files against it.
edit_translation is a very simple interactive interface for editing a translation object in memory.
make_translation and read_translation reutrn an object of class “po”. write_translation returns the path to the file, invisibly.
These functions require that gettext is installed on your system.
Thomas J. Leeper
make_template, use_localization, edit_translation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  | ## Not run: 
  # create example package
  pkg <- dummy_pkg()
  
  # setup pkg for localization
  use_localization(pkg)
  
  # generate Portugal Portugese translation in memory
  make_translation("pt_PT", translator = "Some Person <example@example.com>")
  # generate Spanish translation in memory
  (tran <- make_translation("es", translator = "Some Person <example@example.com>"))
  # write to disk
  write_translation(tran)
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.