ibtoolTranslation 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/ibtoolTranslation +13 -16
- data/lib/ibtoolTranslation/version.rb +1 -1
- data/lib/ibtoolTranslation.rb +17 -9
- data/spec/ibtoolTranslation_spec.rb +1 -1
- metadata +1 -2
- data/storyboards/ja.lproj/Main.strings +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6475c074c23eac2930e496e93eccba7c287b3380
|
4
|
+
data.tar.gz: d60a59caa547badc11d302e5e2761b42867e937f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0302cc571766a183df4d40a384be41d56d6781574f536c963057c1f77b9dcfbc06160994106eeffc066a53b1ffaab413d5b06fc7cd550df991f86ea533dbb274
|
7
|
+
data.tar.gz: 913122f358256dd9fccd51cc8dc8de7289d37ec8e63738e1184faabd46ceaa09d5db1a0ec24e6a73b0f602033ce166dd3ed4c4e8954b8daf55b060716781276a
|
data/bin/ibtoolTranslation
CHANGED
@@ -7,25 +7,22 @@ require "thor"
|
|
7
7
|
module IbtoolTranslation
|
8
8
|
#= IbtoolTranslation CLI
|
9
9
|
class CLI < Thor
|
10
|
-
|
11
|
-
class_option :version, :type => :boolean, :desc => 'version'
|
12
|
-
default_task :execute
|
10
|
+
default_task :update
|
13
11
|
|
14
|
-
option :dir, :type => :string, :aliases => '-d'
|
15
|
-
option :from, :type => :string , :aliases => '-f'
|
16
|
-
option :to, :type => :array, :aliases => '-t'
|
17
|
-
desc "
|
18
|
-
def
|
19
|
-
|
20
|
-
self.version
|
21
|
-
else
|
22
|
-
IbtoolTranslation::Core.new.func(options[:dir], options[:from], options[:to])
|
23
|
-
end
|
12
|
+
option :dir, :type => :string, :aliases => '-d',:required => true, :desc => 'directory of the reference'
|
13
|
+
option :from, :type => :string , :aliases => '-f',:required => true, :desc => 'storyboard of the reference'
|
14
|
+
option :to, :type => :array, :aliases => '-t',:required => true, :desc => 'storyboards of the result'
|
15
|
+
desc "update", "update storyboard"
|
16
|
+
def update
|
17
|
+
IbtoolTranslation::Core.new.update(options[:dir], options[:from], options[:to])
|
24
18
|
end
|
25
19
|
|
26
|
-
|
27
|
-
|
28
|
-
|
20
|
+
option :dir, :type => :string, :aliases => '-d',:required => true, :desc => 'directory of the reference'
|
21
|
+
option :from, :type => :string , :aliases => '-f',:required => true, :desc => 'storyboard of the reference'
|
22
|
+
option :to, :type => :array, :aliases => '-t',:required => true, :desc => 'storyboards of the result'
|
23
|
+
desc "update", "create Translation.strings"
|
24
|
+
def create
|
25
|
+
IbtoolTranslation::Core.new.update(options[:dir], options[:from], options[:to])
|
29
26
|
end
|
30
27
|
end
|
31
28
|
end
|
data/lib/ibtoolTranslation.rb
CHANGED
@@ -4,14 +4,12 @@ require 'fileutils'
|
|
4
4
|
|
5
5
|
module IbtoolTranslation
|
6
6
|
class Core
|
7
|
-
def
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
dirName
|
13
|
-
sourceDir = dirName + ARGV[1] + ".lproj"
|
14
|
-
lps = ARGV[2..-1]
|
7
|
+
def create(dirName, sourceDir, lps)
|
8
|
+
self.func(dirName, dirName + sourceDir + ".lproj", lps)
|
9
|
+
end
|
10
|
+
def update(dirName, sourceDir, lps)
|
11
|
+
self.func(dirName, dirName + sourceDir + ".lproj", lps)
|
12
|
+
self.func2(dirName, dirName + sourceDir + ".lproj", lps)
|
15
13
|
end
|
16
14
|
def func(dirName, sourceDir, lps)
|
17
15
|
storyboards = self.storyboards sourceDir
|
@@ -27,11 +25,21 @@ module IbtoolTranslation
|
|
27
25
|
addtionData = self.addtionData("#{lproj}/#{fileName}.strings")
|
28
26
|
aData = addtionData.select{|f| baseData.include?(f) == false}
|
29
27
|
transText = transText + aData.map{|f| "\"#{f}\";\n"}.join("")
|
28
|
+
File::delete("#{lproj}/#{fileName}.strings")
|
30
29
|
}
|
31
|
-
|
30
|
+
self.writeTransText("#{lproj}/Translation.strings", transText)
|
31
|
+
}
|
32
|
+
end
|
33
|
+
def func2(dirName, sourceDir, lps)
|
34
|
+
storyboards = self.storyboards sourceDir
|
35
|
+
|
36
|
+
lps.each {|lp|
|
37
|
+
lproj = dirName + lp + ".lproj"
|
38
|
+
transText = self.transText("#{lproj}/Translation.strings")
|
32
39
|
storyboards.each { |fileName|
|
33
40
|
self.fun2(lproj, fileName, transText)
|
34
41
|
`ibtool --write #{lproj}/#{fileName}.storyboard -d #{lproj}/#{fileName}.strings #{sourceDir}/#{fileName}.storyboard`
|
42
|
+
File::delete("#{lproj}/#{fileName}.strings")
|
35
43
|
puts fileName
|
36
44
|
}
|
37
45
|
}
|
@@ -19,7 +19,7 @@ describe IbtoolTranslation::Core, "load" do
|
|
19
19
|
before do
|
20
20
|
@i = IbtoolTranslation::Core.new
|
21
21
|
@i.deleteDir "./storyboards/ja.lproj/"
|
22
|
-
@i.
|
22
|
+
@i.update("./storyboards/", "en", ["ja"])
|
23
23
|
end
|
24
24
|
it "ja transText is " do
|
25
25
|
IbtoolTranslation::Core.new.transText("./storyboards/ja.lproj/Translation.strings").should == baseDataText
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibtoolTranslation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akuraru
|
@@ -78,7 +78,6 @@ files:
|
|
78
78
|
- storyboards/fr.lproj/Main.strings
|
79
79
|
- storyboards/fr.lproj/Translation.strings
|
80
80
|
- storyboards/ja.lproj/Main.storyboard
|
81
|
-
- storyboards/ja.lproj/Main.strings
|
82
81
|
- storyboards/ja.lproj/Translation.strings
|
83
82
|
homepage: ''
|
84
83
|
licenses:
|
Binary file
|