Sha256: cb4f6820d10821f2cf21f1d20cbddab74e2e74a39ed8dcdc7a4e3a45bac837a2

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 KB

Contents

# Copyright (C) 2011  Miho SUZUKI
# Copyright (C) 2012  Kouhei Sutou <kou@clear-code.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

require 'open-uri'
require 'nokogiri'

module Logaling
  class DebianProject < ExternalGlossary
    description     'Debian JP Project (http://www.debian.or.jp/community/translate/)'
    source_language 'en'
    target_language 'ja'
    output_format   'csv'

    private
    def convert_to_csv(csv)
      doc = ::Nokogiri::HTML(open("http://www.debian.or.jp/community/translate/trans_table.html", "r"))
      doc.css('dl').each do |dl|
        dl.children.each_slice(3) do |dt, dd, _|
          csv << [dt.text, dd.text.gsub(/(^\/|\/$)/,'')]
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
logaling-command-0.1.6 lib/logaling/external_glossaries/debian_project.rb
logaling-command-0.1.5 lib/logaling/external_glossaries/debian_project.rb
logaling-command-0.1.4 lib/logaling/external_glossaries/debian_project.rb
logaling-command-0.1.3 lib/logaling/external_glossaries/debian_project.rb
logaling-command-0.1.2 lib/logaling/external_glossaries/debian_project.rb