xlf_importer 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +70 -0
- data/Rakefile +5 -0
- data/lib/xlf_importer/version.rb +3 -0
- data/lib/xlf_importer.rb +142 -0
- data/spec/spec_helper.rb +2 -0
- data/spec/test_sample_files/sample_alt_2.xlf +19 -0
- data/spec/test_sample_files/sample_alt_translation.xlf +15 -0
- data/spec/test_sample_files/sample_utf-16.xlf +0 -0
- data/spec/xlf_importer_spec.rb +59 -0
- data/xlf_importer.gemspec +27 -0
- metadata +147 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 688d9c4a4ae3f47abe702c4177923478e87f3721
|
4
|
+
data.tar.gz: 3298c459f50ab59d98398f1199540337ea3a0219
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ca63fe876eaf94aaa9680e4d3deb3de9da9fc24d5ee3de02ad08d507e89f2d76a08a191c9cb9f462d2cbc74918d565d924017526d56313400c67abe2d54cfcc2
|
7
|
+
data.tar.gz: 7d57ffd245a5edc1ed4bb068f6deecbcb22678e64cc047f8f3c04c662d51c61fd1eca11e4f654d8de60af7fc93306ca4fccf5c482ae827a3d73f446499b726ec
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Kevin S. Dias
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
# XLIFF Importer
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/xlf_importer.svg)](https://badge.fury.io/rb/xlf_importer) [![Build Status](https://travis-ci.org/diasks2/xlf_importer.png)](https://travis-ci.org/diasks2/xlf_importer) [![License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](https://github.com/diasks2/xlf_importer/blob/master/LICENSE.txt)
|
4
|
+
|
5
|
+
This gem handles the importing and parsing of [.xlf files](http://docs.oasis-open.org/xliff/xliff-core/xliff-core.html). [XLIFF files](https://en.wikipedia.org/wiki/XLIFF) are xml files.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
**Ruby**
|
12
|
+
```
|
13
|
+
gem install xlf_importer
|
14
|
+
```
|
15
|
+
|
16
|
+
**Ruby on Rails**
|
17
|
+
Add this line to your application’s Gemfile:
|
18
|
+
```ruby
|
19
|
+
gem 'xlf_importer'
|
20
|
+
```
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
# Get the high level stats of an XLIFF file
|
26
|
+
# Including the encoding is optional. If not included the gem will attempt to detect the encoding.
|
27
|
+
file_path = File.expand_path('../xlf_importer/spec/test_sample_files/sample_alt_translation.xlf')
|
28
|
+
XlfImporter::Xlf.new(file_path: file_path).stats
|
29
|
+
# => {:tu_count=>1, :seg_count=>3, :language_pairs=>[["en", "fr"], ["en", "es"]]}
|
30
|
+
|
31
|
+
# Extract the segments of an XLIFF file
|
32
|
+
# Result: [translation_units, segments]
|
33
|
+
# translation_units = [tu_id]
|
34
|
+
# segments = [tu_id, segment_role, word_count, language, segment_text]
|
35
|
+
|
36
|
+
XlfImporter::Xlf.new(file_path: file_path).import
|
37
|
+
# => [[["6234-1457917153-1"]], [["6234-1457917153-1", "source", 2, "en", "Hello world"], ["6234-1457917153-1", "target", 3, "fr", "Bonjour le monde"], ["6234-1457917153-1", "target", 2, "es", "Hola mundo"]]]
|
38
|
+
```
|
39
|
+
|
40
|
+
## Contributing
|
41
|
+
|
42
|
+
1. Fork it ( https://github.com/diasks2/xlf_importer/fork )
|
43
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
44
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
45
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
46
|
+
5. Create a new Pull Request
|
47
|
+
|
48
|
+
## License
|
49
|
+
|
50
|
+
The MIT License (MIT)
|
51
|
+
|
52
|
+
Copyright (c) 2016 Kevin S. Dias
|
53
|
+
|
54
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
55
|
+
of this software and associated documentation files (the "Software"), to deal
|
56
|
+
in the Software without restriction, including without limitation the rights
|
57
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
58
|
+
copies of the Software, and to permit persons to whom the Software is
|
59
|
+
furnished to do so, subject to the following conditions:
|
60
|
+
|
61
|
+
The above copyright notice and this permission notice shall be included in
|
62
|
+
all copies or substantial portions of the Software.
|
63
|
+
|
64
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
65
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
66
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
67
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
68
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
69
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
70
|
+
THE SOFTWARE.
|
data/Rakefile
ADDED
data/lib/xlf_importer.rb
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
require 'xlf_importer/version'
|
2
|
+
require 'xml'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'pretty_strings'
|
5
|
+
require 'charlock_holmes'
|
6
|
+
|
7
|
+
module XlfImporter
|
8
|
+
class Xlf
|
9
|
+
attr_reader :file_path, :encoding
|
10
|
+
def initialize(file_path:, **args)
|
11
|
+
@file_path = file_path
|
12
|
+
@content = File.read(open(@file_path)) if !args[:encoding].eql?('UTF-8')
|
13
|
+
if args[:encoding].nil?
|
14
|
+
@encoding = CharlockHolmes::EncodingDetector.detect(@content[0..100_000])[:encoding]
|
15
|
+
if @encoding.nil?
|
16
|
+
encoding_in_file = @content.dup.force_encoding('utf-8').scrub!("*").gsub!(/\0/, '').scan(/(?<=encoding=").*(?=")/)[0].upcase
|
17
|
+
if encoding_in_file.eql?('UTF-8')
|
18
|
+
@encoding = ('UTF-8')
|
19
|
+
elsif encoding_in_file.eql?('UTF-16')
|
20
|
+
@encoding = ('UTF-16LE')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
else
|
24
|
+
@encoding = args[:encoding].upcase
|
25
|
+
end
|
26
|
+
@doc = {
|
27
|
+
source_language: "",
|
28
|
+
target_language: "",
|
29
|
+
tu: { id: "", counter: 0, vals: [] },
|
30
|
+
seg: { lang: "", counter: 0, vals: [] },
|
31
|
+
language_pairs: []
|
32
|
+
}
|
33
|
+
raise "Encoding type could not be determined. Please set an encoding of UTF-8, UTF-16LE, or UTF-16BE" if @encoding.nil?
|
34
|
+
raise "Encoding type not supported. Please choose an encoding of UTF-8, UTF-16LE, or UTF-16BE" unless @encoding.eql?('UTF-8') || @encoding.eql?('UTF-16LE') || @encoding.eql?('UTF-16BE')
|
35
|
+
@text = CharlockHolmes::Converter.convert(@content, @encoding, 'UTF-8') if !@encoding.eql?('UTF-8')
|
36
|
+
end
|
37
|
+
|
38
|
+
def stats
|
39
|
+
if encoding.eql?('UTF-8')
|
40
|
+
analyze_stats_utf_8
|
41
|
+
else
|
42
|
+
analyze_stats_utf_16
|
43
|
+
end
|
44
|
+
{tu_count: @doc[:tu][:counter], seg_count: @doc[:seg][:counter], language_pairs: @doc[:language_pairs].uniq}
|
45
|
+
end
|
46
|
+
|
47
|
+
def import
|
48
|
+
reader = read_file
|
49
|
+
parse_file(reader)
|
50
|
+
[@doc[:tu][:vals], @doc[:seg][:vals]]
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def analyze_stats_utf_8
|
56
|
+
File.readlines(@file_path).each do |line|
|
57
|
+
analyze_line(line)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def analyze_stats_utf_16
|
62
|
+
@text.each_line do |line|
|
63
|
+
analyze_line(line)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def read_file
|
68
|
+
if encoding.eql?('UTF-8')
|
69
|
+
XML::Reader.io(open(file_path), options: XML::Parser::Options::NOERROR, encoding: XML::Encoding::UTF_8)
|
70
|
+
else
|
71
|
+
reader = @text.gsub(/(?<=encoding=").*(?=")/, 'utf-8').gsub(/&#x[0-1]?[0-9a-fA-F];/, ' ').gsub(/[\0-\x1f\x7f\u2028]/, ' ')
|
72
|
+
XML::Reader.string(reader, options: XML::Parser::Options::NOERROR, encoding: XML::Encoding::UTF_8)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def analyze_line(line)
|
77
|
+
@doc[:source_language] = line.scan(/(?<=source-language=\S)\S+(?=")/)[0] if line.include?('source-language=') && !line.scan(/(?<=source-language=\S)\S+(?=")/).empty?
|
78
|
+
@doc[:source_language] = line.scan(/(?<=source-language=\S)\S+(?=')/)[0] if line.include?('source-language=') && !line.scan(/(?<=source-language=\S)\S+(?=')/).empty?
|
79
|
+
@doc[:target_language] = line.scan(/(?<=target-language=\S)\S+(?=")/)[0] if line.include?('target-language=') && !line.scan(/(?<=target-language=\S)\S+(?=")/).empty?
|
80
|
+
@doc[:target_language] = line.scan(/(?<=target-language=\S)\S+(?=')/)[0] if line.include?('target-language=') && !line.scan(/(?<=target-language=\S)\S+(?=')/).empty?
|
81
|
+
@doc[:tu][:counter] += line.scan(/<\/trans-unit/).count
|
82
|
+
@doc[:seg][:counter] += line.scan(/<\/source/).count + line.scan(/<\/target/).count
|
83
|
+
@doc[:language_pairs] << [@doc[:source_language], @doc[:target_language]] if !@doc[:source_language].empty? && !@doc[:target_language].empty?
|
84
|
+
if line.include?('lang')
|
85
|
+
@doc[:seg][:lang] = line.scan(/(?<=[^cn]lang=\S)\S+(?=")/)[0] if !line.scan(/(?<=[^cn]lang=\S)\S+(?=")/).empty?
|
86
|
+
@doc[:seg][:lang] = line.scan(/(?<=[^cn]lang=\S)\S+(?=')/)[0] if !line.scan(/(?<=[^cn]lang=\S)\S+(?=')/).empty?
|
87
|
+
if !@doc[:seg][:lang].nil? && !@doc[:seg][:lang].empty? && @doc[:source_language] != @doc[:seg][:lang]
|
88
|
+
@doc[:language_pairs] << [@doc[:source_language], @doc[:seg][:lang]]
|
89
|
+
@doc[:language_pairs] = @doc[:language_pairs].uniq
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def parse_file(reader)
|
95
|
+
tag_stack = []
|
96
|
+
while reader.read do
|
97
|
+
eval_state_initial(tag_stack, reader)
|
98
|
+
end
|
99
|
+
reader.close
|
100
|
+
end
|
101
|
+
|
102
|
+
def eval_state_initial(tag_stack, reader)
|
103
|
+
return if reader.name == tag_stack.dup.pop
|
104
|
+
tag_stack.push(reader.name)
|
105
|
+
case reader.name.bytes.to_a
|
106
|
+
when [102, 105, 108, 101]
|
107
|
+
@doc[:source_language] = reader.get_attribute("source-language") if @doc[:source_language].empty? && reader.has_attributes? && reader.get_attribute("source-language")
|
108
|
+
@doc[:target_language] = reader.get_attribute("target-language") if @doc[:target_language].empty? && reader.has_attributes? && reader.get_attribute("target-language")
|
109
|
+
when [116, 114, 97, 110, 115, 45, 117, 110, 105, 116]
|
110
|
+
unless tag_stack[-2].nil?
|
111
|
+
return if tag_stack[-2].bytes.to_a.eql?([98, 111, 100, 121]) || tag_stack[-2].bytes.to_a.eql?([116, 114, 97, 110, 115, 45, 117, 110, 105, 116])
|
112
|
+
end
|
113
|
+
write_tu(reader)
|
114
|
+
@doc[:tu][:counter] += 1
|
115
|
+
when [115, 111, 117, 114, 99, 101] # source
|
116
|
+
@doc[:tu][:vals] << [@doc[:tu][:id]] unless @doc[:tu][:vals].include?([@doc[:tu][:id]])
|
117
|
+
write_seg(reader, 'source', @doc[:source_language])
|
118
|
+
@doc[:seg][:counter] += 1
|
119
|
+
when [116, 97, 114, 103, 101, 116] # target
|
120
|
+
@doc[:target_language] = reader.get_attribute("xml:lang") if reader.has_attributes? && reader.get_attribute("xml:lang")
|
121
|
+
@doc[:target_language] = reader.get_attribute("lang") if reader.has_attributes? && reader.get_attribute("lang")
|
122
|
+
write_seg(reader, 'target', @doc[:target_language])
|
123
|
+
@doc[:seg][:counter] += 1
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
def write_tu(reader)
|
128
|
+
generate_unique_id
|
129
|
+
end
|
130
|
+
|
131
|
+
def write_seg(reader, role, language)
|
132
|
+
return if reader.read_string.nil?
|
133
|
+
text = PrettyStrings::Cleaner.new(reader.read_string).pretty.gsub("\\","\").gsub("'",%q(\\\'))
|
134
|
+
word_count = text.gsub("\s+", ' ').split(' ').length
|
135
|
+
@doc[:seg][:vals] << [@doc[:tu][:id], role, word_count, language, text]
|
136
|
+
end
|
137
|
+
|
138
|
+
def generate_unique_id
|
139
|
+
@doc[:tu][:id] = [(1..4).map{rand(10)}.join(''), Time.now.to_i, @doc[:tu][:counter] += 1 ].join("-")
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
<xliff version='1.2'
|
2
|
+
xmlns='urn:oasis:names:tc:xliff:document:1.2'>
|
3
|
+
<file original='hello.txt' source-language='en' target-language='fr'
|
4
|
+
datatype='plaintext'>
|
5
|
+
<body>
|
6
|
+
<trans-unit id='hi'>
|
7
|
+
<source>Hello world</source>
|
8
|
+
<target>Bonjour le monde</target>
|
9
|
+
<alt-trans>
|
10
|
+
<target xml:lang='es'>Hola mundo</target>
|
11
|
+
</alt-trans>
|
12
|
+
</trans-unit>
|
13
|
+
<trans-unit id='hello'>
|
14
|
+
<source>Hello world 2</source>
|
15
|
+
<target>Bonjour le monde 3</target>
|
16
|
+
</trans-unit>
|
17
|
+
</body>
|
18
|
+
</file>
|
19
|
+
</xliff>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<xliff version='1.2'
|
2
|
+
xmlns='urn:oasis:names:tc:xliff:document:1.2'>
|
3
|
+
<file original='hello.txt' source-language='en' target-language='fr'
|
4
|
+
datatype='plaintext'>
|
5
|
+
<body>
|
6
|
+
<trans-unit id='hi'>
|
7
|
+
<source>Hello world</source>
|
8
|
+
<target>Bonjour le monde</target>
|
9
|
+
<alt-trans>
|
10
|
+
<target xml:lang='es'>Hola mundo</target>
|
11
|
+
</alt-trans>
|
12
|
+
</trans-unit>
|
13
|
+
</body>
|
14
|
+
</file>
|
15
|
+
</xliff>
|
Binary file
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe XlfImporter do
|
4
|
+
it 'has a version number' do
|
5
|
+
expect(XlfImporter::VERSION).not_to be nil
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '#stats' do
|
9
|
+
it 'reports the stats of sample_alt_translation.xlf' do
|
10
|
+
file_path = File.expand_path('../xlf_importer/spec/test_sample_files/sample_alt_translation.xlf')
|
11
|
+
xlf = XlfImporter::Xlf.new(file_path: file_path, encoding: 'UTF-8')
|
12
|
+
expect(xlf.stats).to eq({:tu_count=>1, :seg_count=>3, :language_pairs=>[["en", "fr"], ["en", "es"]]})
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'reports the stats of sample_alt_2.xlf' do
|
16
|
+
file_path = File.expand_path('../xlf_importer/spec/test_sample_files/sample_alt_2.xlf')
|
17
|
+
xlf = XlfImporter::Xlf.new(file_path: file_path, encoding: 'UTF-8')
|
18
|
+
expect(xlf.stats).to eq({:tu_count=>2, :seg_count=>5, :language_pairs=>[["en", "fr"], ["en", "es"]]})
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'reports the stats of a UTF-16 XLIFF file' do
|
22
|
+
file_path = File.expand_path('../xlf_importer/spec/test_sample_files/sample_utf-16.xlf')
|
23
|
+
xlf = XlfImporter::Xlf.new(file_path: file_path)
|
24
|
+
expect(xlf.stats).to eq({:tu_count=>1, :seg_count=>3, :language_pairs=>[["en", "fr"], ["en", "es"]]})
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe '#import' do
|
29
|
+
it 'imports sample_alt_translation.xlf' do
|
30
|
+
file_path = File.expand_path('../xlf_importer/spec/test_sample_files/sample_alt_translation.xlf')
|
31
|
+
xlf = XlfImporter::Xlf.new(file_path: file_path, encoding: 'UTF-8')
|
32
|
+
expect(xlf.import[1][2][3]).to eq('es')
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'imports sample_alt_2.xlf' do
|
36
|
+
file_path = File.expand_path('../xlf_importer/spec/test_sample_files/sample_alt_2.xlf')
|
37
|
+
xlf = XlfImporter::Xlf.new(file_path: file_path, encoding: 'UTF-8')
|
38
|
+
expect(xlf.import[0][1][0]).to eq(xlf.import[1][4][0])
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'imports sample_alt_2.xlf' do
|
42
|
+
file_path = File.expand_path('../xlf_importer/spec/test_sample_files/sample_alt_2.xlf')
|
43
|
+
xlf = XlfImporter::Xlf.new(file_path: file_path, encoding: 'UTF-8')
|
44
|
+
expect(xlf.import[0].length).to eq(2)
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'imports sample_alt_2.xlf' do
|
48
|
+
file_path = File.expand_path('../xlf_importer/spec/test_sample_files/sample_alt_2.xlf')
|
49
|
+
xlf = XlfImporter::Xlf.new(file_path: file_path, encoding: 'UTF-8')
|
50
|
+
expect(xlf.import[1][3][0]).to eq(xlf.import[0][1][0])
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'imports a UTF-16 XLIFF file' do
|
54
|
+
file_path = File.expand_path('../xlf_importer/spec/test_sample_files/sample_utf-16.xlf')
|
55
|
+
xlf = XlfImporter::Xlf.new(file_path: file_path)
|
56
|
+
expect(xlf.import[1][0][4]).to eq("Hello world")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'xlf_importer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "xlf_importer"
|
8
|
+
spec.version = XlfImporter::VERSION
|
9
|
+
spec.authors = ["Kevin S. Dias"]
|
10
|
+
spec.email = ["diasks2@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{XLIFF / XLF file importer}
|
13
|
+
spec.description = %q{Import the translation content of a XLIFF localisation file.}
|
14
|
+
spec.homepage = "https://github.com/diasks2/xlf_importer"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
22
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_runtime_dependency "libxml-ruby"
|
25
|
+
spec.add_runtime_dependency "pretty_strings", "~> 0.5.0"
|
26
|
+
spec.add_runtime_dependency "charlock_holmes_bundle_icu", "~> 0.6.9.2"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: xlf_importer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kevin S. Dias
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.9'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: libxml-ruby
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pretty_strings
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.5.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.5.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: charlock_holmes_bundle_icu
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.6.9.2
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.6.9.2
|
97
|
+
description: Import the translation content of a XLIFF localisation file.
|
98
|
+
email:
|
99
|
+
- diasks2@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- Gemfile
|
108
|
+
- LICENSE.txt
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- lib/xlf_importer.rb
|
112
|
+
- lib/xlf_importer/version.rb
|
113
|
+
- spec/spec_helper.rb
|
114
|
+
- spec/test_sample_files/sample_alt_2.xlf
|
115
|
+
- spec/test_sample_files/sample_alt_translation.xlf
|
116
|
+
- spec/test_sample_files/sample_utf-16.xlf
|
117
|
+
- spec/xlf_importer_spec.rb
|
118
|
+
- xlf_importer.gemspec
|
119
|
+
homepage: https://github.com/diasks2/xlf_importer
|
120
|
+
licenses: []
|
121
|
+
metadata: {}
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 2.4.1
|
139
|
+
signing_key:
|
140
|
+
specification_version: 4
|
141
|
+
summary: XLIFF / XLF file importer
|
142
|
+
test_files:
|
143
|
+
- spec/spec_helper.rb
|
144
|
+
- spec/test_sample_files/sample_alt_2.xlf
|
145
|
+
- spec/test_sample_files/sample_alt_translation.xlf
|
146
|
+
- spec/test_sample_files/sample_utf-16.xlf
|
147
|
+
- spec/xlf_importer_spec.rb
|