xliffle 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xliffle.rb +1 -0
- data/lib/xliffle/file.rb +3 -3
- data/lib/xliffle/note.rb +14 -0
- data/lib/xliffle/string.rb +17 -7
- data/lib/xliffle/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c3e2597e48807a7fa1d71cf71b958a1bc19433b
|
4
|
+
data.tar.gz: e3a70fd86c7d88559f2ce47d2456e67a57a887c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1ebe0e776e9e865411fd0b66d271ce9dda1402e8998cca6a6566ce038e4736721c4be92db3c73dffdc3117120c029572c642164edb19fa11482b572ef339e63
|
7
|
+
data.tar.gz: ad378bba4a0ac3a5e6f9b0b21c2b79b4a4e52cfdf6173595f36f4841ff9f7b9090c610594678c359df35899a22fbb7d8f355dd33d06b5a67e358ab4525f9fecf
|
data/lib/xliffle.rb
CHANGED
data/lib/xliffle/file.rb
CHANGED
@@ -17,10 +17,10 @@ module Xliffle
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def to_xliff(xliff)
|
20
|
-
xliff.file(original: @original, datatype: 'plaintext', 'source-language' => @source_locale, 'target-language' => @target_locale,) do |
|
21
|
-
|
20
|
+
xliff.file(original: @original, datatype: 'plaintext', 'source-language' => @source_locale, 'target-language' => @target_locale,) do |file|
|
21
|
+
file.body do |body|
|
22
22
|
self.strings.each do |string|
|
23
|
-
string.to_xliff(
|
23
|
+
string.to_xliff(body)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
data/lib/xliffle/note.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module Xliffle
|
2
|
+
class Note
|
3
|
+
attr_reader :note, :priority
|
4
|
+
|
5
|
+
def initialize(note, options={})
|
6
|
+
@note = note
|
7
|
+
@priority = options[:priority] || 2
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_xliff(xliff)
|
11
|
+
xliff.tag!('note', { priority: @priority }, @note)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/xliffle/string.rb
CHANGED
@@ -1,18 +1,28 @@
|
|
1
1
|
module Xliffle
|
2
2
|
class String
|
3
|
-
attr_reader :name, :source, :target
|
3
|
+
attr_reader :name, :source, :target, :notes
|
4
4
|
|
5
|
-
def initialize(id, name,
|
5
|
+
def initialize(id, name, source_string, target_string)
|
6
6
|
@id = id
|
7
7
|
@name = name
|
8
|
-
@
|
9
|
-
@
|
8
|
+
@source_string = source_string
|
9
|
+
@target_string = target_string
|
10
|
+
@notes = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def note(note, priority=2)
|
14
|
+
note = Xliffle::Note.new(note, priority)
|
15
|
+
@notes << note
|
16
|
+
note
|
10
17
|
end
|
11
18
|
|
12
19
|
def to_xliff(xliff)
|
13
|
-
xliff.tag!('trans-unit', { id: @id, resname: @name }) do |
|
14
|
-
|
15
|
-
|
20
|
+
xliff.tag!('trans-unit', { id: @id, resname: @name }) do |tag|
|
21
|
+
tag.source(@source_string)
|
22
|
+
tag.target(@target_string)
|
23
|
+
@notes.each do |note|
|
24
|
+
note.to_xliff(tag)
|
25
|
+
end
|
16
26
|
end
|
17
27
|
end
|
18
28
|
end
|
data/lib/xliffle/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xliffle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Rohde
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- lib/xliffle.rb
|
65
65
|
- lib/xliffle/creator.rb
|
66
66
|
- lib/xliffle/file.rb
|
67
|
+
- lib/xliffle/note.rb
|
67
68
|
- lib/xliffle/string.rb
|
68
69
|
- lib/xliffle/version.rb
|
69
70
|
- test/test_helper.rb
|