Skip to content

Commit

Permalink
Fix report_msgid_bugs_to wrong attribute name
Browse files Browse the repository at this point in the history
Fixes #30. The previous fix was wrong. I added more tests to make sure
everything works fine.
  • Loading branch information
arashm committed May 9, 2024
1 parent 3f3e3a2 commit 693ca6a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/poparser/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module PoParser
pot_creation_date: 'POT-Creation-Date',
po_revision_date: 'PO-Revision-Date',
project_id: 'Project-Id-Version',
report_to: 'Project-Id-Version',
report_to: 'Report-Msgid-Bugs-To',
last_translator: 'Last-Translator',
team: 'Language-Team',
language: 'Language',
Expand Down
4 changes: 3 additions & 1 deletion lib/poparser/header.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ module PoParser
class Header
attr_reader :entry, :original_configs, :flag
attr_accessor :comments, :pot_creation_date, :po_revision_date, :project_id,
:report_to, :report_msgid_bugs_to, :last_translator, :team, :language, :charset,
:report_to, :last_translator, :team, :language, :charset,
:encoding, :plural_forms

alias report_msgid_bugs_to report_to

def initialize(entry)
@entry = entry
@comments = entry.translator_comment.value unless entry.translator_comment.nil?
Expand Down
14 changes: 14 additions & 0 deletions spec/poparser/header_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@
end
end

it 'returns correct values for labels' do
expect(@header.project_id).to eq('gnome-shell-extensions gnome-3-0')
expect(@header.report_to).to eq('http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-shell&keywords=I18N+L10N&component=extensions')
expect(@header.report_msgid_bugs_to).to eq('http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-shell&keywords=I18N+L10N&component=extensions')
expect(@header.pot_creation_date).to eq('2014-08-28 07:40+0000')
expect(@header.po_revision_date).to eq('2014-08-28 19:59+0430')
expect(@header.last_translator).to eq('Arash Mousavi <mousavi.arash@gmail.com>')
expect(@header.team).to eq('Persian <>')
expect(@header.language).to eq('fa_IR')
expect(@header.charset).to eq('text/plain; charset=UTF-8')
expect(@header.encoding).to eq('8bit')
expect(@header.plural_forms).to eq('nplurals=1; plural=0;')
end

it 'should convert configs to hash' do
expect(@header.original_configs).to eq(
{"Project-Id-Version"=>"gnome-shell-extensions gnome-3-0", "Report-Msgid-Bugs-To"=>"http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-shell&keywords=I18N+L10N&component=extensions", "POT-Creation-Date"=>"2014-08-28 07:40+0000", "PO-Revision-Date"=>"2014-08-28 19:59+0430", "Last-Translator"=>"Arash Mousavi <mousavi.arash@gmail.com>", "Language-Team"=>"Persian <>", "Language"=>"fa_IR", "MIME-Version"=>"1.0", "Content-Type"=>"text/plain; charset=UTF-8", "Content-Transfer-Encoding"=>"8bit", "X-Poedit-SourceCharset"=>"utf-8", "X-Generator"=>"Gtranslator 2.91.6", "Plural-Forms"=>"nplurals=1; plural=0;"}
Expand Down

0 comments on commit 693ca6a

Please sign in to comment.