Skip to content

Commit

Permalink
Filter out translated fields from appdata.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
ancorgs committed Oct 6, 2014
1 parent 424a916 commit 42f7aba
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/models/appdata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ def self.add_appdata data, xml
data[:categories] = Array.new unless data[:categories]
xml.xpath("/applications/application").each do |app|
appdata = Hash.new
appdata[:name] = app.xpath('name').text
# Filter translated versions of name and summary out
appdata[:name] = app.xpath('name[not(@xml:lang)]').text
appdata[:summary] = app.xpath('summary[not(@xml:lang)]').text
appdata[:pkgname] = app.xpath('pkgname').text
appdata[:categories] = app.xpath('appcategories/appcategory').map{|c| c.text}.reject{|c| c.match(/^X-/)}.uniq
appdata[:homepage] = app.xpath('url').text
appdata[:summary] = app.xpath('summary').text
data[:apps] << appdata
end
data[:categories] += xml.xpath("/applications/application/appcategories/appcategory").
Expand Down

0 comments on commit 42f7aba

Please sign in to comment.