konjak 0.0.15 → 0.0.16

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
  SHA1:
3
- metadata.gz: 219a842656b4743ac6f782fdca2167dcf85e51ab
4
- data.tar.gz: 2a1c74e8771791b5ac9dab000a7d556f88a14335
3
+ metadata.gz: d70121865e9191011c91bda6d7f522002ed9a097
4
+ data.tar.gz: d7c9e4825522184fb8d9fc574646c8781d8da403
5
5
  SHA512:
6
- metadata.gz: f26891f463c259af8eee10698208a6df50c92b49c5b0f0a5065feadcccd10fe45733b8598eec5e47d35286feb519156aa8b82600576eeccd2d6cf39ecaf29daf
7
- data.tar.gz: c88fe8b6fdbab45f4f5ddcc8c851869e47b62fc7bfc800676dba0f63352e193ffb453b15f95244eb364398b5c841629f2ce2d9df5b9edeca2a7b23e7c5c8caad
6
+ metadata.gz: c9c3bae89036245ab759caeedce55e8696478882bf0df34020fb1b62969bd83ba04f2a9d216917bf62f23c96fd2c7b18a517b41817d104aef3c6b14b341d3101
7
+ data.tar.gz: ca29b2f78c00738fba36cd380bea116bd381e3f3b76f6e131d68d0ce783913a36f8d01724726143057c5f0da6012e67214a3400b8850b2341d13331afcf6a7d8
@@ -62,7 +62,21 @@ module Konjak
62
62
 
63
63
  def translation_units
64
64
  @tmx.body.translation_units.sort_by {|tu|
65
- -tu.variant(@lang).segment.text.length
65
+ # GTTの場合
66
+ translation_timestamp = nil
67
+
68
+ if tm_entry = tu.at('entry_metadata').try(:at, 'tm_entry')
69
+ source_info = tm_entry.at('source_info')
70
+ if source_info.try(:at, 'source_lang').try(:text) == @lang && source_info.try(:at, 'source').try(:text) == tu.variant(@lang).segment.text
71
+ translation_timestamp = tm_entry.at('translation').try(:attr, 'translation_timestamp').to_i
72
+ end
73
+ end
74
+
75
+ translation_timestamp ||= 0
76
+
77
+ segment_length = tu.variant(@lang).segment.text.length
78
+
79
+ [-translation_timestamp, -segment_length]
66
80
  }.reject {|tu|
67
81
  tu.variant(@lang).segment.text.length < min_segment_length
68
82
  }
@@ -1,3 +1,3 @@
1
1
  module Konjak
2
- VERSION = "0.0.15"
2
+ VERSION = "0.0.16"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: konjak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seiei Higa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-01 00:00:00.000000000 Z
11
+ date: 2015-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mem
@@ -215,3 +215,4 @@ test_files:
215
215
  - spec/konjak_translate_spec.rb
216
216
  - spec/spec_helper.rb
217
217
  - spec/support/equal_xml_matcher.rb
218
+ has_rdoc: