xliffle 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/lib/xliffle/creator.rb +5 -1
- data/lib/xliffle/file.rb +10 -3
- data/lib/xliffle/string.rb +4 -3
- data/lib/xliffle/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f13d0b3dd0c2f5c1ba06bdebb97a2383da08262
|
4
|
+
data.tar.gz: 47cc13235948cacac905ba0807433dc993031667
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fb6e1170aa26286c5779ae860801b942fb05d26e5ae3c64758cc4e7872ebf7b4986589894a59cae272eeb5bcc07352ffc988003fa8edc0551dc3dde4cb4f94e
|
7
|
+
data.tar.gz: 5b0044891bf8d08aa3ee94b0818d8308a1d2b79d81196dd72caf617aa5e1ba40c20fa1f3724b83cd51ac0acfe616ace5ee26be7a318399c978622828db31dadb
|
data/lib/xliffle/creator.rb
CHANGED
@@ -9,7 +9,7 @@ module Xliffle
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def file(original, source_locale, target_locale)
|
12
|
-
file = Xliffle::File.new(original, source_locale, target_locale)
|
12
|
+
file = Xliffle::File.new(file_id, original, source_locale, target_locale)
|
13
13
|
@files << file
|
14
14
|
file
|
15
15
|
end
|
@@ -31,6 +31,10 @@ module Xliffle
|
|
31
31
|
|
32
32
|
private
|
33
33
|
|
34
|
+
def file_id
|
35
|
+
@files.length.succ
|
36
|
+
end
|
37
|
+
|
34
38
|
def xml(&block)
|
35
39
|
xml = Builder::XmlMarkup.new( :indent => 2 )
|
36
40
|
xml.instruct! :xml, :encoding => "UTF-8"
|
data/lib/xliffle/file.rb
CHANGED
@@ -2,15 +2,16 @@ module Xliffle
|
|
2
2
|
class File
|
3
3
|
attr_reader :original, :strings, :source_locale, :target_locale
|
4
4
|
|
5
|
-
def initialize(original, source_locale, target_locale)
|
5
|
+
def initialize(id, original, source_locale, target_locale)
|
6
|
+
@id = id
|
6
7
|
@strings = []
|
7
8
|
@original = original
|
8
9
|
@source_locale = source_locale
|
9
10
|
@target_locale = target_locale
|
10
11
|
end
|
11
12
|
|
12
|
-
def string(
|
13
|
-
string = Xliffle::String.new(
|
13
|
+
def string(name, source, target)
|
14
|
+
string = Xliffle::String.new(string_id, name, source, target)
|
14
15
|
@strings << string
|
15
16
|
string
|
16
17
|
end
|
@@ -24,5 +25,11 @@ module Xliffle
|
|
24
25
|
end
|
25
26
|
end
|
26
27
|
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def string_id
|
32
|
+
"#{ @id }_#{ @strings.length.succ }"
|
33
|
+
end
|
27
34
|
end
|
28
35
|
end
|
data/lib/xliffle/string.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
module Xliffle
|
2
2
|
class String
|
3
|
-
attr_reader :
|
3
|
+
attr_reader :name, :source, :target
|
4
4
|
|
5
|
-
def initialize(id, source, target)
|
5
|
+
def initialize(id, name, source, target)
|
6
6
|
@id = id
|
7
|
+
@name = name
|
7
8
|
@source = source
|
8
9
|
@target = target
|
9
10
|
end
|
10
11
|
|
11
12
|
def to_xliff(xliff)
|
12
|
-
xliff.tag!('trans-unit', { id: @id }) do |t|
|
13
|
+
xliff.tag!('trans-unit', { id: @id, resname: @name }) do |t|
|
13
14
|
t.source(@source)
|
14
15
|
t.target(@target)
|
15
16
|
end
|
data/lib/xliffle/version.rb
CHANGED