Gettext/po 005fmessage 005ft-API
From Get docs
Next: PO Header Entry API, Previous: po_message_iterator_t API, Up: libgettextpo [Contents][Index]
9.13.4 po_message_t API
- Data Type
- po_message_t
- This is a pointer type that refers to a message of a PO file, including its translation.
- Function
- po_message_t po_message_create (void)
- Returns a freshly constructed message. To finish initializing the message, you must set the
msgid
andmsgstr
. It must be inserted into a file to manage its memory, as there is nopo_message_free
available to the user of the library.
The following functions access details of a po_message_t
. Recall
that the results are valid as long as the file
handle is valid.
- Function
- const char * po_message_msgctxt (po_message_t
message
) - The
po_message_msgctxt
function returns themsgctxt
, the context ofmessage
. ReturnsNULL
for a message not restricted to a context.
- Function
- void po_message_set_msgctxt (po_message_t
message
, const char *msgctxt
) - The
po_message_set_msgctxt
function changes themsgctxt
, the context of the message, to the value provided throughmsgctxt
. The valueNULL
removes the restriction.
- Function
- const char * po_message_msgid (po_message_t
message
) - The
po_message_msgid
function returns themsgid
(untranslated English string) ofmessage
. This is guaranteed to be non-NULL
.
- Function
- void po_message_set_msgid (po_message_t
message
, const char *msgid
) - The
po_message_set_msgid
function changes themsgid
(untranslated English string) ofmessage
to the value provided throughmsgid
, a non-NULL
string.
- Function
- const char * po_message_msgid_plural (po_message_t
message
) - The
po_message_msgid_plural
function returns themsgid_plural
(untranslated English plural string) ofmessage
, a message with plurals, orNULL
for a message without plural.
- Function
- void po_message_set_msgid_plural (po_message_t
message
, const char *msgid_plural
) - The
po_message_set_msgid_plural
function changes themsgid_plural
(untranslated English plural string) of a message to the value provided throughmsgid_plural
, or removes the plurals ifNULL
is provided asmsgid_plural
.
- Function
- const char * po_message_msgstr (po_message_t
message
) - The
po_message_msgstr
function returns themsgstr
(translation) ofmessage
. For an untranslated message, the return value is an empty string.
- Function
- void po_message_set_msgstr (po_message_t
message
, const char *msgstr
) - The
po_message_set_msgstr
function changes themsgstr
(translation) ofmessage
to the value provided throughmsgstr
, a non-NULL
string.
- Function
- const char * po_message_msgstr_plural (po_message_t
message
, intindex
) - The
po_message_msgstr_plural
function returns themsgstr[index]
ofmessage
, a message with plurals, orNULL
when theindex
is out of range or for a message without plural.
- Function
- void po_message_set_msgstr_plural (po_message_t
message
, intindex
, const char *msgstr_plural
) - The
po_message_set_msgstr_plural
function changes themsgstr[index]
ofmessage
, a message with plurals, to the value provided throughmsgstr_plural
.message
must be a message with plurals. UseNULL
as the value ofmsgstr_plural
withindex
pointing to the last element to reduce the number of plural forms.
- Function
- const char * po_message_comments (po_message_t
message
) - The
po_message_comments
function returns the comments ofmessage
, a multiline string, ending in a newline, or a non-NULL
empty string.
- Function
- void po_message_set_comments (po_message_t
message
, const char *comments
) - The
po_message_set_comments
function changes the comments ofmessage
to the valuecomments
, a multiline string, ending in a newline, or a non-NULL
empty string.
- Function
- const char * po_message_extracted_comments (po_message_t
message
) - The
po_message_extracted_comments
function returns the extracted comments ofmessage
, a multiline string, ending in a newline, or a non-NULL
empty string.
- Function
- void po_message_set_extracted_comments (po_message_t
message
, const char *extracted_comments
) - The
po_message_set_extracted_comments
function changes the comments ofmessage
to the valueextracted_comments
, a multiline string, ending in a newline, or a non-NULL
empty string.
- Function
- const char * po_message_prev_msgctxt (po_message_t
message
) - The
po_message_prev_msgctxt
function returns the previousmsgctxt
, the previous context ofmessage
. ReturnNULL
for a message that does not have a previous context.
- Function
- void po_message_set_prev_msgctxt (po_message_t
message
, const char *prev_msgctxt
) - The
po_message_set_prev_msgctxt
function changes the previousmsgctxt
, the context of the message, to the value provided throughprev_msgctxt
. The valueNULL
removes the stored previous msgctxt.
- Function
- const char * po_message_prev_msgid (po_message_t
message
) - The
po_message_prev_msgid
function returns the previousmsgid
(untranslated English string) ofmessage
, orNULL
if there is no previousmsgid
stored.
- Function
- void po_message_set_prev_msgid (po_message_t
message
, const char *prev_msgid
) - The
po_message_set_prev_msgid
function changes the previousmsgid
(untranslated English string) ofmessage
to the value provided throughprev_msgid
, or removes the message when it isNULL
.
- Function
- const char * po_message_prev_msgid_plural (po_message_t
message
) - The
po_message_prev_msgid_plural
function returns the previousmsgid_plural
(untranslated English plural string) ofmessage
, a message with plurals, orNULL
for a message without plural without any stored previousmsgid_plural
.
- Function
- void po_message_set_prev_msgid_plural (po_message_t
message
, const char *prev_msgid_plural
) - The
po_message_set_prev_msgid_plural
function changes the previousmsgid_plural
(untranslated English plural string) of a message to the value provided throughprev_msgid_plural
, or removes the stored previousmsgid_plural
ifNULL
is provided asprev_msgid_plural
.
- Function
- int po_message_is_obsolete (po_message_t
message
) - The
po_message_is_obsolete
function returns true whenmessage
is marked as obsolete.
- Function
- void po_message_set_obsolete (po_message_t
message
, intobsolete
) - The
po_message_set_obsolete
function changes the obsolete mark ofmessage
.
- Function
- int po_message_is_fuzzy (po_message_t
message
) - The
po_message_is_fuzzy
function returns true whenmessage
is marked as fuzzy.
- Function
- void po_message_set_fuzzy (po_message_t
message
, intfuzzy
) - The
po_message_set_fuzzy
function changes the fuzzy mark ofmessage
.
- Function
- int po_message_is_format (po_message_t
message
, const char *format_type
) - The
po_message_is_format
function returns true when the message is marked as being a format string offormat_type
.
- Function
- void po_message_set_format (po_message_t
message
, const char *format_type
, intvalue
) - The
po_message_set_fuzzy
function changes the format mark of the message for theformat_type
provided.
- Function
- int po_message_is_range (po_message_t
message
, int *minp
, int *maxp
) - The
po_message_is_range
function returns true when the message has a numeric range set, and stores the minimum and maximum value in the locations pointed byminp
andmaxp
respectively.
- Function
- void po_message_set_range (po_message_t
message
, intmin
, intmax
) - The
po_message_set_range
function changes the numeric range of the message.min
andmax
must be non-negative, withmin
<max
. Usemin
andmax
with value-1
to remove the numeric range ofmessage
.
Next: PO Header Entry API, Previous: po_message_iterator_t API, Up: libgettextpo [Contents][Index]