konjac 0.2.8 → 0.2.8.1
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/lib/konjac/cli.rb +4 -14
- data/lib/konjac/installer.rb +32 -1
- data/lib/konjac/version.rb +1 -1
- data/lib/locales/en.yml +11 -2
- data/lib/locales/ja.yml +11 -2
- metadata +27 -27
data/lib/konjac/cli.rb
CHANGED
@@ -90,15 +90,10 @@ eos
|
|
90
90
|
Office.import_tags ARGV, opts
|
91
91
|
when "install"
|
92
92
|
Trollop::options do
|
93
|
-
banner sc_banner % I18n.t(:
|
93
|
+
banner sc_banner % I18n.t(:script_arg)
|
94
94
|
opt :help, I18n.t(:help, :scope => :opts)
|
95
95
|
end
|
96
|
-
|
97
|
-
when "dictionaries", "dict", "dictionary"
|
98
|
-
Installer.install_dictionaries
|
99
|
-
when "vim"
|
100
|
-
Installer.install_vim
|
101
|
-
end
|
96
|
+
Installer.run :install, ARGV[0].dup
|
102
97
|
when "language"
|
103
98
|
Trollop::options do
|
104
99
|
banner sc_banner % I18n.t(:word_arg)
|
@@ -148,15 +143,10 @@ eos
|
|
148
143
|
puts result if opts[:word]
|
149
144
|
when "update"
|
150
145
|
Trollop::options do
|
151
|
-
banner sc_banner % I18n.t(:
|
146
|
+
banner sc_banner % I18n.t(:script_arg)
|
152
147
|
opt :help, I18n.t(:help, :scope => :opts)
|
153
148
|
end
|
154
|
-
|
155
|
-
when "dictionaries", "dict", "dictionary"
|
156
|
-
Installer.update_dictionaries
|
157
|
-
when "vim"
|
158
|
-
Installer.update_vim
|
159
|
-
end
|
149
|
+
Installer.run :update, ARGV[0].dup
|
160
150
|
when "use"
|
161
151
|
Trollop::options do
|
162
152
|
banner sc_banner % I18n.t(:word_arg)
|
data/lib/konjac/installer.rb
CHANGED
@@ -6,10 +6,34 @@ module Konjac
|
|
6
6
|
YML_GIT = "git://github.com/brymck/konjac_yml.git"
|
7
7
|
|
8
8
|
class << self
|
9
|
+
# Parses the provided command and script to install or update plugins and
|
10
|
+
# dictionary files
|
11
|
+
def run(command, script)
|
12
|
+
case script.to_sym
|
13
|
+
when :dictionaries, :dict, :dictionary
|
14
|
+
script = "dictionaries"
|
15
|
+
when :vim
|
16
|
+
script = "vim"
|
17
|
+
else
|
18
|
+
puts I18n.t(:script_not_found, :scope => :scripts) % script
|
19
|
+
return
|
20
|
+
end
|
21
|
+
|
22
|
+
case command.to_sym
|
23
|
+
when :install, :update
|
24
|
+
# Build a command
|
25
|
+
__send__ [command, script].join("_")
|
26
|
+
else
|
27
|
+
puts I18n.t(:command_not_found, :scope => :scripts) % command
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
9
31
|
# Install the supplementary {Vim plugin}[https://github.com/brymck/konjac_vim]
|
10
32
|
def install_vim
|
33
|
+
return update_vim if has_pathogen? && vim_installed?
|
34
|
+
|
35
|
+
print I18n.t(:installing, :scope => :scripts) % I18n.t(:vim_script, :scope => :scripts)
|
11
36
|
if has_pathogen?
|
12
|
-
return update_vim if vim_installed?
|
13
37
|
|
14
38
|
system File.join(File.dirname(__FILE__), "..", "bash", "install_vim")
|
15
39
|
else
|
@@ -19,6 +43,7 @@ module Konjac
|
|
19
43
|
FileUtils.remove_entry_secure dir
|
20
44
|
end
|
21
45
|
end
|
46
|
+
puts I18n.t(:done, :scope => :scripts)
|
22
47
|
end
|
23
48
|
|
24
49
|
# Install the supplementary {dictionaries}[https://github.com/brymck/konjac_yml]
|
@@ -26,6 +51,7 @@ module Konjac
|
|
26
51
|
if dictionaries_installed?
|
27
52
|
update_dictionaries
|
28
53
|
else
|
54
|
+
print I18n.t(:installing, :scope => :scripts) % I18n.t(:dictionaries, :scope => :scripts)
|
29
55
|
Dir.chdir(konjac_home) do
|
30
56
|
g = Git.clone(YML_GIT, ".dictionaries", :name => ".dictionaries",
|
31
57
|
:path => konjac_home)
|
@@ -33,13 +59,16 @@ module Konjac
|
|
33
59
|
FileUtils.cp_r Dir.glob("*.yml"), konjac_home
|
34
60
|
end
|
35
61
|
end
|
62
|
+
puts I18n.t(:done, :scope => :scripts)
|
36
63
|
end
|
37
64
|
end
|
38
65
|
|
39
66
|
# Update the supplementary {Vim plugin}[https://github.com/brymck/konjac_vim]
|
40
67
|
def update_vim
|
41
68
|
if has_pathogen? && vim_installed?
|
69
|
+
print I18n.t(:updating, :scope => :scripts) % I18n.t(:vim_script, :scope => :scripts)
|
42
70
|
system File.join(File.dirname(__FILE__), "..", "bash", "update_vim")
|
71
|
+
puts I18n.t(:done, :scope => :scripts)
|
43
72
|
else
|
44
73
|
install_vim
|
45
74
|
end
|
@@ -48,11 +77,13 @@ module Konjac
|
|
48
77
|
# Update the supplementary {dictionaries}[https://github.com/brymck/konjac_yml]
|
49
78
|
def update_dictionaries
|
50
79
|
if dictionaries_installed?
|
80
|
+
print I18n.t(:installing, :scope => :scripts) % I18n.t(:dictionaries, :scope => :scripts)
|
51
81
|
g = Git.open(File.join(konjac_home, ".dictionaries"))
|
52
82
|
g.pull
|
53
83
|
g.chdir do
|
54
84
|
FileUtils.cp_r Dir.glob("*.yml"), konjac_home
|
55
85
|
end
|
86
|
+
puts I18n.t(:done, :scope => :scripts)
|
56
87
|
else
|
57
88
|
install_dictionaries
|
58
89
|
end
|
data/lib/konjac/version.rb
CHANGED
data/lib/locales/en.yml
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
en:
|
2
2
|
banner: Konjac is a Ruby command-line utility for translating files using a YAML wordlist
|
3
|
+
command_not_found: "Command not found: %s"
|
3
4
|
filenames_arg: <filenames>+
|
4
5
|
filenames_or_word_arg: <filenames>+ OR <text>
|
5
6
|
me: Bryan McKelvey
|
6
7
|
no_match: "No files matching \"%s\" found!"
|
7
8
|
options: options
|
8
9
|
overwrite: "Overwrite %s? (y/n [n]) "
|
10
|
+
script_arg: dictionaries|vim
|
11
|
+
script_not_found: "Script not found: %s"
|
9
12
|
subcommand: subcommand
|
10
13
|
unknown_subcommand: "Unknown subcommand: %s"
|
11
14
|
usage: "Usage:"
|
@@ -18,24 +21,30 @@ en:
|
|
18
21
|
force: Automatically overwrite files
|
19
22
|
from: The language from which to translate
|
20
23
|
help: Show this message
|
21
|
-
install: Install supplementary scripts
|
22
24
|
original: The untranslated original text
|
23
25
|
output: The name of the output file
|
24
26
|
prompt: Prompt before overwriting a file
|
25
27
|
quiet: Suppress error messages
|
26
28
|
to: The language into which to translate
|
27
29
|
translation: The translated text
|
28
|
-
update: Update supplementary scripts
|
29
30
|
using: The names of dictionaries to use
|
30
31
|
use_cache: Use cached dictionary
|
31
32
|
version: Print version and exit
|
32
33
|
word: Translate a word or phrase
|
34
|
+
scripts:
|
35
|
+
installing: "Installing %s... "
|
36
|
+
updating: "Updating %s... "
|
37
|
+
vim_script: "Vim script"
|
38
|
+
dictionaries: "dictionaries"
|
39
|
+
done: "done!"
|
33
40
|
subcommands:
|
34
41
|
add: Add a definition to translation memory
|
35
42
|
export: Export text tags from a .doc or .docx file
|
36
43
|
import: Import text tags into a .doc or .docx file
|
44
|
+
install: Install supplementary scripts
|
37
45
|
language: Sets the default language
|
38
46
|
list: List available dictionaries
|
39
47
|
suggest: Suggest similar words using fuzzy matching
|
40
48
|
translate: Translate a file, word or phrase
|
49
|
+
update: Update supplementary scripts
|
41
50
|
use: Choose a default dictionary
|
data/lib/locales/ja.yml
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
ja:
|
2
2
|
banner: KonjacはYAML辞書でファイルを翻訳するRubyのコマンドライン・ユーティリティです。
|
3
|
+
command_not_found: "コマンドは見つかりません:%s"
|
3
4
|
filenames_arg: <ファイル名>+
|
4
5
|
filenames_or_word_arg: <ファイル名>+ または <テキスト>
|
5
6
|
me: ブライアン・マッケルビー
|
6
7
|
no_match: "「%s」をマッチするファイルは存在しません。"
|
7
8
|
options: オプション
|
8
9
|
overwrite: "%sを上書きしますか。 (y/n [n]) "
|
10
|
+
script_arg: dictionaries|vim
|
11
|
+
script_not_found: "スクリプトは見つかりません:%s"
|
9
12
|
subcommand: サブコマンド
|
10
13
|
unknown_subcommand: 不明なサブコマンド:%s
|
11
14
|
usage: 使い方:
|
@@ -18,24 +21,30 @@ ja:
|
|
18
21
|
force: 自動にファイルを上書きする
|
19
22
|
from: ソース言語
|
20
23
|
help: このメッセージを表示する
|
21
|
-
install: スクリプトなどをインストールする
|
22
24
|
original: ソーステキスト
|
23
25
|
output: 出力ファイル名
|
24
26
|
prompt: ファイルをする場合に警告する
|
25
27
|
quiet: エラーメッセージを抑止する
|
26
28
|
to: ターゲット言語
|
27
29
|
translation: ターゲットテキスト
|
28
|
-
update: スクリプトなどをアップデートする
|
29
30
|
using: 使用したい辞書の名前
|
30
31
|
use_cache: キャッシュした翻訳メモリを適用する
|
31
32
|
version: バーションを表示し終了する
|
32
33
|
word: 文字列を翻訳する
|
34
|
+
scripts:
|
35
|
+
installing: "%sをインストールしています... "
|
36
|
+
updating: "%sを更新しています... "
|
37
|
+
vim_script: "Vimのプラグイン"
|
38
|
+
dictionaries: "辞書"
|
39
|
+
done: "終了!"
|
33
40
|
subcommands:
|
34
41
|
add: 翻訳メモリに定義を追加する
|
35
42
|
export: .docまたは.docxファイルからタグを抽出する
|
36
43
|
import: .docまたは.docxファイルにタグをインポートする
|
44
|
+
install: スクリプトなどをインストールする
|
37
45
|
language: 言語を設定する
|
38
46
|
list: 使用できる辞書を表示する
|
39
47
|
suggest: ファジーマッチングで似た言葉をサジェストする
|
40
48
|
translate: ファイル・文字列を翻訳する
|
49
|
+
update: スクリプトなどをアップデートする
|
41
50
|
use: デフォルト辞書を選択する
|
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.2.8
|
4
|
+
version: 0.2.8.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-29 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: amatch
|
16
|
-
requirement: &
|
16
|
+
requirement: &70162410461600 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70162410461600
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: git
|
27
|
-
requirement: &
|
27
|
+
requirement: &70162410460900 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70162410460900
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: highline
|
38
|
-
requirement: &
|
38
|
+
requirement: &70162410481360 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70162410481360
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: i18n
|
49
|
-
requirement: &
|
49
|
+
requirement: &70162410480940 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70162410480940
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: nokogiri
|
60
|
-
requirement: &
|
60
|
+
requirement: &70162410480520 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70162410480520
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: sdoc
|
71
|
-
requirement: &
|
71
|
+
requirement: &70162410480100 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70162410480100
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: term-ansicolor
|
82
|
-
requirement: &
|
82
|
+
requirement: &70162410479660 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70162410479660
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: trollop
|
93
|
-
requirement: &
|
93
|
+
requirement: &70162410479240 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *70162410479240
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: autotest
|
104
|
-
requirement: &
|
104
|
+
requirement: &70162410478820 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,10 +109,10 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *70162410478820
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: autotest-fsevent
|
115
|
-
requirement: &
|
115
|
+
requirement: &70162410478400 !ruby/object:Gem::Requirement
|
116
116
|
none: false
|
117
117
|
requirements:
|
118
118
|
- - ! '>='
|
@@ -120,10 +120,10 @@ dependencies:
|
|
120
120
|
version: '0'
|
121
121
|
type: :development
|
122
122
|
prerelease: false
|
123
|
-
version_requirements: *
|
123
|
+
version_requirements: *70162410478400
|
124
124
|
- !ruby/object:Gem::Dependency
|
125
125
|
name: autotest-growl
|
126
|
-
requirement: &
|
126
|
+
requirement: &70162410477960 !ruby/object:Gem::Requirement
|
127
127
|
none: false
|
128
128
|
requirements:
|
129
129
|
- - ! '>='
|
@@ -131,10 +131,10 @@ dependencies:
|
|
131
131
|
version: '0'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
|
-
version_requirements: *
|
134
|
+
version_requirements: *70162410477960
|
135
135
|
- !ruby/object:Gem::Dependency
|
136
136
|
name: bundler
|
137
|
-
requirement: &
|
137
|
+
requirement: &70162410477460 !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
140
140
|
- - ! '>='
|
@@ -142,10 +142,10 @@ dependencies:
|
|
142
142
|
version: '0'
|
143
143
|
type: :development
|
144
144
|
prerelease: false
|
145
|
-
version_requirements: *
|
145
|
+
version_requirements: *70162410477460
|
146
146
|
- !ruby/object:Gem::Dependency
|
147
147
|
name: rspec
|
148
|
-
requirement: &
|
148
|
+
requirement: &70162410476940 !ruby/object:Gem::Requirement
|
149
149
|
none: false
|
150
150
|
requirements:
|
151
151
|
- - ! '>='
|
@@ -153,7 +153,7 @@ dependencies:
|
|
153
153
|
version: '0'
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
|
-
version_requirements: *
|
156
|
+
version_requirements: *70162410476940
|
157
157
|
description: A Ruby command-line utility for translating files using a YAML wordlist
|
158
158
|
email:
|
159
159
|
- bryan.mckelvey@gmail.com
|