wwwjdic 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG +419 -0
- data/COPYING.md +675 -0
- data/Gemfile +21 -0
- data/README.md +303 -0
- data/Rakefile +52 -0
- data/acknowledgements.md +55 -0
- data/authors.md +67 -0
- data/copyright.md +377 -0
- data/examples/basics.rb +117 -0
- data/examples/translate.rb +128 -0
- data/examples/uri.rb +129 -0
- data/html/CHANGELOG.html +597 -0
- data/html/COPYING_md.html +389 -0
- data/html/Gemfile.html +104 -0
- data/html/Object.html +185 -0
- data/html/README_md.html +343 -0
- data/html/Rakefile.html +137 -0
- data/html/WWWJDic/ParsableDuckType.html +159 -0
- data/html/WWWJDic/Parser.html +233 -0
- data/html/WWWJDic/Parsers/Dict.html +191 -0
- data/html/WWWJDic/Parsers/Display.html +184 -0
- data/html/WWWJDic/Parsers/Key.html +221 -0
- data/html/WWWJDic/Parsers/Search.html +214 -0
- data/html/WWWJDic/Parsers/Server.html +182 -0
- data/html/WWWJDic/Parsers.html +96 -0
- data/html/WWWJDic/Splitter.html +378 -0
- data/html/WWWJDic/Utils/Downloader/Downloader.html +227 -0
- data/html/WWWJDic/Utils/Downloader.html +108 -0
- data/html/WWWJDic/Utils/Raisers.html +235 -0
- data/html/WWWJDic/Utils.html +108 -0
- data/html/WWWJDic/WWWJDic.html +715 -0
- data/html/WWWJDic.html +348 -0
- data/html/acknowledgements_md.html +149 -0
- data/html/authors_md.html +181 -0
- data/html/copyright_md.html +422 -0
- data/html/created.rid +59 -0
- data/html/css/fonts.css +167 -0
- data/html/css/rdoc.css +590 -0
- data/html/fonts/Lato-Light.ttf +0 -0
- data/html/fonts/Lato-LightItalic.ttf +0 -0
- data/html/fonts/Lato-Regular.ttf +0 -0
- data/html/fonts/Lato-RegularItalic.ttf +0 -0
- data/html/fonts/SourceCodePro-Bold.ttf +0 -0
- data/html/fonts/SourceCodePro-Regular.ttf +0 -0
- data/html/images/add.png +0 -0
- data/html/images/arrow_up.png +0 -0
- data/html/images/brick.png +0 -0
- data/html/images/brick_link.png +0 -0
- data/html/images/bug.png +0 -0
- data/html/images/bullet_black.png +0 -0
- data/html/images/bullet_toggle_minus.png +0 -0
- data/html/images/bullet_toggle_plus.png +0 -0
- data/html/images/date.png +0 -0
- data/html/images/delete.png +0 -0
- data/html/images/find.png +0 -0
- data/html/images/loadingAnimation.gif +0 -0
- data/html/images/macFFBgHack.png +0 -0
- data/html/images/package.png +0 -0
- data/html/images/page_green.png +0 -0
- data/html/images/page_white_text.png +0 -0
- data/html/images/page_white_width.png +0 -0
- data/html/images/plugin.png +0 -0
- data/html/images/ruby.png +0 -0
- data/html/images/tag_blue.png +0 -0
- data/html/images/tag_green.png +0 -0
- data/html/images/transparent.png +0 -0
- data/html/images/wrench.png +0 -0
- data/html/images/wrench_orange.png +0 -0
- data/html/images/zoom.png +0 -0
- data/html/index.html +363 -0
- data/html/js/darkfish.js +161 -0
- data/html/js/jquery.js +4 -0
- data/html/js/navigation.js +141 -0
- data/html/js/navigation.js.gz +0 -0
- data/html/js/search.js +109 -0
- data/html/js/search_index.js +1 -0
- data/html/js/search_index.js.gz +0 -0
- data/html/js/searcher.js +229 -0
- data/html/js/searcher.js.gz +0 -0
- data/html/table_of_contents.html +541 -0
- data/html/wwwjdic_gemspec.html +161 -0
- data/lib/wwwjdic/application.rb +233 -0
- data/lib/wwwjdic/constants.rb +113 -0
- data/lib/wwwjdic/locales/de.yml +29 -0
- data/lib/wwwjdic/locales/en.yml +29 -0
- data/lib/wwwjdic/locales/es.yml +29 -0
- data/lib/wwwjdic/locales/fr.yml +29 -0
- data/lib/wwwjdic/locales/hu.yml +29 -0
- data/lib/wwwjdic/locales/it.yml +29 -0
- data/lib/wwwjdic/locales/ja.yml +30 -0
- data/lib/wwwjdic/locales/nl.yml +29 -0
- data/lib/wwwjdic/locales/ru.yml +29 -0
- data/lib/wwwjdic/locales/sl.yml +29 -0
- data/lib/wwwjdic/locales/sv.yml +29 -0
- data/lib/wwwjdic/parser.rb +46 -0
- data/lib/wwwjdic/parsers/dict.rb +58 -0
- data/lib/wwwjdic/parsers/display.rb +50 -0
- data/lib/wwwjdic/parsers/key.rb +75 -0
- data/lib/wwwjdic/parsers/search.rb +60 -0
- data/lib/wwwjdic/parsers/server.rb +47 -0
- data/lib/wwwjdic/utils/downloader.rb +135 -0
- data/lib/wwwjdic/utils/raisers.rb +67 -0
- data/lib/wwwjdic/utils/splitter.rb +84 -0
- data/lib/wwwjdic/version.rb +20 -0
- data/lib/wwwjdic.rb +57 -0
- data/test/test_helper.rb +40 -0
- data/test/test_wwwjdic.rb +32 -0
- data/test/wwwjdic/locales/de.yml +22 -0
- data/test/wwwjdic/locales/en.yml +22 -0
- data/test/wwwjdic/locales/es.yml +22 -0
- data/test/wwwjdic/locales/fr.yml +22 -0
- data/test/wwwjdic/locales/hu.yml +22 -0
- data/test/wwwjdic/locales/it.yml +21 -0
- data/test/wwwjdic/locales/ja.yml +23 -0
- data/test/wwwjdic/locales/nl.yml +22 -0
- data/test/wwwjdic/locales/ru.yml +22 -0
- data/test/wwwjdic/locales/sl.yml +22 -0
- data/test/wwwjdic/locales/sv.yml +22 -0
- data/test/wwwjdic/locales/test_locales.rb +65 -0
- data/test/wwwjdic/parsers/test_dict.rb +73 -0
- data/test/wwwjdic/parsers/test_display.rb +51 -0
- data/test/wwwjdic/parsers/test_key.rb +52 -0
- data/test/wwwjdic/parsers/test_server.rb +51 -0
- data/test/wwwjdic/test_application.rb +219 -0
- data/test/wwwjdic/test_parsable_duck_type.rb +37 -0
- data/test/wwwjdic/utils/test_downloader.rb +41 -0
- data/test/wwwjdic/utils/test_raisers.rb +59 -0
- data/wwwjdic.gemspec +74 -0
- metadata +309 -0
@@ -0,0 +1,67 @@
|
|
1
|
+
#--
|
2
|
+
# wwwjdic
|
3
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
4
|
+
#
|
5
|
+
# This file is part of wwwjdic.
|
6
|
+
#
|
7
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
8
|
+
# under the terms of the GNU General Public License as published by the
|
9
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
10
|
+
# option) any later version.
|
11
|
+
#
|
12
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
13
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
14
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
15
|
+
# for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require 'i18n'
|
22
|
+
|
23
|
+
module WWWJDic
|
24
|
+
|
25
|
+
# This module is a simple collection of useful things and methods that
|
26
|
+
# I prefer to keep as DRYer as possible. Just include it and use the
|
27
|
+
# methods...
|
28
|
+
#
|
29
|
+
# Author:: {Marco Bresciani}[mailto:marcobresciani_1974@libero.it]
|
30
|
+
# Copyright:: Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
31
|
+
# License:: GNU General Public License version 3
|
32
|
+
module Utils
|
33
|
+
|
34
|
+
# This module contains some utility method to raise errors according
|
35
|
+
# to (possibly) common conditions.
|
36
|
+
#
|
37
|
+
# Author:: {Marco Bresciani}[mailto:marcobresciani_1974@libero.it]
|
38
|
+
# Copyright:: Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
39
|
+
# License:: GNU General Public License version 3
|
40
|
+
module Raisers
|
41
|
+
|
42
|
+
# Raises an +ArgumentError+ according to parameters, unless the
|
43
|
+
# +array+ contains the exact +value+.
|
44
|
+
def raiser_array(name = 'error.value', value = nil, array = nil)
|
45
|
+
unless value.nil?
|
46
|
+
raise ArgumentError, I18n.t(name, value: value) unless array.include? value
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Raises an +ArgumentError+ according to parameters, unless the
|
51
|
+
# +array+ contains a downcased +value+.
|
52
|
+
def raiser_downcase(name = 'error.value', value = nil, array = nil)
|
53
|
+
unless value.nil?
|
54
|
+
raise ArgumentError, I18n.t(name, value: value) unless array.include? value.downcase
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Raises an +ArgumentError+ according to parameters, unless the
|
59
|
+
# +array+ contains the number of the +value+.
|
60
|
+
def raiser_to_i(name = 'error.value', value = nil, array = nil)
|
61
|
+
unless value.nil?
|
62
|
+
raise ArgumentError, I18n.t(name, value: value) unless array.include? value.to_i
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
#--
|
2
|
+
# wwwjdic
|
3
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
4
|
+
#
|
5
|
+
# This file is part of wwwjdic.
|
6
|
+
#
|
7
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
8
|
+
# under the terms of the GNU General Public License as published by the
|
9
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
10
|
+
# option) any later version.
|
11
|
+
#
|
12
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
13
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
14
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
15
|
+
# for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require 'i18n'
|
22
|
+
require 'json'
|
23
|
+
|
24
|
+
require_relative '../constants'
|
25
|
+
|
26
|
+
module WWWJDic
|
27
|
+
# This class is a simple API to interact with WWWJDic Backboor
|
28
|
+
# Entry/API.
|
29
|
+
# Author:: {Marco Bresciani}[mailto:marcobresciani_1974@libero.it]
|
30
|
+
# Copyright:: Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
31
|
+
# License:: GNU General Public License version 3
|
32
|
+
class Splitter
|
33
|
+
# Creates a +Splitter+ object.
|
34
|
+
#
|
35
|
+
# Usage:: <tt>new_splitter = Splitter.new translation_content</tt>
|
36
|
+
# Returns:: a +Splitter+ object.
|
37
|
+
def initialize(translation)
|
38
|
+
@translation = translation.force_encoding('UTF-8')
|
39
|
+
end
|
40
|
+
|
41
|
+
def title
|
42
|
+
$1 if /<TITLE>(.*)<\/TITLE>/.match @translation
|
43
|
+
end
|
44
|
+
|
45
|
+
def translation
|
46
|
+
$1.strip if /<pre>(.*)<\/pre>/m.match @translation
|
47
|
+
end
|
48
|
+
|
49
|
+
def message
|
50
|
+
return $1.strip if /<p>(.*)<p>/m.match @translation unless @translation.nil?
|
51
|
+
$1 if /<p>(.*)<pre>/m.match @translation if @translation.nil?
|
52
|
+
end
|
53
|
+
|
54
|
+
def lines
|
55
|
+
result = Array.new
|
56
|
+
translation.each_line do |a_line|
|
57
|
+
stripped_line = a_line.strip
|
58
|
+
result.push stripped_line unless stripped_line.empty?
|
59
|
+
end
|
60
|
+
result unless result.empty?
|
61
|
+
end
|
62
|
+
|
63
|
+
def content
|
64
|
+
result = Array.new
|
65
|
+
lines.each do |a_line|
|
66
|
+
inner = Hash.new
|
67
|
+
if /(.*)\[/m.match a_line
|
68
|
+
inner[:word] = $1.strip
|
69
|
+
inner[:kana] = $1.strip if /\[(.*)\]/m.match a_line
|
70
|
+
inner[:text] = $1.strip if /\] \/(.*)\//m.match a_line
|
71
|
+
else
|
72
|
+
inner[:kana] = $1.strip if /^(.*)(\s)\//m.match a_line
|
73
|
+
inner[:word] = inner[:kana]
|
74
|
+
inner[:text] = $1.strip if /\/(.*)\//m.match a_line
|
75
|
+
end
|
76
|
+
inner[:meanings] = inner[:text].split('/') if inner[:text].include? '/'
|
77
|
+
result.push inner unless inner.empty?
|
78
|
+
end
|
79
|
+
|
80
|
+
result unless result.empty?
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#--
|
2
|
+
# wwwjdic
|
3
|
+
# Copyright © 2014, 2015, 2016 Marco Bresciani
|
4
|
+
#
|
5
|
+
# This file is part of wwwjdic.
|
6
|
+
#
|
7
|
+
# wwwjdic is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License
|
8
|
+
# as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
9
|
+
#
|
10
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
11
|
+
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License along with wwwjdic. If not, see
|
14
|
+
# <http://www.gnu.org/licenses/>.
|
15
|
+
#++
|
16
|
+
|
17
|
+
module WWWJDic
|
18
|
+
# Current version number for WWWJDic gem.
|
19
|
+
VERSION = '13.0.0'
|
20
|
+
end
|
data/lib/wwwjdic.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# wwwjdic
|
2
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
3
|
+
#
|
4
|
+
# This file is part of wwwjdic.
|
5
|
+
#
|
6
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
7
|
+
# under the terms of the GNU General Public License as published by the
|
8
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
9
|
+
# option) any later version.
|
10
|
+
#
|
11
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
14
|
+
# for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
require 'digest/md5'
|
20
|
+
require 'i18n'
|
21
|
+
require 'uri'
|
22
|
+
|
23
|
+
require_relative 'wwwjdic/application'
|
24
|
+
require_relative 'wwwjdic/parser'
|
25
|
+
require_relative 'wwwjdic/parsers/dict'
|
26
|
+
require_relative 'wwwjdic/parsers/display'
|
27
|
+
require_relative 'wwwjdic/parsers/key'
|
28
|
+
require_relative 'wwwjdic/parsers/search'
|
29
|
+
require_relative 'wwwjdic/parsers/server'
|
30
|
+
|
31
|
+
# Author:: {Marco Bresciani}[mailto:marcobresciani_1974@libero.it]
|
32
|
+
# Copyright:: Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
33
|
+
# License:: GNU General Public License version 3
|
34
|
+
module WWWJDic
|
35
|
+
|
36
|
+
# Creates a new WWWJDic object (from the verb 'to Breen'... :) ).
|
37
|
+
#
|
38
|
+
# Usage::
|
39
|
+
# - <tt>new_wwwjdic = WWWJDic::breener</tt>
|
40
|
+
# Returns:: a +WWWJDic+ object.
|
41
|
+
def self.breener
|
42
|
+
WWWJDic.new(parser)
|
43
|
+
end
|
44
|
+
|
45
|
+
# ------------------------------ here starts the list of private methods
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
# Provides the parameters' parsers object.
|
50
|
+
def self.parser
|
51
|
+
parsers = {dict: Parsers::Dict.new, display: Parsers::Display.new,
|
52
|
+
key: Parsers::Key.new, search: Parsers::Search.new,
|
53
|
+
server: Parsers::Server.new}
|
54
|
+
|
55
|
+
Parser.new parsers
|
56
|
+
end
|
57
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#--
|
2
|
+
# wwwjdic
|
3
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
4
|
+
#
|
5
|
+
# This file is part of wwwjdic.
|
6
|
+
#
|
7
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
8
|
+
# under the terms of the GNU General Public License as published by the
|
9
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
10
|
+
# option) any later version.
|
11
|
+
#
|
12
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
13
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
14
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
15
|
+
# for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require 'i18n'
|
22
|
+
require 'json'
|
23
|
+
require 'minitest/autorun'
|
24
|
+
require 'minitest/spec'
|
25
|
+
require 'set'
|
26
|
+
|
27
|
+
require_relative '../lib/wwwjdic'
|
28
|
+
require_relative '../lib/wwwjdic/constants'
|
29
|
+
require_relative '../lib/wwwjdic/parsers/dict'
|
30
|
+
require_relative '../lib/wwwjdic/parsers/display'
|
31
|
+
require_relative '../lib/wwwjdic/parsers/key'
|
32
|
+
require_relative '../lib/wwwjdic/parsers/server'
|
33
|
+
require_relative '../lib/wwwjdic/utils/downloader'
|
34
|
+
|
35
|
+
require_relative 'wwwjdic/test_parsable_duck_type'
|
36
|
+
|
37
|
+
module WWWJDic
|
38
|
+
# Example basic URI (profile part) for testing purposes.
|
39
|
+
TEST_REFERENCE_URI = URI_DEFAULT + DICTIONARY_CODES[0] + DISPLAY[:regular]
|
40
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#--
|
2
|
+
# wwwjdic
|
3
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
4
|
+
#
|
5
|
+
# This file is part of wwwjdic.
|
6
|
+
#
|
7
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
8
|
+
# under the terms of the GNU General Public License as published by the
|
9
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
10
|
+
# option) any later version.
|
11
|
+
#
|
12
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
13
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
14
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
15
|
+
# for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require_relative 'test_helper'
|
22
|
+
|
23
|
+
describe WWWJDic::WWWJDic do
|
24
|
+
describe 'when created' do
|
25
|
+
subject {WWWJDic::breener}
|
26
|
+
|
27
|
+
it 'must create a wwwjdic object' do
|
28
|
+
subject.wont_be_nil
|
29
|
+
subject.must_be_instance_of WWWJDic::WWWJDic
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# wwwjdic
|
2
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
3
|
+
#
|
4
|
+
# This file is part of wwwjdic.
|
5
|
+
#
|
6
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
7
|
+
# under the terms of the GNU General Public License as published by the
|
8
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
9
|
+
# option) any later version.
|
10
|
+
#
|
11
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
14
|
+
# for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
de:
|
20
|
+
test:
|
21
|
+
kotoba: Sprache
|
22
|
+
test: test data
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# wwwjdic
|
2
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
3
|
+
#
|
4
|
+
# This file is part of wwwjdic.
|
5
|
+
#
|
6
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
7
|
+
# under the terms of the GNU General Public License as published by the
|
8
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
9
|
+
# option) any later version.
|
10
|
+
#
|
11
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
14
|
+
# for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
en:
|
20
|
+
test:
|
21
|
+
kotoba: word
|
22
|
+
test: test data
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# wwwjdic
|
2
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
3
|
+
#
|
4
|
+
# This file is part of wwwjdic.
|
5
|
+
#
|
6
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
7
|
+
# under the terms of the GNU General Public License as published by the
|
8
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
9
|
+
# option) any later version.
|
10
|
+
#
|
11
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
14
|
+
# for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
es:
|
20
|
+
test:
|
21
|
+
kotoba: palabra
|
22
|
+
test: test data
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# wwwjdic
|
2
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
3
|
+
#
|
4
|
+
# This file is part of wwwjdic.
|
5
|
+
#
|
6
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
7
|
+
# under the terms of the GNU General Public License as published by the
|
8
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
9
|
+
# option) any later version.
|
10
|
+
#
|
11
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
14
|
+
# for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
fr:
|
20
|
+
test:
|
21
|
+
kotoba: mot
|
22
|
+
test: test data
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# wwwjdic
|
2
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
3
|
+
#
|
4
|
+
# This file is part of wwwjdic.
|
5
|
+
#
|
6
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
7
|
+
# under the terms of the GNU General Public License as published by the
|
8
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
9
|
+
# option) any later version.
|
10
|
+
#
|
11
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
14
|
+
# for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
hu:
|
20
|
+
test:
|
21
|
+
kotoba: hír
|
22
|
+
test: test data
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# wwwjdic
|
2
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
3
|
+
#
|
4
|
+
# This file is part of wwwjdic.
|
5
|
+
#
|
6
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
7
|
+
# under the terms of the GNU General Public License as published by the
|
8
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
9
|
+
# option) any later version.
|
10
|
+
#
|
11
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
14
|
+
# for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
it:
|
20
|
+
kotoba: parola
|
21
|
+
test: dato di prova
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# wwwjdic
|
2
|
+
# Copyright © 2013 新部裕
|
3
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 新部裕, Marco Bresciani
|
4
|
+
#
|
5
|
+
# This file is part of wwwjdic.
|
6
|
+
#
|
7
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
8
|
+
# under the terms of the GNU General Public License as published by the
|
9
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
10
|
+
# option) any later version.
|
11
|
+
#
|
12
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
13
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
14
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
15
|
+
# for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
ja:
|
21
|
+
test:
|
22
|
+
kotoba: 言葉
|
23
|
+
test: 試験データ
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# wwwjdic
|
2
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
3
|
+
#
|
4
|
+
# This file is part of wwwjdic.
|
5
|
+
#
|
6
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
7
|
+
# under the terms of the GNU General Public License as published by the
|
8
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
9
|
+
# option) any later version.
|
10
|
+
#
|
11
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
14
|
+
# for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
nl:
|
20
|
+
test:
|
21
|
+
kotoba: taal
|
22
|
+
test: test data
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# wwwjdic
|
2
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
3
|
+
#
|
4
|
+
# This file is part of wwwjdic.
|
5
|
+
#
|
6
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
7
|
+
# under the terms of the GNU General Public License as published by the
|
8
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
9
|
+
# option) any later version.
|
10
|
+
#
|
11
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
14
|
+
# for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
ru:
|
20
|
+
test:
|
21
|
+
kotoba: слово
|
22
|
+
test: test data
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# wwwjdic
|
2
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
3
|
+
#
|
4
|
+
# This file is part of wwwjdic.
|
5
|
+
#
|
6
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
7
|
+
# under the terms of the GNU General Public License as published by the
|
8
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
9
|
+
# option) any later version.
|
10
|
+
#
|
11
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
14
|
+
# for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
sl:
|
20
|
+
test:
|
21
|
+
kotoba: beseda
|
22
|
+
test: test data
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# wwwjdic
|
2
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
3
|
+
#
|
4
|
+
# This file is part of wwwjdic.
|
5
|
+
#
|
6
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
7
|
+
# under the terms of the GNU General Public License as published by the
|
8
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
9
|
+
# option) any later version.
|
10
|
+
#
|
11
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
12
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
13
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
14
|
+
# for more details.
|
15
|
+
#
|
16
|
+
# You should have received a copy of the GNU General Public License
|
17
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
18
|
+
|
19
|
+
sv:
|
20
|
+
test:
|
21
|
+
kotoba: ord
|
22
|
+
test: test data
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#--
|
2
|
+
# wwwjdic
|
3
|
+
# Copyright © 2014, 2015, 2016, 2017, 2018, 2019 Marco Bresciani
|
4
|
+
#
|
5
|
+
# This file is part of wwwjdic.
|
6
|
+
#
|
7
|
+
# wwwjdic is free software: you can redistribute it and/or modify it
|
8
|
+
# under the terms of the GNU General Public License as published by the
|
9
|
+
# Free Software Foundation, either version 3 of the License, or (at your
|
10
|
+
# option) any later version.
|
11
|
+
#
|
12
|
+
# wwwjdic is distributed in the hope that it will be useful, but WITHOUT
|
13
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
14
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
15
|
+
# for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with wwwjdic. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#++
|
20
|
+
|
21
|
+
require_relative '../../test_helper'
|
22
|
+
|
23
|
+
describe WWWJDic::WWWJDic do
|
24
|
+
describe 'when using I18N' do
|
25
|
+
|
26
|
+
RELATIVE_PATH = '/../../../lib/wwwjdic/locales/'
|
27
|
+
|
28
|
+
before do
|
29
|
+
I18n.load_path = Dir[File.join(File.dirname(__FILE__), RELATIVE_PATH, '*.yml')]
|
30
|
+
end
|
31
|
+
|
32
|
+
subject {I18n.available_locales}
|
33
|
+
|
34
|
+
it 'shall return at least one available locale' do
|
35
|
+
subject.wont_be_nil
|
36
|
+
subject.wont_be_empty
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'shall contain at least English and Italiano' do
|
40
|
+
subject.must_include :en
|
41
|
+
subject.must_include :it
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'shall contain a test.test signpost for each available locale' do
|
45
|
+
def load_yaml_file(locale)
|
46
|
+
filename = File::join(File::dirname(__FILE__), RELATIVE_PATH, "#{locale}.yml")
|
47
|
+
filename = File::expand_path filename
|
48
|
+
YAML::load(File::open "#{filename}")
|
49
|
+
end
|
50
|
+
|
51
|
+
subject.each do |locale|
|
52
|
+
I18n.locale = locale
|
53
|
+
|
54
|
+
translation = load_yaml_file(locale)
|
55
|
+
translation["#{locale}"]['test']['test'].wont_be_nil
|
56
|
+
|
57
|
+
a_string = I18n.t('test.test')
|
58
|
+
a_string.wont_be_nil
|
59
|
+
a_string.wont_be_empty
|
60
|
+
a_string.wont_include 'translation missing'
|
61
|
+
a_string.must_equal translation["#{locale}"]['test']['test']
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|