module GettextPO
The main entrypoints to parse PO files are GettextPO::File.new and GettextPO::File.read.
Error handling¶ ↑
There are two kinds of errors in this gem. The first is for exception handlings of libgettextpo. The second is regular error raising from this gem.
Some functions takes exception error handling paramters like xerror and xerror2. These parameters expect Proc object which takes several parameters. See also the description of GettextPO::File.read method. The severity parameter among these parameters is either SEVERITY_WARNING, SEVERITY_ERROR, or SEVERITY_FATAL_ERROR.
This gem normally raises GettextPO::Error object, except for the standard ones, StopIteration for example.
Constants
- LIBGETTEXTPO_VERSION
- SEVERITY_ERROR
- SEVERITY_FATAL_ERROR
- SEVERITY_WARNING
- VERSION
-
Version of this gem.
Public Class Methods
Source
VALUE
gettextpo_po_format_pretty_name (VALUE self, VALUE format)
{
const char *name = po_format_pretty_name (StringValueCStr (format));
return name ? rb_str_new_cstr (name) : Qnil;
}
Possibly returns nil.
See also ::formats method for available format types.
Source
VALUE
gettextpo_po_format_list (VALUE self)
{
VALUE list = rb_ary_new ();
const char *const *formats = po_format_list ();
for (size_t index = 0; formats[index]; index++)
rb_ary_push (list, rb_str_new_cstr (formats[index]));
return list;
}
Source
VALUE
gettextpo_m_header_entry_value (VALUE self, VALUE header, VALUE field)
{
char *string
= po_header_field (StringValueCStr (header), StringValueCStr (field));
if (string)
{
VALUE value = rb_str_new_cstr (string);
free (string);
return value;
}
else
return Qnil;
}
See also GettextPO::File#domain_header.
Source
VALUE
gettextpo_m_header_with_updated_entry_value (VALUE self, VALUE header,
VALUE field, VALUE value)
{
char *updated_header
= po_header_set_field (StringValueCStr (header), StringValueCStr (field),
StringValueCStr (value));
VALUE header_value = rb_str_new_cstr (updated_header);
free (updated_header);
return header_value;
}
See also GettextPO::File#domain_header.