Closed renchap closed 7 years ago
Please provide a Ruby script that reproduces the problem?
I couldn't reproduce it.
# symbols.rb
%i[a b]
% rxgettext symbols.rb
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-08-13 21:24+0900\n"
"PO-Revision-Date: 2017-08-13 21:24+0900\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
Sorry, I should have checked when it occured.
Here is a script that fails:
# symbols.rb
(1..2).each do |i, _|
%i[aa bb]
end
% rxgettext symbols.rb
Error parsing symbols.rb:2
%i[aa bb]
#<TypeError: no implicit conversion of Array into String> in
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/po_entry.rb:226:in `+'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/po_entry.rb:226:in `set_value'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/parser/ruby.rb:90:in `set_current_attribute'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/parser/ruby.rb:264:in `block in parse_source'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/parser/ruby.rb:57:in `parse'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/parser/ruby.rb:242:in `parse_source'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/parser/ruby.rb:217:in `parse'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/parser/ruby.rb:134:in `parse'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/xgettext.rb:365:in `block in parse_path'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/xgettext.rb:360:in `each'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/xgettext.rb:360:in `parse_path'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/xgettext.rb:168:in `block in parse'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/xgettext.rb:166:in `each'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/xgettext.rb:166:in `parse'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/xgettext.rb:217:in `generate_pot'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/xgettext.rb:151:in `run'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/lib/gettext/tools/xgettext.rb:34:in `run'
/Users/renchap/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/gettext-3.2.3/bin/rxgettext:24:in `<top (required)>'
/Users/renchap/.rbenv/versions/2.4.1/bin/rxgettext:22:in `load'
/Users/renchap/.rbenv/versions/2.4.1/bin/rxgettext:22:in `<main>'
I noticed that if you remove the , _
in the block parameters, it works fine (both in the example and my application code).
Thanks. I've fixed.
Awesome, thanks!
The parser seems to confuse
%i[a b]
(or%i(a b)
) with a string. I am getting this error when runningrake gettext:find
:After debugging, in the
set_value
(https://github.com/ruby-gettext/gettext/blob/master/lib/gettext/po_entry.rb#L226) call I getvalue = [:aa, :bb]
.I am not sure what is happening here, I guess the parser needs to take this syntax into account.
%i
has been introduced in Ruby 2.0.