ruby-gettext / gettext

Gettext gem is a pure Ruby Localization(L10n) library and tool which is modeled after the GNU gettext package.
https://ruby-gettext.github.io/
69 stars 28 forks source link

Support for newest Rubies #59

Closed axilleas closed 4 years ago

axilleas commented 6 years ago

Hi! 2.3.7 is the last one of the 2.3 family https://www.ruby-lang.org/en/news/2018/03/28/ruby-2-3-7-released/.

Is there any plan to support the newer 2.4 or even 2.5? Running the tests for 2.5.1, there are 14 failures.

Thanks :)

kou commented 6 years ago

You can use gettext with the latest Rubyies: https://travis-ci.org/ruby-gettext/gettext/builds/392976704

How did you run the test?

axilleas commented 6 years ago

Hmm, then there's something wrong with my system. I'm using Arch Linux with RVM. I created a new gemset for Ruby 2.5.1, ran bundle and then the tests:

JRUBY_OPTS=-Xcext.enabled=true bundle exec rake

This is the errors I get:

Loaded suite test/run-test
Started
.........F
===============================================================================
Failure: test_anonymous_module(TestGetText)
/home/axil/git/gettext/test/test_gettext.rb:345:in `test_anonymous_module'
     342: 
     343:   def test_anonymous_module
     344:     anonymous_module = self.class.instance_variable_get(:@anonymous_module)
  => 345:     assert_equal("japanese", anonymous_module::I.test)
     346:     assert_equal("japanese", anonymous_module::I.new.test2)
     347:   end
     348: 
<"japanese"> expected but was
<"language">

diff:
? japan    ese
? l    guag   
===============================================================================
F
===============================================================================
Failure: test_change_locale(TestGetText)
/home/axil/git/gettext/test/test_gettext.rb:48:in `test_change_locale'
     45:     GetText.locale = nil
     46:     bindtextdomain("test2", "locale")
     47:     test = Simple.new
  => 48:     assert_equal("japanese", test.test)
     49:     set_locale("fr")
     50:     assert_equal("french", test.test) # influence of previous line
     51:     assert_equal("FRENCH:ONE IS 1.", test.test_formatted_string)
<"japanese"> expected but was
<"language">

diff:
? japan    ese
? l    guag   
===============================================================================
F
===============================================================================
Failure: test_empty(TestGetText)
/home/axil/git/gettext/test/test_gettext.rb:64:in `test_empty'
     61: 
     62:   def test_empty
     63:     bindtextdomain("test1", "locale")
  => 64:     assert_equal("japanese", gettext("language"))
     65: 
     66:     pot_header = <<EOH
     67: Project-Id-Version: PACKAGE VERSION
<"japanese"> expected but was
<"language">

diff:
? japan    ese
? l    guag   
===============================================================================
F
===============================================================================
Failure: test_frozen(TestGetText): <false> is not true.
/home/axil/git/gettext/test/test_gettext.rb:351:in `test_frozen'
     348: 
     349:   def test_frozen
     350:     GetText.bindtextdomain("test1", :path => "locale")
  => 351:     assert(GetText._("language").frozen?)
     352:   end
     353: 
     354:   def test_safe_mode
===============================================================================
F
===============================================================================
Failure: test_gettext(TestGetText)
/home/axil/git/gettext/test/test_gettext.rb:81:in `test_gettext'
     78: 
     79:   def test_gettext
     80:     test = MessageFixture.new
  => 81:     assert_equal("AAA", test.test_1)
     82:     assert_equal("AAA\n", test.test_2)
     83:     assert_equal("BBB\nCCC", test.test_3)
     84:     assert_equal("BBB
<"AAA"> expected but was
<"aaa">
===============================================================================
...F
===============================================================================
Failure: test_np_(TestGetText)
/home/axil/git/gettext/test/test_gettext.rb:147:in `test_np_'
     144:   def test_np_
     145:     GetText.locale = nil
     146:     test = TestNPGetText.new
  => 147:     assert_equal(["一つの本", "%{num}の本たち"], test.test_1)
     148:     assert_equal(["一つの本", "%{num}の本たち"], test.test_2)
     149:     assert_equal(["一つのハードカバー本", "%{num}のハードカバー本たち"], test.test_3)
     150:     assert_equal(["マガジンを1冊持ってます。", "マガジンたちを%{num}冊持ってます。"], test.test_4)
<["一つの本", "%{num}の本たち"]> expected but was
<["a book", "%{num} books"]>

diff:
? ["一つの本", "%{num}の本たち"]
?   a book             books    
===============================================================================
F
===============================================================================
Failure: test_nsgettext(TestGetText)
/home/axil/git/gettext/test/test_gettext.rb:165:in `test_nsgettext'
     162:   def test_nsgettext
     163:     GetText.locale = nil
     164:     test = TestNSGetText.new
  => 165:     assert_equal(["single", "plural"], test.test_1)
     166:     assert_equal(["single", "plural"], test.test_2)
     167:     assert_equal(["AAA", "BBB"], test.test_3)
     168:     assert_equal(["CCC", "DDD"], test.test_4)
<["single", "plural"]> expected but was
<["BBB", "CCC"]>

diff:
? ["single", "plural"]
?   BBB       CCC     
===============================================================================
F
===============================================================================
Failure: test_p_(TestGetText)
/home/axil/git/gettext/test/test_gettext.rb:126:in `test_p_'
     123:     GetText.locale = nil
     124:     test = TestPGetText.new
     125: 
  => 126:     assert_equal("えーびー", test.test_1)
     127:     assert_equal("えーびー", test.test_2)
     128:     assert_equal("えーびーしー", test.test_3)
     129:     assert_equal("CCC", test.test_4)
