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
)
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
andsrc
, 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 theDESCRIPTION
fieldConfig/potools/style
so you can specify the style once for your package.Both styles extract strings explicitly flagged for translation with
gettext()
orngettext()
. The base style additionally extracts strings in calls tostop()
,warning()
, andmessage()
, and tostopf()
,warningf()
, andmessagef()
if you have added those helpers to your package. The explicit style also acceptstr_()
as a short hand forgettext()
. Seevignette("developer")
for more details.
Value
The extracted messages as computed by get_message_data()
,
invisibly.