excel2local 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6259446d59964adbd1cb38cc29092225ccd6d056aba2d5b85c1e0ed23fdc333e
4
- data.tar.gz: 9155eafc9b9312e59fcdf274f1e10bdf7fef65e5bea75c53dd8176e09f085079
3
+ metadata.gz: 9ad02ae048f8fd4291bceea7a6b68bb05ab2eb1803b3d616657004ace383c4f6
4
+ data.tar.gz: 70a3cba06a8d282f55ea3ebfa0d518cd6c6a55dacdee693baa65dc50c39969a6
5
5
  SHA512:
6
- metadata.gz: c23169d4057255b68447bbd79d0650e2157301bc6c62406fbf2872c1493d969213f7d4ea8ded8851933f15c428c9bb18d41adf8004218e3568e38c18766713d9
7
- data.tar.gz: '0794356c8d335d2c765887b11d6092bd66e87efc8444b6c3cc025ecf10e20632664872eaca51b4923ddc2eba5456bca899ab06005c769266d6c99f7ecb7f8144'
6
+ metadata.gz: 11da4ba91f3e29541eb67089efddfb515079cc0b1c6267492e2da77542bcf6f4ee45d6ad13702f53c46e5ec76435f6d02533356159245aea82ba66421ab80da4
7
+ data.tar.gz: 6cc1fc1f8d75b6ea752050b0398f4d4972808ca2596756e1c6c205c61cc98dd45e1bea783a16a4569c2e2c25f435da3207732c734bc96e5d58c1a150af4e93ff
data/README.md CHANGED
@@ -1,39 +1,103 @@
1
- # Excel2local
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/excel2local`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'excel2local'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install excel2local
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/excel2local.
36
-
37
- ## License
38
-
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
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).
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 @simbol == nil #
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
@@ -1,3 +1,3 @@
1
1
  module Excel2local
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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.3.gem
79
+ - excel2local-0.1.0.gem
80
80
  - excel2local.gemspec
81
81
  - lib/excel2local.rb
82
82
  - lib/excel2local/version.rb
Binary file