excel2local 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +103 -39
- data/example/Your_Rails_App/config/locales/locales.xlsx +0 -0
- data/example/locales.xlsx +0 -0
- data/excel2local-0.1.0.gem +0 -0
- data/lib/excel2local.rb +7 -7
- data/lib/excel2local/version.rb +1 -1
- metadata +2 -2
- data/excel2local-0.1.3.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ad02ae048f8fd4291bceea7a6b68bb05ab2eb1803b3d616657004ace383c4f6
|
4
|
+
data.tar.gz: 70a3cba06a8d282f55ea3ebfa0d518cd6c6a55dacdee693baa65dc50c39969a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11da4ba91f3e29541eb67089efddfb515079cc0b1c6267492e2da77542bcf6f4ee45d6ad13702f53c46e5ec76435f6d02533356159245aea82ba66421ab80da4
|
7
|
+
data.tar.gz: 6cc1fc1f8d75b6ea752050b0398f4d4972808ca2596756e1c6c205c61cc98dd45e1bea783a16a4569c2e2c25f435da3207732c734bc96e5d58c1a150af4e93ff
|
data/README.md
CHANGED
@@ -1,39 +1,103 @@
|
|
1
|
-
# Excel2local
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
1
|
+
# Excel2local
|
2
|
+
Hey! You want to EASY manage your localise?
|
3
|
+
Correct and change the location in Excel. Send it for transfer to outsourcing. Save time, spend it on yourself.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
```ruby
|
9
|
+
gem 'excel2local'
|
10
|
+
```
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install excel2local
|
19
|
+
|
20
|
+
## Usage if rails
|
21
|
+
Correct file localises.xlsx and place it to yiur your_rails_app/config/locales/
|
22
|
+
and type command in config.ru (for make localises file befoure every start rails) or there where you want to make locales
|
23
|
+
```ruby
|
24
|
+
Excel2local::localize! './config/locales/locales.xlsx','./config/locales'
|
25
|
+
```
|
26
|
+
notice: old locales files will be deleted
|
27
|
+
|
28
|
+
## Usage if not rails
|
29
|
+
require gem if not rails
|
30
|
+
```ruby
|
31
|
+
require 'excel2local'
|
32
|
+
|
33
|
+
Excel2local::localize! '****.xlsx','locales path'
|
34
|
+
```
|
35
|
+
|
36
|
+
## Correct localises.xlsx or other *.xlsx
|
37
|
+
Such Excel configuration = 3 files of locales: en.yml, ru.yml,ru_fan.yml
|
38
|
+
|
39
|
+
--- | en | ru | ru_fun |
|
40
|
+
--- | --- | --- | --- |
|
41
|
+
hello | hello | привет | приувет |
|
42
|
+
hello.world | hello world | привет мир | YO! |
|
43
|
+
head.info.true | true | правда | тру |
|
44
|
+
head.info.connect | connect to server | соединение | контакт |
|
45
|
+
head.true.test | test | тест | эй бро |
|
46
|
+
|
47
|
+
|
48
|
+
en.yml
|
49
|
+
```ruby
|
50
|
+
en:
|
51
|
+
hello: 'hello'
|
52
|
+
world: 'hello world'
|
53
|
+
head:
|
54
|
+
info:
|
55
|
+
'true': 'true'
|
56
|
+
connect: 'connect to server'
|
57
|
+
'true':
|
58
|
+
test: 'test'
|
59
|
+
```
|
60
|
+
ru.yml
|
61
|
+
```ruby
|
62
|
+
ru:
|
63
|
+
hello: 'привет'
|
64
|
+
world: 'привет мир'
|
65
|
+
head:
|
66
|
+
info:
|
67
|
+
'true': 'правда'
|
68
|
+
connect: 'соединение'
|
69
|
+
'true':
|
70
|
+
test: 'тест'
|
71
|
+
```
|
72
|
+
ru_fun
|
73
|
+
```ruby
|
74
|
+
ru_fun:
|
75
|
+
hello: 'приувет'
|
76
|
+
world: 'YO!'
|
77
|
+
head:
|
78
|
+
info:
|
79
|
+
'true': 'тру'
|
80
|
+
connect: 'контакт '
|
81
|
+
'true':
|
82
|
+
test: 'эй бро'
|
83
|
+
```
|
84
|
+
|
85
|
+
You see, that the specific is correctly processed (true = 'true')
|
86
|
+
and for example
|
87
|
+
x1.y1.n1 =
|
88
|
+
```ruby
|
89
|
+
x1:
|
90
|
+
y1:
|
91
|
+
n1:
|
92
|
+
```
|
93
|
+
## Development
|
94
|
+
gem uses beautiful gem - "roo" --> https://github.com/roo-rb/roo
|
95
|
+
|
96
|
+
|
97
|
+
## Contributing
|
98
|
+
|
99
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/eliseevTech/excel2local or eliseevmail@ya.ru
|
100
|
+
|
101
|
+
## License
|
102
|
+
|
103
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
Binary file
|
data/example/locales.xlsx
CHANGED
Binary file
|
Binary file
|
data/lib/excel2local.rb
CHANGED
@@ -17,14 +17,14 @@ module Excel2local
|
|
17
17
|
else
|
18
18
|
row.each_with_index { |col, col_index| #если не первая строка
|
19
19
|
@simbol = col if col_index == 0 #если
|
20
|
-
break if
|
21
|
-
if (col_index != 0)
|
22
|
-
@simbol.split(".").each_with_index { | simbol, index |
|
20
|
+
#break if #
|
21
|
+
if (col_index != 0) and (@simbol != nil ) and (col != nil)
|
22
|
+
@simbol.to_s.split(".").each_with_index { | simbol, index |
|
23
23
|
simbol = "\'" + simbol + "\'" if [ "true", "false", "on", "off", "yes", "no" ].member?(simbol)
|
24
24
|
if simbol != simbol_memory[col_index][index] then
|
25
|
-
File.open("#{save_place}/#{yml_file[col_index]}.yml", "a") { |file| file.print " "*(index+1) + "#{simbol}:" } if @simbol.split(".").length - 1 == index
|
26
|
-
File.open("#{save_place}/#{yml_file[col_index]}.yml", "a") { |file| file.puts " "*(index+1) + "#{simbol}:" } if @simbol.split(".").length - 1 != index
|
27
|
-
index.upto(@simbol.split(".").length ) { |n| simbol_memory[col_index].delete_at(n)}
|
25
|
+
File.open("#{save_place}/#{yml_file[col_index]}.yml", "a") { |file| file.print " "*(index+1) + "#{simbol}:" } if @simbol.to_s.split(".").length - 1 == index
|
26
|
+
File.open("#{save_place}/#{yml_file[col_index]}.yml", "a") { |file| file.puts " "*(index+1) + "#{simbol}:" } if @simbol.to_s.split(".").length - 1 != index
|
27
|
+
index.upto(@simbol.to_s.split(".").length ) { |n| simbol_memory[col_index].delete_at(n)}
|
28
28
|
end
|
29
29
|
simbol_memory[col_index][index] = simbol
|
30
30
|
}
|
@@ -34,4 +34,4 @@ module Excel2local
|
|
34
34
|
end
|
35
35
|
}
|
36
36
|
end
|
37
|
-
end
|
37
|
+
end
|
data/lib/excel2local/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: excel2local
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eliseev_EV
|
@@ -76,7 +76,7 @@ files:
|
|
76
76
|
- example/Your_Rails_App/config/locales/locales.xlsx
|
77
77
|
- example/Your_Rails_App/example.rb
|
78
78
|
- example/locales.xlsx
|
79
|
-
- excel2local-0.1.
|
79
|
+
- excel2local-0.1.0.gem
|
80
80
|
- excel2local.gemspec
|
81
81
|
- lib/excel2local.rb
|
82
82
|
- lib/excel2local/version.rb
|
data/excel2local-0.1.3.gem
DELETED
Binary file
|