xlocalize 0.3.1 → 0.3.2

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: f18a1267e6b51f35e4ed9744bb3d0fb93aa19350
4
- data.tar.gz: d5761da399cbc9057322506902fb6aabe797de8b
3
+ metadata.gz: 49c020e414aa5935d3d5613c930196af1ccc3b79
4
+ data.tar.gz: 43048b71638f80dd8ff958d99800bd59af82cc57
5
5
  SHA512:
6
- metadata.gz: e7239c52d390a97c8dd1b0e9ff0e9943e05a059e7186919b399a6a50aadcb15d3b4272470ad8114d006ce76869ab0e0d85a9bebacaf294771e6b526305188114
7
- data.tar.gz: ce3ca40f1c3285255afb7c397994fe47fa69eab9dab68752f3e2cb0509d48fe26a81e15a39916ad8e3550eaf1e398ed4d239f8c659d8e9b9d399913f44b1b4c5
6
+ metadata.gz: 2a48bd0f91385b7e011f6f7fb3b9d5b1ae643d0bc3e4a84cf9be3dc3773b0a7432917efaccc786cc9c951aafd12b3c45acd9d9391764a8f78e38a9d31595a3ef
7
+ data.tar.gz: b57cdabfaf66d11ee69a6bd73e06075bf5b135d8e5429ed2793b4ab4bec85160b851f367601a0d94a995c700cb46978cfcbf936788d2e26f43219e8a7df138ee
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## [v0.3.2](https://github.com/viktorasl/xlocalize/releases/tag/0.3.2)
2
+
3
+ * [d081ce2](https://github.com/viktorasl/xlocalize/commit/d081ce2640d7e8997d6d98a7659f31d571103f36) Bumps nokogiri version
4
+ * [8e91f25](https://github.com/viktorasl/xlocalize/commit/8e91f256dd17c9566848abe3a5e1d06ca283f4f7) Deduplicates generated storyboard & xib translation files
5
+
1
6
  ## [v0.3.1](https://github.com/viktorasl/xlocalize/releases/tag/0.3.1)
2
7
 
3
8
  * [7eb4563](https://github.com/viktorasl/xlocalize/commit/7eb4563456932b72fab0b3579a9d9ed1d5b97f0c) Fixes plurals export on Xcode9 and later
@@ -34,7 +34,7 @@ module Xlocalize
34
34
  end
35
35
  end
36
36
 
37
- purelyze(master_lang, targets, excl_prefix, project)
37
+ purelyze(master_lang, targets, excl_prefix, project, filer_ui_duplicates=Helper.xcode_at_least?(9.3))
38
38
  push_master_file(wti, master_lang, master_file_name) if !wti.nil?
39
39
  end
40
40
 
@@ -55,7 +55,7 @@ module Xlocalize
55
55
  end if !wti.nil?
56
56
  end
57
57
 
58
- def purelyze(locale, targets, excl_prefix, project)
58
+ def purelyze(locale, targets, excl_prefix, project, filer_ui_duplicates=false)
59
59
  locale_file_name = locale_file_name(locale)
60
60
  doc = Nokogiri::XML(open(locale_file_name))
61
61
 
@@ -67,7 +67,11 @@ module Xlocalize
67
67
  plurals = doc.filter_plurals(project)
68
68
  puts "Removing all files having no trans-unit elements after removal" if $VERBOSE
69
69
  doc.filter_empty_files
70
-
70
+ if filer_ui_duplicates
71
+ puts "Filtering duplicate xib & storyboard translation files" if $VERBOSE
72
+ doc.filter_duplicate_storyboard_xib_files
73
+ end
74
+
71
75
  puts "Writing modified XLIFF file to #{locale_file_name}" if $VERBOSE
72
76
  File.open(locale_file_name, 'w') { |f| f.write(doc.to_xml) }
73
77
  if !plurals.empty?
@@ -1,4 +1,4 @@
1
1
  module Xlocalize
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  DESCRIPTION = "Xcode localizations import/export helper tool"
4
4
  end
@@ -55,5 +55,19 @@ module Xlocalize
55
55
  node.parent.remove if node.elements.count == 0
56
56
  }
57
57
  end
58
+
59
+ def filter_duplicate_storyboard_xib_files
60
+ all_files = self.xpath("//xmlns:file").map { |node| Pathname.new(node["original"]).split.last.to_s }
61
+ self.xpath("//xmlns:file").each do |node|
62
+ fname = Pathname.new(node["original"]).split.last.to_s
63
+ if fname.end_with?(".strings")
64
+ storyboard_fname = fname.sub(".strings", ".storyboard")
65
+ xib_fname = fname.sub(".strings", ".xib")
66
+ if all_files.include?(storyboard_fname) || all_files.include?(xib_fname)
67
+ node.remove
68
+ end
69
+ end
70
+ end
71
+ end
58
72
  end
59
73
  end
data/xlocalize.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_runtime_dependency 'nokogiri', '= 1.6'
22
+ spec.add_runtime_dependency 'nokogiri', '~> 1.8.2'
23
23
  spec.add_runtime_dependency 'commander', '~> 4.4'
24
24
  spec.add_runtime_dependency 'colorize', '~> 0.8'
25
25
  spec.add_runtime_dependency 'multipart-post', '~> 2.0'
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xlocalize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
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-02-01 00:00:00.000000000 Z
11
+ date: 2018-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: 1.8.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: 1.8.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: commander
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -189,4 +189,3 @@ signing_key:
189
189
  specification_version: 4
190
190
  summary: Xcode localizations import/export helper tool
191
191
  test_files: []
192
- has_rdoc: