Skip to content

Commit 3ab0d60

Browse files
committed
Fix to work with gettext 0.23.
1 parent 9fecbf7 commit 3ab0d60

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

ext/gettextpo/gettextpo.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ static const struct po_xerror_handler gettextpo_xerror_handler = {
170170
.xerror2 = gettextpo_xerror2,
171171
};
172172

173+
#ifdef HAVE_PO_MESSAGE_GET_FORMAT
173174
/**
174175
* Document-class: GettextPO::FlagIterator
175176
*/
@@ -204,6 +205,7 @@ gettextpo_po_flag_iterator_m_next (VALUE self)
204205
else
205206
rb_raise (rb_eStopIteration, "no more flag");
206207
}
208+
#endif
207209

208210
/**
209211
* Document-class: GettextPO::Message
@@ -1144,9 +1146,11 @@ Init_gettextpo (void)
11441146
rb_define_method (rb_cFilePos, "file", gettextpo_po_filepos_m_file, 0);
11451147
rb_define_method (rb_cFilePos, "start_line",
11461148
gettextpo_po_filepos_m_start_line, 0);
1149+
#ifdef HAVE_PO_MESSAGE_GET_FORMAT
11471150
rb_cFlagIterator
11481151
= rb_define_class_under (rb_mGettextPO, "FlagIterator", rb_cObject);
11491152
rb_define_alloc_func (rb_cFlagIterator, gettextpo_po_flag_iterator_alloc);
11501153
rb_define_method (rb_cFlagIterator, "next",
11511154
gettextpo_po_flag_iterator_m_next, 0);
1155+
#endif
11521156
}

test/flag.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
file = GettextPO::File.new
77
message = file.message_iterator.insert('msgid1', 'msgstr1')
8+
message.respond_to?(:update_workflow_flag) or next true
89
message.update_workflow_flag('fuzzy')
910
iter = message.workflow_flag_iterator
1011
assert_equal 'fuzzy', iter.next

test/message.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
path = File.expand_path(File.join(__FILE__, "../../test.cruby/resources/ok.po"))
7878
iterator = GettextPO::File.read(path).message_iterator
7979
message = iterator.next
80+
message.respond_to?(:workflow_flag?) or next true
8081
assert_false message.workflow_flag?('fuzzy')
8182
message.update_workflow_flag('fuzzy')
8283
assert_true message.workflow_flag?('fuzzy')

0 commit comments

Comments
 (0)