edit_translation: Interactive translation editing

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/edit_translations.R

Description

Edit a translation object in-memory using a simple interface

Usage

1
edit_translation(translation, language, pkg = ".", domain = "R")

Arguments

translation

An object of class "po", such as returned by make_translation. In lieu of translation, language and pkg and domain can be specified, which will load the translation from file using read_translation.

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 as.package.

domain

A character string specifying the “domain” of the messages. Either “R” (the default) or “C”. This is case insensitive.

Value

An object of class "po".

Note

Emacs users may find the gettext PO file editor more comfortable: https://www.gnu.org/software/gettext/manual/gettext.html#PO-Mode.

Author(s)

Thomas J. Leeper

See Also

make_translation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
  # setup pkg for localization
  pkg <- dummy_pkg()
  use_localization(pkg = pkg)
  
  # generate translation in memory
  (tran <- make_translation("es", translator = "Some Person <example@examle.com>", pkg = pkg))
  
  # edit translations
  tran2 <- edit_translation(tran, pkg = pkg)
  # write to disk
  write_translation(tran2, pkg = pkg)

## End(Not run)

msgtools documentation built on May 30, 2017, 5:12 a.m.