konjac 0.0.1 → 0.0.2
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.
- data/.autotest +2 -0
- data/.gitignore +5 -4
- data/.rspec +1 -0
- data/Gemfile +4 -4
- data/LICENSE +19 -19
- data/README.md +112 -36
- data/Rakefile +1 -1
- data/bin/konjac +13 -13
- data/konjac.gemspec +28 -24
- data/lib/konjac/cli.rb +66 -60
- data/lib/konjac/dictionary.rb +118 -58
- data/lib/konjac/{exceptions.rb → exception.rb} +6 -5
- data/lib/konjac/language.rb +256 -0
- data/lib/konjac/translator.rb +24 -33
- data/lib/konjac/utils.rb +29 -0
- data/lib/konjac/version.rb +3 -3
- data/lib/konjac.rb +12 -10
- data/spec/dictionary_spec.rb +9 -0
- data/spec/language_spec.rb +31 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/utils_spec.rb +13 -0
- metadata +67 -12
- data/lib/konjac/manager.rb +0 -0
data/.autotest
ADDED
data/.gitignore
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
*.gem
|
2
|
-
.bundle
|
3
|
-
|
4
|
-
|
1
|
+
*.gem
|
2
|
+
.bundle
|
3
|
+
.DS_Store
|
4
|
+
Gemfile.lock
|
5
|
+
pkg/*
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in konjac.gemspec
|
4
|
-
gemspec
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in konjac.gemspec
|
4
|
+
gemspec
|
data/LICENSE
CHANGED
@@ -1,19 +1,19 @@
|
|
1
|
-
Copyright (c) 2012 Bryan McKelvey
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
-
this software and associated documentation files (the "Software"), to deal in
|
5
|
-
the Software without restriction, including without limitation the rights to
|
6
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
-
so, subject to the following conditions:
|
9
|
-
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
11
|
-
copies or substantial portions of the Software.
|
12
|
-
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
-
SOFTWARE.
|
1
|
+
Copyright (c) 2012 Bryan McKelvey
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
8
|
+
so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,36 +1,112 @@
|
|
1
|
-
konjac
|
2
|
-
======
|
3
|
-
|
4
|
-
A Ruby command-line utility for translating files using a YAML wordlist
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
1
|
+
konjac
|
2
|
+
======
|
3
|
+
|
4
|
+
A Ruby command-line utility for translating files using a YAML wordlist
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
|
9
|
+
### Stable
|
10
|
+
|
11
|
+
With [Ruby](http://www.ruby-lang.org/en/downloads/) installed, run the
|
12
|
+
following in your terminal:
|
13
|
+
|
14
|
+
gem install konjac
|
15
|
+
|
16
|
+
### Development
|
17
|
+
|
18
|
+
With Ruby and [Git](http://help.github.com/set-up-git-redirect) installed,
|
19
|
+
navigate in your command line to a directory of your choice, then run:
|
20
|
+
|
21
|
+
git clone git://github.com/brymck/konjac.git
|
22
|
+
cd konjac
|
23
|
+
rake install
|
24
|
+
|
25
|
+
Usage
|
26
|
+
-----
|
27
|
+
|
28
|
+
Create a file in `~/.konjac/` called `dict.yml`. The file should have the
|
29
|
+
following format:
|
30
|
+
|
31
|
+
### Languages
|
32
|
+
|
33
|
+
All languages for use within a particular dictionary file file must be described
|
34
|
+
|
35
|
+
languages:
|
36
|
+
en:
|
37
|
+
- english
|
38
|
+
- eng
|
39
|
+
ja:
|
40
|
+
- japanese
|
41
|
+
- jpn
|
42
|
+
|
43
|
+
...
|
44
|
+
|
45
|
+
terms:
|
46
|
+
-
|
47
|
+
en: japanese
|
48
|
+
ja: nihongo
|
49
|
+
-
|
50
|
+
en: book
|
51
|
+
ja: hon
|
52
|
+
|
53
|
+
You can then translate a file using the command line like so:
|
54
|
+
|
55
|
+
konjac translate *.txt from japanese to english
|
56
|
+
|
57
|
+
|
58
|
+
Example
|
59
|
+
-------
|
60
|
+
|
61
|
+
~/.konjac/dict.yml:
|
62
|
+
|
63
|
+
-
|
64
|
+
en: I
|
65
|
+
ja: 僕
|
66
|
+
-
|
67
|
+
en: like
|
68
|
+
ja: 好き
|
69
|
+
-
|
70
|
+
en:
|
71
|
+
en: dog
|
72
|
+
ja: 犬
|
73
|
+
ja:
|
74
|
+
ja: 犬
|
75
|
+
en: dogs?
|
76
|
+
- # Periods
|
77
|
+
en:
|
78
|
+
en: ". "
|
79
|
+
ja: 。
|
80
|
+
ja:
|
81
|
+
ja: 。
|
82
|
+
en: !ruby/regexp '/\.\s?/'
|
83
|
+
- # Spaces between non-ASCII characters
|
84
|
+
en:
|
85
|
+
en: " "
|
86
|
+
ja: !ruby/regexp '/\s{2,}/'
|
87
|
+
ja:
|
88
|
+
ja: "\\1\\2"
|
89
|
+
en: !ruby/regexp '/([^a-z])\s([^a-z])/'
|
90
|
+
|
91
|
+
~/.konjac/test_en.txt
|
92
|
+
|
93
|
+
I like dogs.
|
94
|
+
|
95
|
+
Run
|
96
|
+
|
97
|
+
konjac translate ~/.konjac/test_en.txt into japanese
|
98
|
+
|
99
|
+
~/.konjac/test_ja.txt (result):
|
100
|
+
|
101
|
+
僕好き犬。
|
102
|
+
|
103
|
+
Now, obviously that does require some fiddling to make it more grammatical, but
|
104
|
+
it's a start (=> `僕は犬が好きだ。`)
|
105
|
+
|
106
|
+
Name
|
107
|
+
----
|
108
|
+
|
109
|
+
*Hon'yaku* means "translation" in Japanese. This utility relies on a YAML
|
110
|
+
wordlist. *Konnyaku* (Japanese for "konjac") rhymes with *hon'yaku* and is a
|
111
|
+
type of yam. Also, Doraemon had something called a *hon'yaku konnyaku* that
|
112
|
+
allowed one to listen to animals. But I digress.
|
data/Rakefile
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/konjac
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
#!/usr/bin/env ruby -Ku
|
2
|
-
require "konjac"
|
3
|
-
begin
|
4
|
-
Konjac::CLI.start
|
5
|
-
rescue Interrupt => e
|
6
|
-
# Konjac.ui.error "\nQuitting..."
|
7
|
-
# Konjac.ui.debug e.backtrace.join("\n")
|
8
|
-
exit 1
|
9
|
-
rescue SystemExit => e
|
10
|
-
exit e.status
|
11
|
-
rescue Exception => e
|
12
|
-
raise e
|
13
|
-
end
|
1
|
+
#!/usr/bin/env ruby -Ku
|
2
|
+
require "konjac"
|
3
|
+
begin
|
4
|
+
Konjac::CLI.start
|
5
|
+
rescue Interrupt => e
|
6
|
+
# Konjac.ui.error "\nQuitting..."
|
7
|
+
# Konjac.ui.debug e.backtrace.join("\n")
|
8
|
+
exit 1
|
9
|
+
rescue SystemExit => e
|
10
|
+
exit e.status
|
11
|
+
rescue Exception => e
|
12
|
+
raise e
|
13
|
+
end
|
data/konjac.gemspec
CHANGED
@@ -1,24 +1,28 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "konjac/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |s|
|
6
|
-
s.name = "konjac"
|
7
|
-
s.version = Konjac::VERSION
|
8
|
-
s.authors = ["Bryan McKelvey"]
|
9
|
-
s.email = ["bryan.mckelvey@gmail.com"]
|
10
|
-
s.homepage = "http://brymck.herokuapp.com/"
|
11
|
-
s.summary = %q{A Ruby command-line utility for translating files using a YAML wordlist}
|
12
|
-
s.description = %q{A Ruby command-line utility for translating files using a YAML wordlist}
|
13
|
-
|
14
|
-
s.rubyforge_project = "konjac"
|
15
|
-
|
16
|
-
s.files = `git ls-files`.split("\n")
|
17
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
-
s.require_paths = ["lib"]
|
20
|
-
|
21
|
-
# specify any dependencies here; for example:
|
22
|
-
s.add_development_dependency "
|
23
|
-
s.
|
24
|
-
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "konjac/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "konjac"
|
7
|
+
s.version = Konjac::VERSION
|
8
|
+
s.authors = ["Bryan McKelvey"]
|
9
|
+
s.email = ["bryan.mckelvey@gmail.com"]
|
10
|
+
s.homepage = "http://brymck.herokuapp.com/"
|
11
|
+
s.summary = %q{A Ruby command-line utility for translating files using a YAML wordlist}
|
12
|
+
s.description = %q{A Ruby command-line utility for translating files using a YAML wordlist}
|
13
|
+
|
14
|
+
s.rubyforge_project = "konjac"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
s.add_development_dependency "bundler"
|
23
|
+
s.add_development_dependency "rspec"
|
24
|
+
s.add_development_dependency "sdoc"
|
25
|
+
s.add_development_dependency "autotest"
|
26
|
+
s.add_development_dependency "autotest-fsevent"
|
27
|
+
s.add_development_dependency "autotest-growl"
|
28
|
+
end
|
data/lib/konjac/cli.rb
CHANGED
@@ -1,60 +1,66 @@
|
|
1
|
-
module Konjac
|
2
|
-
module CLI
|
3
|
-
class << self
|
4
|
-
def start
|
5
|
-
show_help if ARGV.empty?
|
6
|
-
|
7
|
-
# Subcommand
|
8
|
-
case ARGV.shift
|
9
|
-
when "translate"
|
10
|
-
translate
|
11
|
-
when "add"
|
12
|
-
when "help"
|
13
|
-
show_help
|
14
|
-
else
|
15
|
-
raise ArgumentError.new("Valid commands are translate or add")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def show_help
|
20
|
-
puts "Help"
|
21
|
-
exit 0
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def translate
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
1
|
+
module Konjac
|
2
|
+
module CLI
|
3
|
+
class << self
|
4
|
+
def start
|
5
|
+
show_help if ARGV.empty?
|
6
|
+
|
7
|
+
# Subcommand
|
8
|
+
case ARGV.shift
|
9
|
+
when "translate"
|
10
|
+
translate
|
11
|
+
when "add"
|
12
|
+
when "help"
|
13
|
+
show_help
|
14
|
+
else
|
15
|
+
raise ArgumentError.new("Valid commands are translate or add")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def show_help
|
20
|
+
puts "Help"
|
21
|
+
exit 0
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def translate
|
27
|
+
# Get from language
|
28
|
+
from_index = ARGV.index("from")
|
29
|
+
unless from_index.nil?
|
30
|
+
ARGV.delete_at from_index
|
31
|
+
from_lang = ARGV.delete_at(from_index)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Get to language
|
35
|
+
to_index = ARGV.index("to") || ARGV.index("into")
|
36
|
+
if to_index.nil?
|
37
|
+
raise Exception::InvalidLanguageError.new("You must supply a to language")
|
38
|
+
else
|
39
|
+
ARGV.delete_at to_index
|
40
|
+
to_lang = ARGV.delete_at(to_index)
|
41
|
+
end
|
42
|
+
|
43
|
+
# Get a list of files to translate
|
44
|
+
files = []
|
45
|
+
while !ARGV.empty?
|
46
|
+
files += Dir.glob(File.expand_path(ARGV.shift))
|
47
|
+
end
|
48
|
+
raise Exception::FileNotFoundError.new("File not found") if files.empty?
|
49
|
+
files.uniq!
|
50
|
+
|
51
|
+
# Determine from language from first filename if not overridden
|
52
|
+
if from_lang.nil?
|
53
|
+
from_lang = Utils.extract_language_code_from_filename(files[0])
|
54
|
+
if from_lang.nil?
|
55
|
+
raise Exception::InvalidLanguageError.new("You must supply a to language")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
from_lang = Language.find(from_lang).to_s
|
60
|
+
to_lang = Language.find(to_lang).to_s
|
61
|
+
|
62
|
+
Translator.translate files, from_lang, to_lang
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/lib/konjac/dictionary.rb
CHANGED
@@ -1,58 +1,118 @@
|
|
1
|
-
require "yaml"
|
2
|
-
|
3
|
-
module Konjac
|
4
|
-
module Dictionary
|
5
|
-
class << self
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
@
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
end
|
1
|
+
require "yaml"
|
2
|
+
|
3
|
+
module Konjac
|
4
|
+
module Dictionary
|
5
|
+
class << self
|
6
|
+
attr_accessor :from_lang, :to_lang, :path
|
7
|
+
|
8
|
+
def load(from_lang, to_lang, opts = {})
|
9
|
+
# Set defaults for optional arguments
|
10
|
+
opts = { :force => false, :name => "dict" }.merge(opts)
|
11
|
+
|
12
|
+
# Allow both symbol and string arguments for languages
|
13
|
+
from_lang = from_lang.to_s
|
14
|
+
to_lang = to_lang.to_s
|
15
|
+
|
16
|
+
# Build a regex template for the from language
|
17
|
+
from_template = build_regex_template(from_lang)
|
18
|
+
|
19
|
+
# Get full path from name
|
20
|
+
full_path = File.expand_path("~/.konjac/#{opts[:name]}.yml")
|
21
|
+
|
22
|
+
return @pairs if loaded?(from_lang, to_lang, full_path) || opts[:force]
|
23
|
+
|
24
|
+
# Save variables to cache so we can avoid repetitive requests
|
25
|
+
cache_load from_lang, to_lang, opts
|
26
|
+
|
27
|
+
# Make sure dictionary exists and load
|
28
|
+
verify_dictionary_exists full_path
|
29
|
+
@dictionary = ::YAML.load_file(full_path)
|
30
|
+
|
31
|
+
# Build a list of search and replace pairs
|
32
|
+
@pairs = []
|
33
|
+
@dictionary.each do |term|
|
34
|
+
if term.has_key?(to_lang)
|
35
|
+
# Build to term depending on whether it's a hash for complex
|
36
|
+
# matches or a simple string
|
37
|
+
if term[to_lang].is_a?(Hash)
|
38
|
+
to_term = term[to_lang][to_lang]
|
39
|
+
|
40
|
+
if term[to_lang].has_key?(from_lang)
|
41
|
+
from_term = term[to_lang][from_lang]
|
42
|
+
end
|
43
|
+
else
|
44
|
+
to_term = term[to_lang]
|
45
|
+
end
|
46
|
+
|
47
|
+
# Build from term if it doesn't already exist
|
48
|
+
if term.has_key?(from_lang) && from_term.nil?
|
49
|
+
from_term = term[from_lang]
|
50
|
+
end
|
51
|
+
|
52
|
+
unless from_term.nil?
|
53
|
+
# Build a regular expression if it isn't already one
|
54
|
+
# Note that this will apply word boundary rules, so to avoid them
|
55
|
+
# create a regular expression in the dictionary file
|
56
|
+
unless from_term.is_a?(Regexp)
|
57
|
+
from_term = Regexp.new(from_template % from_term)
|
58
|
+
end
|
59
|
+
|
60
|
+
@pairs << [ from_term, to_term ]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
@pairs
|
66
|
+
end
|
67
|
+
|
68
|
+
# Verifies whether the dictionary exists on the specified path, creating
|
69
|
+
# a blank file if it doesn't
|
70
|
+
def verify_dictionary_exists(full_path)
|
71
|
+
unless File.file?(full_path)
|
72
|
+
FileUtils.mkpath File.dirname(full_path)
|
73
|
+
FileUtils.touch full_path
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Tests whether the same from language, to language and dictionary path
|
78
|
+
# have been loaded before
|
79
|
+
def loaded?(from_lang, to_lang, full_path)
|
80
|
+
(@from_lang == from_lang) &&
|
81
|
+
(@to_lang == to_lang ) &&
|
82
|
+
(@path == full_path)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Builds a regular expression template for the language depending on
|
86
|
+
# whether that language has word boundaries
|
87
|
+
def build_regex_template(lang)
|
88
|
+
if Language.has_spaces?(lang)
|
89
|
+
"\\b%s\\b"
|
90
|
+
else
|
91
|
+
"%s"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
private
|
96
|
+
|
97
|
+
def parse_language(lang)
|
98
|
+
if @dictionary["languages"].has_key?(lang)
|
99
|
+
return lang
|
100
|
+
else
|
101
|
+
@dictionary["languages"].each do |main, alternatives|
|
102
|
+
return main if alternatives.include?(lang)
|
103
|
+
end
|
104
|
+
|
105
|
+
# If no match is found, give an error message and exit
|
106
|
+
raise Exceptions::InvalidLanguageError.new("No match found for language \"#{lang}\"")
|
107
|
+
exit 1
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def cache_load(from_lang, to_lang, opts)
|
112
|
+
@from_lang = from_lang
|
113
|
+
@to_lang = to_lang
|
114
|
+
@path = path
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
|
-
module Konjac
|
2
|
-
module
|
3
|
-
class
|
4
|
-
|
5
|
-
end
|
1
|
+
module Konjac
|
2
|
+
module Exception
|
3
|
+
class FileNotFoundError < StandardError; end
|
4
|
+
class InvalidLanguageError < StandardError; end
|
5
|
+
end
|
6
|
+
end
|
@@ -0,0 +1,256 @@
|
|
1
|
+
module Konjac
|
2
|
+
module Language
|
3
|
+
class << self
|
4
|
+
LANGUAGES_WITHOUT_SPACES = [:ar, :he, :ja, :zh]
|
5
|
+
LIST = {
|
6
|
+
:ab => [:abkhazian, :abk],
|
7
|
+
:aa => [:afar, :aar],
|
8
|
+
:af => [:afrikaans, :afr],
|
9
|
+
:ak => [:akan, :aka],
|
10
|
+
:sq => [:albanian, :alb, :sqi],
|
11
|
+
:am => [:amharic, :amh],
|
12
|
+
:ar => [:arabic, :ara],
|
13
|
+
:an => [:aragonese, :arg],
|
14
|
+
:hy => [:armenian, :arm, :hye],
|
15
|
+
:as => [:assamese, :asm],
|
16
|
+
:av => [:avaric, :ava],
|
17
|
+
:ae => [:avestan, :ave],
|
18
|
+
:ay => [:aymara, :aym],
|
19
|
+
:az => [:azerbaijani, :aze],
|
20
|
+
:bm => [:bambara, :bam],
|
21
|
+
:ba => [:bashkir, :bak],
|
22
|
+
:eu => [:basque, :baq, :eus],
|
23
|
+
:be => [:belarusian, :bel],
|
24
|
+
:bn => [:bengali, :ben],
|
25
|
+
:bh => [:bihari, :bih],
|
26
|
+
:bi => [:bislama, :bis],
|
27
|
+
:nb => [:bokmal, :nob],
|
28
|
+
:bs => [:bosnian, :bos],
|
29
|
+
:br => [:breton, :bre],
|
30
|
+
:bg => [:bulgarian, :bul],
|
31
|
+
:my => [:burmese, :bur, :mya],
|
32
|
+
:es => [:castilian, :spa],
|
33
|
+
:ca => [:catalan, :cat],
|
34
|
+
:km => [:central_khmer, :khm],
|
35
|
+
:ch => [:chamorro, :cha],
|
36
|
+
:ce => [:chechen, :che],
|
37
|
+
:ny => [:chewa, :nya],
|
38
|
+
:ny => [:chichewa, :nya],
|
39
|
+
:zh => [:chinese, :chi, :zho],
|
40
|
+
:za => [:chuang, :zha],
|
41
|
+
:cv => [:chuvash, :chv],
|
42
|
+
:kw => [:cornish, :cor],
|
43
|
+
:co => [:corsican, :cos],
|
44
|
+
:cr => [:cree, :cre],
|
45
|
+
:hr => [:croatian, :hrv],
|
46
|
+
:cs => [:czech, :cze, :ces],
|
47
|
+
:da => [:danish, :dan],
|
48
|
+
:dv => [:dhivehi, :div],
|
49
|
+
:dv => [:divehi, :div],
|
50
|
+
:nl => [:dutch, :dut, :nld],
|
51
|
+
:dz => [:dzongkha, :dzo],
|
52
|
+
:en => [:english, :eng],
|
53
|
+
:eo => [:esperanto, :epo],
|
54
|
+
:et => [:estonian, :est],
|
55
|
+
:ee => [:ewe, :ewe],
|
56
|
+
:fo => [:faroese, :fao],
|
57
|
+
:fj => [:fijian, :fij],
|
58
|
+
:fi => [:finnish, :fin],
|
59
|
+
:nl => [:flemish, :dut, :nld],
|
60
|
+
:fr => [:french, :fre, :fra],
|
61
|
+
:ff => [:fulah, :ful],
|
62
|
+
:gd => [:gaelic, :gla],
|
63
|
+
:gl => [:galician, :glg],
|
64
|
+
:lg => [:ganda, :lug],
|
65
|
+
:ka => [:georgian, :geo, :kat],
|
66
|
+
:de => [:german, :ger, :deu],
|
67
|
+
:ki => [:gikuyu, :kik],
|
68
|
+
:el => [:greek, :gre, :ell],
|
69
|
+
:kl => [:greenlandic, :kal],
|
70
|
+
:gn => [:guarani, :grn],
|
71
|
+
:gu => [:gujarati, :guj],
|
72
|
+
:ht => [:haitian, :hat],
|
73
|
+
:ht => [:haitian_creole, :hat],
|
74
|
+
:ha => [:hausa, :hau],
|
75
|
+
:he => [:hebrew, :heb],
|
76
|
+
:hz => [:herero, :her],
|
77
|
+
:hi => [:hindi, :hin],
|
78
|
+
:ho => [:hiri_motu, :hmo],
|
79
|
+
:hu => [:hungarian, :hun],
|
80
|
+
:is => [:icelandic, :ice, :isl],
|
81
|
+
:io => [:ido, :ido],
|
82
|
+
:ig => [:igbo, :ibo],
|
83
|
+
:id => [:indonesian, :ind],
|
84
|
+
:ia => [:interlingua, :ina],
|
85
|
+
:ie => [:interlingue, :ile],
|
86
|
+
:iu => [:inuktitut, :iku],
|
87
|
+
:ik => [:inupiaq, :ipk],
|
88
|
+
:ga => [:irish, :gle],
|
89
|
+
:it => [:italian, :ita],
|
90
|
+
:ja => [:japanese, :jpn],
|
91
|
+
:jv => [:javanese, :jav],
|
92
|
+
:kl => [:kalaallisut, :kal],
|
93
|
+
:kn => [:kannada, :kan],
|
94
|
+
:kr => [:kanuri, :kau],
|
95
|
+
:ks => [:kashmiri, :kas],
|
96
|
+
:kk => [:kazakh, :kaz],
|
97
|
+
:ki => [:kikuyu, :kik],
|
98
|
+
:rw => [:kinyarwanda, :kin],
|
99
|
+
:ky => [:kirghiz, :kir],
|
100
|
+
:kv => [:komi, :kom],
|
101
|
+
:kg => [:kongo, :kon],
|
102
|
+
:ko => [:korean, :kor],
|
103
|
+
:kj => [:kuanyama, :kua],
|
104
|
+
:ku => [:kurdish, :kur],
|
105
|
+
:kj => [:kwanyama, :kua],
|
106
|
+
:ky => [:kyrgyz, :kir],
|
107
|
+
:lo => [:lao, :lao],
|
108
|
+
:la => [:latin, :lat],
|
109
|
+
:lv => [:latvian, :lav],
|
110
|
+
:lb => [:letzeburgesch, :ltz],
|
111
|
+
:li => [:limburgan, :lim],
|
112
|
+
:li => [:limburger, :lim],
|
113
|
+
:li => [:limburgish, :lim],
|
114
|
+
:ln => [:lingala, :lin],
|
115
|
+
:lt => [:lithuanian, :lit],
|
116
|
+
:lu => [:luba_katanga, :lub],
|
117
|
+
:lb => [:luxembourgish, :ltz],
|
118
|
+
:mk => [:macedonian, :mac, :mkd],
|
119
|
+
:mg => [:malagasy, :mlg],
|
120
|
+
:ms => [:malay, :may, :msa],
|
121
|
+
:ml => [:malayalam, :mal],
|
122
|
+
:dv => [:maldivian, :div],
|
123
|
+
:mt => [:maltese, :mlt],
|
124
|
+
:gv => [:manx, :glv],
|
125
|
+
:mi => [:maori, :mao, :mri],
|
126
|
+
:mr => [:marathi, :mar],
|
127
|
+
:mh => [:marshallese, :mah],
|
128
|
+
:ro => [:moldavian, :rum, :ron],
|
129
|
+
:ro => [:moldovan, :rum, :ron],
|
130
|
+
:mn => [:mongolian, :mon],
|
131
|
+
:na => [:nauru, :nau],
|
132
|
+
:nv => [:navaho, :nav],
|
133
|
+
:nv => [:navajo, :nav],
|
134
|
+
:ng => [:ndonga, :ndo],
|
135
|
+
:ne => [:nepali, :nep],
|
136
|
+
:nd => [:north_ndebele, :nde],
|
137
|
+
:se => [:northern_sami, :sme],
|
138
|
+
:no => [:norwegian, :nor],
|
139
|
+
:ii => [:nuosu, :iii],
|
140
|
+
:ny => [:nyanja, :nya],
|
141
|
+
:nn => [:nynorsk, :nno],
|
142
|
+
:ie => [:occidental, :ile],
|
143
|
+
:oc => [:occitan, :oci],
|
144
|
+
:oj => [:ojibwa, :oji],
|
145
|
+
:cu => [:old_church_slavonic, :chu],
|
146
|
+
:or => [:oriya, :ori],
|
147
|
+
:om => [:oromo, :orm],
|
148
|
+
:os => [:ossetian, :oss],
|
149
|
+
:os => [:ossetic, :oss],
|
150
|
+
:pi => [:pali, :pli],
|
151
|
+
:pa => [:panjabi, :pan],
|
152
|
+
:ps => [:pashto, :pus],
|
153
|
+
:fa => [:persian, :per, :fas],
|
154
|
+
:pl => [:polish, :pol],
|
155
|
+
:pt => [:portuguese, :por],
|
156
|
+
:pa => [:punjabi, :pan],
|
157
|
+
:ps => [:pushto, :pus],
|
158
|
+
:qu => [:quechua, :que],
|
159
|
+
:ro => [:romanian, :rum, :ron],
|
160
|
+
:rm => [:romansh, :roh],
|
161
|
+
:rn => [:rundi, :run],
|
162
|
+
:ru => [:russian, :rus],
|
163
|
+
:sm => [:samoan, :smo],
|
164
|
+
:sg => [:sango, :sag],
|
165
|
+
:sa => [:sanskrit, :san],
|
166
|
+
:sc => [:sardinian, :srd],
|
167
|
+
:gd => [:scottish_gaelic, :gla],
|
168
|
+
:sr => [:serbian, :srp],
|
169
|
+
:sn => [:shona, :sna],
|
170
|
+
:ii => [:sichuan_yi, :iii],
|
171
|
+
:sd => [:sindhi, :snd],
|
172
|
+
:si => [:sinhala, :sin],
|
173
|
+
:si => [:sinhalese, :sin],
|
174
|
+
:sk => [:slovak, :slo, :slk],
|
175
|
+
:sl => [:slovenian, :slv],
|
176
|
+
:so => [:somali, :som],
|
177
|
+
:st => [:sotho, :sot],
|
178
|
+
:nr => [:south_ndebele, :nbl],
|
179
|
+
:es => [:spanish, :spa],
|
180
|
+
:su => [:sundanese, :sun],
|
181
|
+
:sw => [:swahili, :swa],
|
182
|
+
:ss => [:swati, :ssw],
|
183
|
+
:sv => [:swedish, :swe],
|
184
|
+
:tl => [:tagalog, :tgl],
|
185
|
+
:ty => [:tahitian, :tah],
|
186
|
+
:tg => [:tajik, :tgk],
|
187
|
+
:ta => [:tamil, :tam],
|
188
|
+
:tt => [:tatar, :tat],
|
189
|
+
:te => [:telugu, :tel],
|
190
|
+
:th => [:thai, :tha],
|
191
|
+
:bo => [:tibetan, :tib, :bod],
|
192
|
+
:ti => [:tigrinya, :tir],
|
193
|
+
:to => [:tonga, :ton],
|
194
|
+
:ts => [:tsonga, :tso],
|
195
|
+
:tn => [:tswana, :tsn],
|
196
|
+
:tr => [:turkish, :tur],
|
197
|
+
:tk => [:turkmen, :tuk],
|
198
|
+
:tw => [:twi, :twi],
|
199
|
+
:ug => [:uighur, :uig],
|
200
|
+
:uk => [:ukrainian, :ukr],
|
201
|
+
:ur => [:urdu, :urd],
|
202
|
+
:ug => [:uyghur, :uig],
|
203
|
+
:uz => [:uzbek, :uzb],
|
204
|
+
:ca => [:valencian, :cat],
|
205
|
+
:ve => [:venda, :ven],
|
206
|
+
:vi => [:vietnamese, :vie],
|
207
|
+
:vo => [:volapuk, :vol],
|
208
|
+
:wa => [:walloon, :wln],
|
209
|
+
:cy => [:welsh, :wel, :cym],
|
210
|
+
:fy => [:western_frisian, :fry],
|
211
|
+
:wo => [:wolof, :wol],
|
212
|
+
:xh => [:xhosa, :xho],
|
213
|
+
:yi => [:yiddish, :yid],
|
214
|
+
:yo => [:yoruba, :yor],
|
215
|
+
:za => [:zhuang, :zha],
|
216
|
+
:zu => [:zulu, :zul]
|
217
|
+
}
|
218
|
+
|
219
|
+
# Finds the two-letter code for the specified language
|
220
|
+
def find(lang)
|
221
|
+
# Allow function to accept both symbol and string arguments
|
222
|
+
lang = lang.to_sym
|
223
|
+
|
224
|
+
if LIST.has_key?(lang)
|
225
|
+
# Shortcut for two-letter language codes
|
226
|
+
return lang
|
227
|
+
else
|
228
|
+
# Breaks away automatically if a match is found
|
229
|
+
LIST.each do |two_letter_code, alt_names|
|
230
|
+
return two_letter_code if alt_names.include?(lang)
|
231
|
+
end
|
232
|
+
|
233
|
+
# Return nil if nothing found
|
234
|
+
raise Exception::InvalidLanguageError.new("Language not found: #{lang}")
|
235
|
+
end
|
236
|
+
end
|
237
|
+
|
238
|
+
# Determine whether the specified language has spaces or not
|
239
|
+
def has_spaces?(two_letter_code)
|
240
|
+
!LANGUAGES_WITHOUT_SPACES.include?(two_letter_code)
|
241
|
+
end
|
242
|
+
|
243
|
+
private
|
244
|
+
|
245
|
+
# Convert to underscore case
|
246
|
+
def underscore(str)
|
247
|
+
str.to_s. # allow symbols and strings
|
248
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). # underscore-delimit caps
|
249
|
+
gsub(/([a-z\d])\s?([A-Z])/,'\1_\2'). # underscore-delimit words
|
250
|
+
tr("-", "_"). # dashes to underscores
|
251
|
+
downcase. # everything lowercase
|
252
|
+
to_sym # convert to symbol
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
data/lib/konjac/translator.rb
CHANGED
@@ -1,33 +1,24 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
dirname = File.dirname(source)
|
26
|
-
basename = File.basename(source, ".*")
|
27
|
-
extname = File.extname(source)
|
28
|
-
|
29
|
-
"#{dirname}/#{basename}_converted#{extname}"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
module Konjac
|
3
|
+
module Translator
|
4
|
+
class << self
|
5
|
+
def translate(files, from_lang, to_lang)
|
6
|
+
pairs = Dictionary.load(from_lang, to_lang)
|
7
|
+
|
8
|
+
files.each do |source|
|
9
|
+
# Read in file and replace matches in content
|
10
|
+
content = File.read(source)
|
11
|
+
pairs.each do |pair|
|
12
|
+
search, replace = pair
|
13
|
+
content.gsub! search, replace
|
14
|
+
end
|
15
|
+
|
16
|
+
# Write changed content to file
|
17
|
+
File.open(Utils.build_converted_file_name(source, from_lang, to_lang), "w") do |file|
|
18
|
+
file.puts content
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/konjac/utils.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module Konjac
|
2
|
+
module Utils
|
3
|
+
class << self
|
4
|
+
# Extracts the two letter language code from a filename
|
5
|
+
def extract_language_code_from_filename(name)
|
6
|
+
match = File.basename(name, ".*").match(/_([a-z]{2})/i)
|
7
|
+
|
8
|
+
if match.nil?
|
9
|
+
nil
|
10
|
+
else
|
11
|
+
match[1]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# Build converted file name by appending "_converted" to the file name
|
16
|
+
def build_converted_file_name(source, from_lang, to_lang)
|
17
|
+
# Get components of filename
|
18
|
+
dirname = File.dirname(source)
|
19
|
+
basename = File.basename(source, ".*")
|
20
|
+
extname = File.extname(source)
|
21
|
+
|
22
|
+
# Blank out the from language
|
23
|
+
basename.sub! Regexp.new("_#{from_lang}", "i"), ""
|
24
|
+
|
25
|
+
"#{dirname}/#{basename}_#{to_lang}#{extname}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/konjac/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module Konjac
|
2
|
-
VERSION = "0.0.
|
3
|
-
end
|
1
|
+
module Konjac
|
2
|
+
VERSION = "0.0.2"
|
3
|
+
end
|
data/lib/konjac.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
require "konjac/version"
|
2
|
-
autoload :FileUtils, "fileutils"
|
3
|
-
|
4
|
-
module Konjac
|
5
|
-
autoload
|
6
|
-
autoload :
|
7
|
-
autoload :
|
8
|
-
autoload :
|
9
|
-
autoload :
|
10
|
-
|
1
|
+
require "konjac/version"
|
2
|
+
autoload :FileUtils, "fileutils"
|
3
|
+
|
4
|
+
module Konjac
|
5
|
+
# Set up autoload for all modules
|
6
|
+
autoload :CLI, "konjac/cli"
|
7
|
+
autoload :Dictionary, "konjac/dictionary"
|
8
|
+
autoload :Exception, "konjac/exception"
|
9
|
+
autoload :Language, "konjac/language"
|
10
|
+
autoload :Translator, "konjac/translator"
|
11
|
+
autoload :Utils, "konjac/utils"
|
12
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
+
|
3
|
+
describe Language do
|
4
|
+
it "should find English" do
|
5
|
+
Language.find(:english).should == :en
|
6
|
+
Language.find(:eng).should == :en
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should find Japanese" do
|
10
|
+
Language.find(:japanese).should == :ja
|
11
|
+
Language.find(:jpn).should == :ja
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should return equal results for both strings and symbols" do
|
15
|
+
Language.find(:english).should == Language.find("english")
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should accurately underscore languages" do
|
19
|
+
# underscore is a private method
|
20
|
+
Language.__send__(:underscore, "English").should == :english
|
21
|
+
Language.__send__(:underscore, "Western Frisian").should == :western_frisian
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should know that English has spaces" do
|
25
|
+
Language.has_spaces?(:en).should == true
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should know that Japanese does not have spaces" do
|
29
|
+
Language.has_spaces?(:ja).should == false
|
30
|
+
end
|
31
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/spec/utils_spec.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
+
|
3
|
+
describe Utils do
|
4
|
+
it "should extract the correct language from a filename" do
|
5
|
+
Utils.extract_language_code_from_filename("test_en.txt").should == "en"
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should correctly rename a file according to its target language" do
|
9
|
+
Utils.build_converted_file_name("./test_en.txt", "en", "ja").should == "./test_ja.txt"
|
10
|
+
Utils.build_converted_file_name("./test.txt", "en", "ja").should == "./test_ja.txt"
|
11
|
+
Utils.build_converted_file_name("./test_fr.txt", "en", "ja").should == "./test_fr_ja.txt"
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: konjac
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-01-
|
12
|
+
date: 2012-01-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: &70101261736900 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70101261736900
|
14
25
|
- !ruby/object:Gem::Dependency
|
15
26
|
name: rspec
|
16
|
-
requirement: &
|
27
|
+
requirement: &70101261736280 !ruby/object:Gem::Requirement
|
17
28
|
none: false
|
18
29
|
requirements:
|
19
30
|
- - ! '>='
|
@@ -21,18 +32,51 @@ dependencies:
|
|
21
32
|
version: '0'
|
22
33
|
type: :development
|
23
34
|
prerelease: false
|
24
|
-
version_requirements: *
|
35
|
+
version_requirements: *70101261736280
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
27
|
-
requirement: &
|
37
|
+
name: sdoc
|
38
|
+
requirement: &70101261735680 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
40
|
requirements:
|
30
41
|
- - ! '>='
|
31
42
|
- !ruby/object:Gem::Version
|
32
43
|
version: '0'
|
33
|
-
type: :
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70101261735680
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: autotest
|
49
|
+
requirement: &70101261734760 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70101261734760
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: autotest-fsevent
|
60
|
+
requirement: &70101261733460 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70101261733460
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: autotest-growl
|
71
|
+
requirement: &70101261732860 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
34
78
|
prerelease: false
|
35
|
-
version_requirements: *
|
79
|
+
version_requirements: *70101261732860
|
36
80
|
description: A Ruby command-line utility for translating files using a YAML wordlist
|
37
81
|
email:
|
38
82
|
- bryan.mckelvey@gmail.com
|
@@ -41,7 +85,9 @@ executables:
|
|
41
85
|
extensions: []
|
42
86
|
extra_rdoc_files: []
|
43
87
|
files:
|
88
|
+
- .autotest
|
44
89
|
- .gitignore
|
90
|
+
- .rspec
|
45
91
|
- Gemfile
|
46
92
|
- LICENSE
|
47
93
|
- README.md
|
@@ -51,10 +97,15 @@ files:
|
|
51
97
|
- lib/konjac.rb
|
52
98
|
- lib/konjac/cli.rb
|
53
99
|
- lib/konjac/dictionary.rb
|
54
|
-
- lib/konjac/
|
55
|
-
- lib/konjac/
|
100
|
+
- lib/konjac/exception.rb
|
101
|
+
- lib/konjac/language.rb
|
56
102
|
- lib/konjac/translator.rb
|
103
|
+
- lib/konjac/utils.rb
|
57
104
|
- lib/konjac/version.rb
|
105
|
+
- spec/dictionary_spec.rb
|
106
|
+
- spec/language_spec.rb
|
107
|
+
- spec/spec_helper.rb
|
108
|
+
- spec/utils_spec.rb
|
58
109
|
homepage: http://brymck.herokuapp.com/
|
59
110
|
licenses: []
|
60
111
|
post_install_message:
|
@@ -75,8 +126,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
126
|
version: '0'
|
76
127
|
requirements: []
|
77
128
|
rubyforge_project: konjac
|
78
|
-
rubygems_version: 1.8.
|
129
|
+
rubygems_version: 1.8.10
|
79
130
|
signing_key:
|
80
131
|
specification_version: 3
|
81
132
|
summary: A Ruby command-line utility for translating files using a YAML wordlist
|
82
|
-
test_files:
|
133
|
+
test_files:
|
134
|
+
- spec/dictionary_spec.rb
|
135
|
+
- spec/language_spec.rb
|
136
|
+
- spec/spec_helper.rb
|
137
|
+
- spec/utils_spec.rb
|
data/lib/konjac/manager.rb
DELETED
File without changes
|