<"えーびー"> expected but was
<"BBB">
===============================================================================
F
===============================================================================
Failure: test_plural(TestGetText)
/home/axil/git/gettext/test/test_gettext.rb:179:in `test_plural'
     176:   def test_plural
     177:     GetText.locale = nil
     178:     bindtextdomain("plural", :path => "locale")
  => 179:     assert_equal("all", n_("one", "two", 0))
     180:     assert_equal("all", n_("one", "two", 1))
     181:     assert_equal("all", n_("one", "two", 2))
     182: 
<"all"> expected but was
<"two">
===============================================================================
.F
===============================================================================
Failure: test_plural_format_invalid(TestGetText)
/home/axil/git/gettext/test/test_gettext.rb:231:in `test_plural_format_invalid'
     228:   def test_plural_format_invalid
     229:     bindtextdomain("plural_error", :path => "locale")
     230:     #If it defines msgstr[0] only, msgstr[0] is used everytime.
  => 231:     assert_equal("a", n_("first", "second", 0))
     232:     assert_equal("a", n_("first", "second", 1))
     233:     assert_equal("a", n_("first", "second", 2))
     234:     # Use default(plural = 0)
<"a"> expected but was
<"second">
===============================================================================
F
===============================================================================
Failure: test_plural_with_single(TestGetText)
/home/axil/git/gettext/test/test_gettext.rb:268:in `test_plural_with_single'
     265:   def test_plural_with_single
     266:     bindtextdomain("plural", :path => "locale")
     267: 
  => 268:     assert_equal("hitotsu", _("single"))
     269:     assert_equal("hitotsu", n_("single", "plural", 1))
     270:     assert_equal("hitotsu", n_("single", "plural", 2))
     271:     assert_equal("all", n_("one", "two", 1))
<"hitotsu"> expected but was
<"single">

diff:
? hitotsu
? s ngle 
===============================================================================
.F
===============================================================================
Failure: test_s_(TestGetText)
/home/axil/git/gettext/test/test_gettext.rb:107:in `test_s_'
     104:   def test_s_
     105:     test = TestSGetText.new
     106: 
  => 107:     assert_equal("MATCHED", test.test_1)
     108:     assert_equal("MATCHED", test.test_2)
     109:     assert_equal("AAA", test.test_3)
     110:     assert_equal("CCC", test.test_4)
<"MATCHED"> expected but was
<"BBB">
===============================================================================
..F
===============================================================================
Failure: test_set_locale(TestGetText)
/home/axil/git/gettext/test/test_gettext.rb:297:in `test_set_locale'
     294: 
     295:   def test_set_locale
     296:     bindtextdomain("test1", :path => "locale")
  => 297:     assert_equal("japanese", _("language"))
     298:     set_locale("en")
     299:     assert_equal("language", _("language"))
     300: 
<"japanese"> expected but was
<"language">

diff:
? japan    ese
? l    guag   
===============================================================================
F
===============================================================================
Failure: test_one_line(TestGetText::Test_)
/home/axil/git/gettext/test/test_gettext.rb:96:in `test_one_line'
     93:   class Test_ < self
     94:     def test_one_line
     95:       target = Fixtures::Method_::OneLine.new
  => 96:       assert_equal("ONE LINE", target.message)
     97:     end
     98:   end
     99: 
<"ONE LINE"> expected but was
<"one line">
===============================================================================
...............................................................................
...............................................................................
.......................................................................................................................
.................#, fuzzy
msgid "hello!!!!!!!!!!"
msgstr "bonjour"

#~ msgid "hello"
#~ msgstr "bonjour"
..............................................................
.....
Finished in 4.557936981 seconds.
-------------------------------------------------------------------------------
351 tests, 588 assertions, 14 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
96.0114% passed
-------------------------------------------------------------------------------
77.01 tests/s, 129.01 assertions/s

And there's also an error message:

Warning: fuzzy message was used.
  /tmp/hello.po20180616-1403-d8ena6: msgid 'hello'
Warning: fuzzy message was used.
  /tmp/d20180616-1403-h3sxjy/po/ja/msgmerge.po: msgid 'World'
rake aborted!
Command failed with status (1): [/home/axil/.rvm/rubies/ruby-2.5.1/bin/ruby...]
/home/axil/git/gettext/Rakefile:77:in `block in <top (required)>'
/home/axil/.rvm/gems/ruby-2.5.1@gettext/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/home/axil/.rvm/gems/ruby-2.5.1@gettext/bin/ruby_executable_hooks:15:in `eval'
/home/axil/.rvm/gems/ruby-2.5.1@gettext/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => default => test
kou commented 6 years ago

Can you show the output of env?

And can you try it from scratch?

% git clone https://github.com/ruby-gettext/gettext.git
% cd gettext
% bundle install
% bundle exec rake