xlocalize 0.5.0 → 0.6.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae37aab6a0d88d19503863c88fba6781572be6e0
4
- data.tar.gz: 7bad4314a85fc60fba671d3d112927e1c0903804
3
+ metadata.gz: fa7fbd8d30e2a08b01bb26ce46700e69b71933a7
4
+ data.tar.gz: 1154a3d87abef4595417e4810fcd5664bc6c2dc9
5
5
  SHA512:
6
- metadata.gz: d5697b57687f2229fbcfd7e03c735cd61de0afd61f8d5602e79560a5bad1b6e90564dd8f2123d89ed7e9c4c287fe67206628508593617f08208310802a4b511e
7
- data.tar.gz: 70537aa2952e423b8bb8073f422b93a12d4441876bbc84bde3e20e82ca3142738a86cc85da45f9c50475ca85c32ef43ab59d14372740a118bf85061bf7b858c1
6
+ metadata.gz: 480ca68941c6fea0bf101adf2f276f5644147600772b40a68f54a45306770cedd6b59f99a90c925778666bf86ac45b59fa6d3585675f7721702e98a49ec58635
7
+ data.tar.gz: 7faf6415c3a9169ebf396c95cdd535b754f9ea013a6e86f67414d21aed04d8c76747b48828fe4b34bcdfc3df0d04d0e556fe1e08e274d2ae735b2f31259829ce
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [v0.6.0](https://github.com/viktorasl/xlocalize/releases/tag/0.6.0)
2
+
3
+ * [17ffefc](https://github.com/viktorasl/xlocalize/commit/17ffefcc94272385091cef087e7df18a407897a8) Xliff merging before upload
4
+
1
5
  ## [v0.5.0](https://github.com/viktorasl/xlocalize/releases/tag/0.5.0)
2
6
 
3
7
  * [cb03ba3](https://github.com/viktorasl/xlocalize/commit/cb03ba3a91c3b4218fd880b50c7b9f2fff113573) Translations import revamp
@@ -37,6 +37,11 @@ module Xlocalize
37
37
  end
38
38
 
39
39
  purelyze(master_lang, targets, excl_prefix, project, filer_ui_duplicates=Helper.xcode_at_least?(9.3), exclude_units)
40
+ if wti then
41
+ original_doc = Nokogiri::XML(wti.pull(master_lang)['xliff'])
42
+ Nokogiri::XML(File.open(master_file_name)).merge_on_top_of(original_doc)
43
+ File.write(master_file_name, original_doc.to_xml)
44
+ end
40
45
  push_master_file(wti, master_lang, master_file_name) if !wti.nil?
41
46
  end
42
47
 
@@ -1,4 +1,4 @@
1
1
  module Xlocalize
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  DESCRIPTION = "Xcode localizations import/export helper tool"
4
4
  end
@@ -77,5 +77,26 @@ module Xlocalize
77
77
  .gsub('\\\\n', '\n')
78
78
  end
79
79
  end
80
+
81
+ def merge_on_top_of(original_doc)
82
+ #original_doc = Nokogiri::XML(wti.pull(master_lang)['xliff'])
83
+ original_xliff = original_doc.at_css('xliff')
84
+ doc = self#Nokogiri::XML(File.open(master_file_name))
85
+ doc.xpath("//xmlns:file").each { |node|
86
+ fname = node["original"]
87
+ original_file = original_doc.at_css('file[original="' << fname << '"] > body')
88
+ if original_file then
89
+ node.css('body > trans-unit').each { |unit|
90
+ key = unit['id']
91
+ original_unit = original_file.at_css('trans-unit[id="' << key << '"]')
92
+ if !original_unit then
93
+ original_file << unit
94
+ end
95
+ }
96
+ else
97
+ original_xliff << node
98
+ end
99
+ }
100
+ end
80
101
  end
81
102
  end
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.5.0
4
+ version: 0.6.0
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: 2018-07-16 00:00:00.000000000 Z
11
+ date: 2018-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri