xlocalize 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/xlocalize/executor.rb +3 -1
- data/lib/xlocalize/version.rb +1 -1
- data/lib/xlocalize/webtranslateit.rb +20 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f92b8896b3c93789775661d8d918efa00504b0f
|
4
|
+
data.tar.gz: 29f41bf80a64c1da95806679d0b19fcc9ff1fdc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e503707d2265b37717c365a1c67b1ab85d1da11776a5aa5077b32ac8b792fb551f4c32f3fd16cc2a6f8bbdc20dedffcb04299f5a4c39cadc743318696dd41d6
|
7
|
+
data.tar.gz: 1b16f3dfc86abe85824cb3769b2362a79d1cc62edacb3da884e5178f0cd58ebfdf7475ce8a44dd23b906662a9c57422df69ec3c34a1ad673146274347d8afcee
|
data/lib/xlocalize/executor.rb
CHANGED
@@ -35,13 +35,15 @@ module Xlocalize
|
|
35
35
|
begin
|
36
36
|
puts "Uploading master file to WebtranslateIt"
|
37
37
|
file = File.open(master_file_name, 'r')
|
38
|
-
|
38
|
+
plurals_path = plurals_file_name(master_lang)
|
39
|
+
plurals_file = File.exist?(plurals_path) ? File.open(plurals_path, 'r') : nil
|
39
40
|
wti.push_master(file, plurals_file)
|
40
41
|
puts "Done.".green
|
41
42
|
rescue => err
|
42
43
|
puts err.to_s.red
|
43
44
|
ensure
|
44
45
|
file.close unless file.nil?
|
46
|
+
plurals_file.close unless plurals_file.nil?
|
45
47
|
end if !wti.nil?
|
46
48
|
end
|
47
49
|
|
data/lib/xlocalize/version.rb
CHANGED
@@ -29,22 +29,7 @@ module Xlocalize
|
|
29
29
|
}
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
33
|
-
puts 'Updating xliff file'
|
34
|
-
# uploding master xliff file
|
35
|
-
request = Net::HTTP::Put::Multipart.new("/api/projects/#{@key}/files/#{@xliff_file_id}/locales/#{@source_locale}", {
|
36
|
-
"file" => UploadIO.new(file, "text/plain", file.path),
|
37
|
-
"merge" => !override,
|
38
|
-
"ignore_missing" => true,
|
39
|
-
"label" => "",
|
40
|
-
"low_priority" => false })
|
41
|
-
|
42
|
-
@http.request(request) {|res|
|
43
|
-
if !res.code.to_i.between?(200, 300)
|
44
|
-
raise JSON.parse(res.body)["error"]
|
45
|
-
end
|
46
|
-
}
|
47
|
-
|
32
|
+
def push_master_plurals(plurals_file, override = true)
|
48
33
|
if @plurals_file_id.nil?
|
49
34
|
puts 'Creating plurals file'
|
50
35
|
# /api/projects/:project_token/files [POST]
|
@@ -76,6 +61,25 @@ module Xlocalize
|
|
76
61
|
end
|
77
62
|
end
|
78
63
|
|
64
|
+
def push_master(file, plurals_file, override = true)
|
65
|
+
puts 'Updating xliff file'
|
66
|
+
# uploding master xliff file
|
67
|
+
request = Net::HTTP::Put::Multipart.new("/api/projects/#{@key}/files/#{@xliff_file_id}/locales/#{@source_locale}", {
|
68
|
+
"file" => UploadIO.new(file, "text/plain", file.path),
|
69
|
+
"merge" => !override,
|
70
|
+
"ignore_missing" => true,
|
71
|
+
"label" => "",
|
72
|
+
"low_priority" => false })
|
73
|
+
|
74
|
+
@http.request(request) {|res|
|
75
|
+
if !res.code.to_i.between?(200, 300)
|
76
|
+
raise JSON.parse(res.body)["error"]
|
77
|
+
end
|
78
|
+
}
|
79
|
+
|
80
|
+
push_master_plurals(plurals_file, override) if not plurals_file.nil?
|
81
|
+
end
|
82
|
+
|
79
83
|
def pull(locale)
|
80
84
|
# downloading master xliff file
|
81
85
|
data = {}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xlocalize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Viktoras Laukevičius
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|