These functions compare formats embedded in English messages
with translated strings to check for consistency.
checks one file, while
checkPoFiles checks all files for a specified
checkPoFile(f, strictPlural = FALSE) checkPoFiles(language, dir = ".")
a character string giving a single filepath.
whether to compare formats of singular and plural forms in a strict way.
a character string giving a language code.
a path to a directory in which to check files.
Part of R's internationalization depends on translations of messages
in ‘.po’ files. In these files an ‘English’ message taken
from the R sources is followed by a translation into another
language. Many of these messages are format strings for C or R
sprintf and related functions. In these cases, the
translation must give a compatible format or an error will be
generated when the message is displayed.
The rules for compatibility differ between C and R in several ways. C
supports several conversions not supported by R, namely
n. It is allowed in C's
function to have more arguments than are needed by the format string,
but in R the counts must match exactly. R requires types of
arguments to match, whereas C will do the display whether it makes
sense or not.
These functions compromise on the testing as follows. The additional formats allowed in C are accepted, and all differences in argument type or count are reported. As a consequence some reported differences are not errors.
strictPlural argument is
TRUE, then argument
lists must agree exactly between singular and plural forms of messages; if
FALSE, then translations only need to match one or the other
of the two forms. When
strictPlural argument is set to
TRUE for files with
names starting ‘R-’, and to
Items marked as ‘fuzzy’ in the ‘.po’ file are not processed (as they are ignored by the message compiler).
If a difference is found, the translated string is checked for variant
percent signs (e.g., the wide percent sign
"\uFF05"). Such signs
will not be recognized as format specifiers, and are likely to be
Both functions return an object of S3 class
See the GNU gettext manual for the ‘.po’ file format:
update_pkg_po() which calls
## Not run: checkPoFiles("de", "/path/to/R/src/directory") ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.