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.
Files changed (130) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +419 -0
  3. data/COPYING.md +675 -0
  4. data/Gemfile +21 -0
  5. data/README.md +303 -0
  6. data/Rakefile +52 -0
  7. data/acknowledgements.md +55 -0
  8. data/authors.md +67 -0
  9. data/copyright.md +377 -0
  10. data/examples/basics.rb +117 -0
  11. data/examples/translate.rb +128 -0
  12. data/examples/uri.rb +129 -0
  13. data/html/CHANGELOG.html +597 -0
  14. data/html/COPYING_md.html +389 -0
  15. data/html/Gemfile.html +104 -0
  16. data/html/Object.html +185 -0
  17. data/html/README_md.html +343 -0
  18. data/html/Rakefile.html +137 -0
  19. data/html/WWWJDic/ParsableDuckType.html +159 -0
  20. data/html/WWWJDic/Parser.html +233 -0
  21. data/html/WWWJDic/Parsers/Dict.html +191 -0
  22. data/html/WWWJDic/Parsers/Display.html +184 -0
  23. data/html/WWWJDic/Parsers/Key.html +221 -0
  24. data/html/WWWJDic/Parsers/Search.html +214 -0
  25. data/html/WWWJDic/Parsers/Server.html +182 -0
  26. data/html/WWWJDic/Parsers.html +96 -0
  27. data/html/WWWJDic/Splitter.html +378 -0
  28. data/html/WWWJDic/Utils/Downloader/Downloader.html +227 -0
  29. data/html/WWWJDic/Utils/Downloader.html +108 -0
  30. data/html/WWWJDic/Utils/Raisers.html +235 -0
  31. data/html/WWWJDic/Utils.html +108 -0
  32. data/html/WWWJDic/WWWJDic.html +715 -0
  33. data/html/WWWJDic.html +348 -0
  34. data/html/acknowledgements_md.html +149 -0
  35. data/html/authors_md.html +181 -0
  36. data/html/copyright_md.html +422 -0
  37. data/html/created.rid +59 -0
  38. data/html/css/fonts.css +167 -0
  39. data/html/css/rdoc.css +590 -0
  40. data/html/fonts/Lato-Light.ttf +0 -0
  41. data/html/fonts/Lato-LightItalic.ttf +0 -0
  42. data/html/fonts/Lato-Regular.ttf +0 -0
  43. data/html/fonts/Lato-RegularItalic.ttf +0 -0
  44. data/html/fonts/SourceCodePro-Bold.ttf +0 -0
  45. data/html/fonts/SourceCodePro-Regular.ttf +0 -0
  46. data/html/images/add.png +0 -0
  47. data/html/images/arrow_up.png +0 -0
  48. data/html/images/brick.png +0 -0
  49. data/html/images/brick_link.png +0 -0
  50. data/html/images/bug.png +0 -0
  51. data/html/images/bullet_black.png +0 -0
  52. data/html/images/bullet_toggle_minus.png +0 -0
  53. data/html/images/bullet_toggle_plus.png +0 -0
  54. data/html/images/date.png +0 -0
  55. data/html/images/delete.png +0 -0
  56. data/html/images/find.png +0 -0
  57. data/html/images/loadingAnimation.gif +0 -0
  58. data/html/images/macFFBgHack.png +0 -0
  59. data/html/images/package.png +0 -0
  60. data/html/images/page_green.png +0 -0
  61. data/html/images/page_white_text.png +0 -0
  62. data/html/images/page_white_width.png +0 -0
  63. data/html/images/plugin.png +0 -0
  64. data/html/images/ruby.png +0 -0
  65. data/html/images/tag_blue.png +0 -0
  66. data/html/images/tag_green.png +0 -0
  67. data/html/images/transparent.png +0 -0
  68. data/html/images/wrench.png +0 -0
  69. data/html/images/wrench_orange.png +0 -0
  70. data/html/images/zoom.png +0 -0
  71. data/html/index.html +363 -0
  72. data/html/js/darkfish.js +161 -0
  73. data/html/js/jquery.js +4 -0
  74. data/html/js/navigation.js +141 -0
  75. data/html/js/navigation.js.gz +0 -0
  76. data/html/js/search.js +109 -0
  77. data/html/js/search_index.js +1 -0
  78. data/html/js/search_index.js.gz +0 -0
  79. data/html/js/searcher.js +229 -0
  80. data/html/js/searcher.js.gz +0 -0
  81. data/html/table_of_contents.html +541 -0
  82. data/html/wwwjdic_gemspec.html +161 -0
  83. data/lib/wwwjdic/application.rb +233 -0
  84. data/lib/wwwjdic/constants.rb +113 -0
  85. data/lib/wwwjdic/locales/de.yml +29 -0
  86. data/lib/wwwjdic/locales/en.yml +29 -0
  87. data/lib/wwwjdic/locales/es.yml +29 -0
  88. data/lib/wwwjdic/locales/fr.yml +29 -0
  89. data/lib/wwwjdic/locales/hu.yml +29 -0
  90. data/lib/wwwjdic/locales/it.yml +29 -0
  91. data/lib/wwwjdic/locales/ja.yml +30 -0
  92. data/lib/wwwjdic/locales/nl.yml +29 -0
  93. data/lib/wwwjdic/locales/ru.yml +29 -0
  94. data/lib/wwwjdic/locales/sl.yml +29 -0
  95. data/lib/wwwjdic/locales/sv.yml +29 -0
  96. data/lib/wwwjdic/parser.rb +46 -0
  97. data/lib/wwwjdic/parsers/dict.rb +58 -0
  98. data/lib/wwwjdic/parsers/display.rb +50 -0
  99. data/lib/wwwjdic/parsers/key.rb +75 -0
  100. data/lib/wwwjdic/parsers/search.rb +60 -0
  101. data/lib/wwwjdic/parsers/server.rb +47 -0
  102. data/lib/wwwjdic/utils/downloader.rb +135 -0
  103. data/lib/wwwjdic/utils/raisers.rb +67 -0
  104. data/lib/wwwjdic/utils/splitter.rb +84 -0
  105. data/lib/wwwjdic/version.rb +20 -0
  106. data/lib/wwwjdic.rb +57 -0
  107. data/test/test_helper.rb +40 -0
  108. data/test/test_wwwjdic.rb +32 -0
  109. data/test/wwwjdic/locales/de.yml +22 -0
  110. data/test/wwwjdic/locales/en.yml +22 -0
  111. data/test/wwwjdic/locales/es.yml +22 -0
  112. data/test/wwwjdic/locales/fr.yml +22 -0
  113. data/test/wwwjdic/locales/hu.yml +22 -0
  114. data/test/wwwjdic/locales/it.yml +21 -0
  115. data/test/wwwjdic/locales/ja.yml +23 -0
  116. data/test/wwwjdic/locales/nl.yml +22 -0
  117. data/test/wwwjdic/locales/ru.yml +22 -0
  118. data/test/wwwjdic/locales/sl.yml +22 -0
  119. data/test/wwwjdic/locales/sv.yml +22 -0
  120. data/test/wwwjdic/locales/test_locales.rb +65 -0
  121. data/test/wwwjdic/parsers/test_dict.rb +73 -0
  122. data/test/wwwjdic/parsers/test_display.rb +51 -0
  123. data/test/wwwjdic/parsers/test_key.rb +52 -0
  124. data/test/wwwjdic/parsers/test_server.rb +51 -0
  125. data/test/wwwjdic/test_application.rb +219 -0
  126. data/test/wwwjdic/test_parsable_duck_type.rb +37 -0
  127. data/test/wwwjdic/utils/test_downloader.rb +41 -0
  128. data/test/wwwjdic/utils/test_raisers.rb +59 -0
  129. data/wwwjdic.gemspec +74 -0
  130. 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
@@ -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