Learn R Programming

potools (version 0.2.4)

po_extract: Extract messages for translation into a .pot file

Description

po_extract() scans your package for strings to be translated and saves them into a .pot template file (in the package's po directory). You should never modify this file by hand; instead modify the underlying source code and re-run po_extract().

If you have existing translations, call po_update() after po_extract() to update them with the changes.

Usage

po_extract(
  dir = ".",
  custom_translation_functions = list(),
  verbose = !is_testing(),
  style = NULL
)

Value

The extracted messages as computed by get_message_data(), invisibly.

Arguments

dir

Character, default the present directory; a directory in which an R package is stored.

custom_translation_functions

A list with either/both of two components, R and src, together governing how to extract any non-standard strings from the package.

See Details in translate_package().

verbose

Logical, default TRUE (except during testing). Should extra information about progress, etc. be reported?

style

Translation style, either "base" or "explict". The default, NULL, reads from the DESCRIPTION field Config/potools/style so you can specify the style once for your package.

Both styles extract strings explicitly flagged for translation with gettext() or ngettext(). The base style additionally extracts strings in calls to stop(), warning(), and message(), and to stopf(), warningf(), and messagef() if you have added those helpers to your package. The explicit style also accepts tr_() as a short hand for gettext(). See vignette("developer") for more details.