epub-translator 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +5 -3
- data/epub-translator.gemspec +1 -1
- data/lib/epub/translator/prompt/translate.rb +6 -2
- data/lib/epub/translator/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81fb9a83804addbdddeb4bc7972c47e7f477d2f8ea7ca622382ba4060cec69ff
|
4
|
+
data.tar.gz: 76a1d414ff2e11a571b8e064a698b190023135afb71265bc3e47449c673f10f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab7d61acb8b94386d781a26438abd13cf8f33f465905223b64b0088763ecdf477eb4ca4c3eb6d2f877a7135215df78cb8a4849f59091d8cc6329b269b74c7fe2
|
7
|
+
data.tar.gz: bd9c05916f0b91e37c0109c6a3a74fcd8d8f7cd86686f2894a1ac6a056259263d50ac1134d6974599be1a79d9f71bddd642cf3c774c7f8a8f8d401c913af27d5
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -36,18 +36,20 @@ It will generate another EPUB file, with translated paragraphs next to their sou
|
|
36
36
|
|
37
37
|
## Feature
|
38
38
|
|
39
|
-
Epub::Translator
|
40
|
-
|
41
|
-
### Translators
|
39
|
+
Epub::Translator uses [Natsukantou](https://gitlab.com/lulalala/natsukantou) gem for translating XMLs. It uses the middleware pattern to provide customizability, e.g. you can decide whether to flatten HTML Ruby Markup. A wizard will guide you through the configuration process.
|
42
40
|
|
43
41
|
[List of supported translation services](https://gitlab.com/lulalala/natsukantou#translators)
|
44
42
|
|
43
|
+
[List of middlewares (filters)](https://gitlab.com/lulalala/natsukantou#middlewares)
|
44
|
+
|
45
45
|
## Development
|
46
46
|
|
47
47
|
The XML related operations are purposefully extracted into its own gem: [Natsukantou](https://gitlab.com/lulalala/natsukantou).
|
48
48
|
|
49
49
|
This gem uses [Oga XML parser](https://gitlab.com/yorickpeterse/oga) and [epub-parser](https://gitlab.com/KitaitiMakoto/epub-parser) (both hosted on GitLab, yay!).
|
50
50
|
|
51
|
+
The wizard process uses [tty-prompt](https://github.com/piotrmurach/tty-prompt) and [yard](https://github.com/lsegal/yard).
|
52
|
+
|
51
53
|
## Contributing
|
52
54
|
|
53
55
|
Bug reports and merge requests are welcome on GitLab at https://gitlab.com/lulalala/epub-translator.
|
data/epub-translator.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_dependency "epub-maker", "~> 0.1.7"
|
32
32
|
spec.add_dependency "epub-parser", "~> 0.4.6"
|
33
33
|
spec.add_dependency "middleware", "~> 0.1.0"
|
34
|
-
spec.add_dependency "natsukantou", "~> 0.1.
|
34
|
+
spec.add_dependency "natsukantou", "~> 0.1.3"
|
35
35
|
spec.add_dependency "tty-prompt", "~> 0.23"
|
36
36
|
|
37
37
|
spec.add_development_dependency "debug", ">= 1.0.0"
|
@@ -44,8 +44,12 @@ module Epub
|
|
44
44
|
|
45
45
|
items = book.each_page_on_spine.select(&:xhtml?)
|
46
46
|
items_untranslated_index = items.map.with_index do |item, index|
|
47
|
-
|
48
|
-
|
47
|
+
if (doc_lang_code = item.content_document.oga.lang)
|
48
|
+
lang = Natsukantou::LanguageCode.new(doc_lang_code)
|
49
|
+
lang.is?(lang_to) ? nil : index
|
50
|
+
else
|
51
|
+
index
|
52
|
+
end
|
49
53
|
end.compact
|
50
54
|
|
51
55
|
choices = items.map.with_index do |item, index|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epub-translator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lulalala
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: epub-maker
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.1.
|
61
|
+
version: 0.1.3
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.1.
|
68
|
+
version: 0.1.3
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: tty-prompt
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
requirements: []
|
161
|
-
rubygems_version: 3.
|
161
|
+
rubygems_version: 3.4.6
|
162
162
|
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: Tools to translate EPUB books
|