epub-translator 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d3a2097137099f87c52a3cfa7358d9ba79d12288631267913371df4ba8e9eb2
4
- data.tar.gz: d212b682ab130cca1d1740946b36f25d0537d22b9f85929aab12895c57980e96
3
+ metadata.gz: 20c951f644e1e29001a122f3a3bfc6ce4fabee4d741a6d5df75e681faad412d6
4
+ data.tar.gz: fa5b93baee15dd9a7f40598e97f99baa4000a74e08de05c495c94a8c3d1e617d
5
5
  SHA512:
6
- metadata.gz: 051da38c1df90cc5da8a37541dc404906c7a4f45023088cbf3c72c3bf8525d390ca59c470977929a819f31a27d284a6bab4447ba66699c0a9e2ae183d00f5291
7
- data.tar.gz: 7b39119783ac14f4487728fd2bcf5fa6c200bc75f7e38e7c18c8d980fea98947892e2eed104cc182cba46fd322375e6279b4cea70aed09531b747cdd326f0f0d
6
+ metadata.gz: eaca24fb19dd34489146f8e9209596f9924fb805044497b71730e879a0b703a00f33c5778850bc660a71a3abc34225503045cf4ec4669edd91a5290d9fd1a901
7
+ data.tar.gz: 505ff85b630a6d0920a36643169894d8e38ab97a2f0f487b2f879591b28239fc638a89efa36fce785dd29211e0c0e18e1a8321e966264d9f97c2d94a827c7e02
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2023-03-05
4
+
5
+ - Add ChatGPT translator as experiment
6
+
7
+ ## [0.1.1] - 2023-02-27
8
+
9
+ - Fix crash if epub document does not have `lang` attribute
10
+ - Skip interlace on nodes if they don't differ
11
+ -
3
12
  ## [0.1.0] - 2022-07-02
4
13
 
5
14
  - Initial release
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Epub::Translator
2
2
 
3
- Translate Epub file with machine translation services such as DeepL.
3
+ Translate Epub file with machine translation services such as DeepL and ChatGPT.
4
4
 
5
5
  ## Installation
6
6
 
@@ -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 utilized [Natsukantou](https://gitlab.com/lulalala/natsukantou) gem, which aims to be configurable. For example, it comes with its own glossary middleware, and can handle HTML Ruby Markup. The wizard will ask you which you want to use, but you can read [here](https://gitlab.com/lulalala/natsukantou#middlewares) to learn more about them.
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.
@@ -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.2"
34
+ spec.add_dependency "natsukantou", "~> 0.2.0"
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
- lang = Natsukantou::LanguageCode.new(item.content_document.oga.lang)
48
- lang.is?(lang_to) ? nil : index
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|
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Epub
4
4
  module Translator
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
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.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lulalala
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-10-01 00:00:00.000000000 Z
11
+ date: 2023-03-05 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.2
61
+ version: 0.2.0
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.2
68
+ version: 0.2.0
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.3.7
161
+ rubygems_version: 3.4.7
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: Tools to translate EPUB books