i18n_kit 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/i18n_kit.gemspec +1 -1
- data/lib/i18n_kit/importer/excel_xml.rb +10 -6
- metadata +15 -15
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/i18n_kit.gemspec
CHANGED
@@ -25,7 +25,8 @@ module I18nKit
|
|
25
25
|
# First, we're loading all Rows of the sheet
|
26
26
|
@nokodoc.css('Row').each_with_index do |row, row_index|
|
27
27
|
# In each row, we load the columns (i.e. row cells)
|
28
|
-
columns = row.css('Cell
|
28
|
+
columns = row.css('Cell')
|
29
|
+
|
29
30
|
# We skip empty rows (i.e. rows with no or just one column)
|
30
31
|
next unless columns.size > 1
|
31
32
|
# The first row might be a header column containing the names of the columns
|
@@ -34,26 +35,29 @@ module I18nKit
|
|
34
35
|
if @locales == [] && row_index == 0
|
35
36
|
# Going through the cells of the header row
|
36
37
|
columns.each_with_index do |column, column_index|
|
38
|
+
next if column.children[1] == nil
|
37
39
|
# The first column is expected to contain the key, all others we interpret as locale name
|
38
|
-
@locales << column.text.to_sym unless column_index == 0
|
40
|
+
@locales << column.text.to_s.strip.to_sym unless column_index == 0
|
39
41
|
end
|
42
|
+
#raise @locales.inspect
|
40
43
|
else
|
41
44
|
# This is every row except the header row
|
42
45
|
# The key is expected to be in the first column
|
43
|
-
key = columns[0].text
|
46
|
+
key = columns[0].text.to_s.strip
|
47
|
+
puts row.inspect if key == 'buk.sell.contact.valuation.choose_closest_auction_house'
|
44
48
|
# Now let's read the translations for this key. I.e. all columns except the first one
|
45
49
|
locales.each_with_index do |locale, locale_index|
|
46
50
|
locale = locale.to_s
|
47
51
|
@result[locale] ||= {}
|
48
|
-
@result[locale][key] = (columns[locale_index+1] == nil ? '' : columns[locale_index+1].text)
|
52
|
+
@result[locale][key] = (columns[locale_index+1] == nil ? '' : columns[locale_index+1].text.to_s.strip)
|
49
53
|
end
|
50
54
|
end
|
51
55
|
end
|
52
56
|
|
53
57
|
documents = []
|
54
58
|
@result.each { |locale, hash|
|
55
|
-
|
56
|
-
documents
|
59
|
+
document = ::I18nKit::Document.new(:locale => locale, :flat_hash => hash, :name => "excel_#{locale}".to_sym)
|
60
|
+
documents << document
|
57
61
|
}
|
58
62
|
documents
|
59
63
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- funkensturm.
|
@@ -19,8 +19,6 @@ date: 2011-06-07 00:00:00 +02:00
|
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
prerelease: false
|
23
|
-
type: :runtime
|
24
22
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
23
|
none: false
|
26
24
|
requirements:
|
@@ -30,11 +28,11 @@ dependencies:
|
|
30
28
|
segments:
|
31
29
|
- 0
|
32
30
|
version: "0"
|
31
|
+
type: :runtime
|
33
32
|
name: nokogiri
|
34
33
|
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
34
|
prerelease: false
|
37
|
-
|
35
|
+
- !ruby/object:Gem::Dependency
|
38
36
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
37
|
none: false
|
40
38
|
requirements:
|
@@ -44,11 +42,11 @@ dependencies:
|
|
44
42
|
segments:
|
45
43
|
- 0
|
46
44
|
version: "0"
|
45
|
+
type: :runtime
|
47
46
|
name: ya2yaml
|
48
47
|
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
48
|
prerelease: false
|
51
|
-
|
49
|
+
- !ruby/object:Gem::Dependency
|
52
50
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
51
|
none: false
|
54
52
|
requirements:
|
@@ -60,11 +58,11 @@ dependencies:
|
|
60
58
|
- 3
|
61
59
|
- 0
|
62
60
|
version: 2.3.0
|
61
|
+
type: :development
|
63
62
|
name: rspec
|
64
63
|
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
64
|
prerelease: false
|
67
|
-
|
65
|
+
- !ruby/object:Gem::Dependency
|
68
66
|
requirement: &id004 !ruby/object:Gem::Requirement
|
69
67
|
none: false
|
70
68
|
requirements:
|
@@ -76,11 +74,11 @@ dependencies:
|
|
76
74
|
- 0
|
77
75
|
- 0
|
78
76
|
version: 1.0.0
|
77
|
+
type: :development
|
79
78
|
name: bundler
|
80
79
|
version_requirements: *id004
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
80
|
prerelease: false
|
83
|
-
|
81
|
+
- !ruby/object:Gem::Dependency
|
84
82
|
requirement: &id005 !ruby/object:Gem::Requirement
|
85
83
|
none: false
|
86
84
|
requirements:
|
@@ -92,11 +90,11 @@ dependencies:
|
|
92
90
|
- 6
|
93
91
|
- 2
|
94
92
|
version: 1.6.2
|
93
|
+
type: :development
|
95
94
|
name: jeweler
|
96
95
|
version_requirements: *id005
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
96
|
prerelease: false
|
99
|
-
|
97
|
+
- !ruby/object:Gem::Dependency
|
100
98
|
requirement: &id006 !ruby/object:Gem::Requirement
|
101
99
|
none: false
|
102
100
|
requirements:
|
@@ -106,8 +104,10 @@ dependencies:
|
|
106
104
|
segments:
|
107
105
|
- 0
|
108
106
|
version: "0"
|
107
|
+
type: :development
|
109
108
|
name: rcov
|
110
109
|
version_requirements: *id006
|
110
|
+
prerelease: false
|
111
111
|
description: You can import XML files that were exported using Excel, or standard i18n hierarchical YML files. Both will be normalized as I18nKit::Document objects so that they can be compared with each other. You need implement the comparison method yourself, however. I18nKit only provides the Iterator. )
|
112
112
|
email: commanda.keen@gmail.com
|
113
113
|
executables: []
|