po: Create an object of class po

Description Usage Arguments Value Note References

View source: R/po-object.R

Description

Creates an object of class po, for storing package translations.

Usage

1
po(source_type, file_type, initial_comments, metadata, direct, countable)

Arguments

source_type

Either "r" or "c", depending upon whether the messages originated from R-level code, or C-level code.

file_type

Either "po" or "pot", depending upon whether the messages originated from a PO (language-specific) or POT (master translation) file.

initial_comments

A character vector of comments added by the translator.

metadata

A tibble of file metadata with columns "name" and "value".

direct

A tibble of messages with a direct translation, as created by stop, warning, message or gettext; its columns are described below.

countable

A data frame of messages where the translation depends upon a countable value, as created by ngettext; its columns are described below.

Value

An R6 object of class po.

Note

#' The direct element of the po object has the following columns.

msgid

Character. The untranslated (should be American English) message.

msgstr

Character. The translated message, or empty strings in the case of POT files.

is_obsolete

Logical. Is the message obsolete?

msgctxt

List of character. Disambiguating context information to allow multiple messages with the same ID.

translator_comments

List of character. Comments added by the translator, typically to explain unclear messages, or why translation choices were made.

source_reference_comments

List of character. Links to where the message occured in the source, in the form "filename:line".

flags_comments

List of character. Typically used to describe formatting directives. R uses C-style formatting, which would imply a "c-format" flag. For example string. "fuzzy" flags can appear when PO files are merged.

previous_string_comments

List of character. When PO files are merged with an updated POT file ,and a fuzzy flag is generated, the old msgid is stored in a previous string comment.

The countable element of the po object takes the same form as the direct element, with two differences.

msgid_plural

Character. The plural form of the untranslated message.

msgstr

This is now a list of character (rather than character.)

The direct and countable elements also have a read-only column named msgkey that acts as a key for the message. It is generated with digest and algo = "xxhash32" on the msgid and msgctxt fields.

References

Much of the logic for this function was determined from reading http://pology.nedohodnik.net/doc/user/en_US/ch-poformat.html


poio documentation built on April 19, 2020, 4:16 p.m.