i18n_sync 0.3.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  i18n Sync!
2
2
  ==========
3
3
 
4
- Syncs all locale yml/rb files based on a "master" one.
4
+ Syncs all locales/languages yml/rb files keys based on a "master" one.
5
5
 
6
6
 
7
7
  Install
@@ -11,7 +11,7 @@ Install
11
11
 
12
12
 
13
13
  Use
14
- ---
14
+ ===
15
15
 
16
16
 
17
17
  i18s path/to/master/file.lang.yml
@@ -24,22 +24,37 @@ Example:
24
24
  i18s config/locales/app.en.yml
25
25
 
26
26
  This command syncs all config/locale/app.*.yml files
27
- using en as the master.
27
+ using 'app.en.yml' as the master.
28
28
 
29
29
 
30
- Other Options
31
- -------------
30
+ Create New Files
31
+ ----------------
32
+
33
+ i18s config/locales/app.en.yml pt es it
34
+
35
+
36
+ This creates 'app.pt.yml', 'app.es.yml'....
37
+
38
+
39
+
40
+ Add Key
41
+ -------
32
42
 
33
43
  i18s add some.very.nested.key Value path/to/file
34
44
 
35
45
  Adds the new key on the file and every other translation.
36
46
 
37
47
 
48
+
49
+ Full Sync
50
+ ---------
51
+
38
52
  i18s path/to/directory
39
53
 
40
54
  Syncronizes the entire directory.
41
55
 
42
56
 
57
+
43
58
  Note on Patches/Pull Requests
44
59
  -----------------------------
45
60
 
data/Rakefile CHANGED
@@ -1,41 +1,32 @@
1
- require 'rubygems'
2
- require 'rake'
1
+ require 'bundler'
2
+ Bundler.setup
3
3
  require 'rspec/core/rake_task'
4
4
 
5
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
6
+ require "i18n_sync"
5
7
 
6
- begin
7
- require 'jeweler'
8
- Jeweler::Tasks.new do |gem|
9
- gem.name = "i18n_sync"
10
- gem.summary = %Q{Syncs all locale yml/rb files based on a "master" one.}
11
- gem.description = %Q{Gem to sync all locale yml/rb files based on a "master" one.}
12
- gem.email = "x@nofxx.com"
13
- gem.homepage = "http://github.com/nofxx/i18n_sync"
14
- gem.authors = ["Marcos Piccinini"]
15
- gem.add_dependency "ya2yaml"
16
- gem.add_development_dependency "rspec", ">= 2.5.0"
17
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
- end
19
- Jeweler::GemcutterTasks.new
20
- rescue LoadError
21
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
8
+ desc "Builds the gem"
9
+ task :gem => :build
10
+ task :build do
11
+ system "gem build i18n_sync.gemspec"
12
+ Dir.mkdir("pkg") unless Dir.exists?("pkg")
13
+ system "mv i18n_sync-#{I18S::VERSION}.gem pkg/"
22
14
  end
23
15
 
24
-
25
- desc "Runs spec suite"
26
- RSpec::Core::RakeTask.new(:spec) do |spec|
27
- spec.pattern = 'spec/*_spec.rb'
28
- spec.rspec_opts = ['--backtrace --colour']
16
+ task :install => :build do
17
+ system "sudo gem install pkg/i18n_sync-#{I18S::VERSION}.gem"
29
18
  end
30
19
 
31
- task :default => :spec
20
+ desc "Release the gem - Gemcutter"
21
+ task :release => :build do
22
+ system "git tag -a v#{I18S::VERSION} -m 'Tagging #{I18S::VERSION}'"
23
+ system "git push --tags"
24
+ system "gem push pkg/i18n_sync-#{I18S::VERSION}.gem"
25
+ end
32
26
 
33
- require 'rake/rdoctask'
34
- Rake::RDocTask.new do |rdoc|
35
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
36
27
 
37
- rdoc.rdoc_dir = 'rdoc'
38
- rdoc.title = "i18n_sync #{version}"
39
- rdoc.rdoc_files.include('README*')
40
- rdoc.rdoc_files.include('lib/**/*.rb')
28
+ RSpec::Core::RakeTask.new(:spec) do |spec|
29
+ spec.pattern = "spec/**/*_spec.rb"
41
30
  end
31
+
32
+ task :default => [:spec]
data/bin/i18s CHANGED
@@ -18,7 +18,10 @@ Options = {:lang => :en}
18
18
 
19
19
  parser = OptionParser.new do |opts|
20
20
  opts.banner = <<BANNER
21
- I18N Sync
21
+ ------------------------------------------------------
22
+ I18N Sync ->
23
+ <-
24
+ ------------------------------------------------------
22
25
 
23
26
  Usage: #{File.basename($0)} <path/to/master.yml> [args]
24
27
 
data/lib/i18n_sync.rb CHANGED
@@ -1,10 +1,12 @@
1
1
  #
2
2
  # Inspired by translation rake task on spree (http://spreecommerce.com/)
3
3
  #
4
- # Changed to use YAML instead of text regex, but yaml has issues so we need to:
4
+ require 'yaml'
5
+ # Changed to use YAML instead of text regex,
6
+ # but yaml has issues so we need to:
5
7
  require 'ya2yaml'
6
- # To work with utf8 encoded .yml files.
7
-
8
+ # In order to work with utf8 encoded .yml files.
9
+ # TODO: Fixed in ruby 1.9.x ???
8
10
 
9
11
  class Hash
10
12
  def deep_merge!(other_hash)
@@ -18,6 +20,8 @@ end
18
20
 
19
21
  class I18S
20
22
 
23
+ VERSION = '0.5.0' # babel shark
24
+
21
25
  # Just here cuz I'm lazy....TBF really ugly ! ! ! !
22
26
  def self.work_on(argv, opts = {}, argf = [])
23
27
  if File.directory? path = argv[0]
@@ -0,0 +1,14 @@
1
+ en:
2
+ another: Another
3
+ newone: "New One!"
4
+ test: Test
5
+ very:
6
+ nasty:
7
+ nested:
8
+ bax: Bax
9
+ foo: Foo
10
+ bar: Bar
11
+ newvery:
12
+ nasty:
13
+ nested:
14
+ hi: Hi
@@ -0,0 +1,8 @@
1
+ pt:
2
+ test: Teste
3
+ old: Velho
4
+ very:
5
+ nasty:
6
+ nested:
7
+ foo: Fu
8
+ old: Velho
data/spec/work/en.yml ADDED
@@ -0,0 +1,5 @@
1
+ # Comment cool
2
+
3
+ en:
4
+ sync: To Sync It!
5
+ test: Test
@@ -0,0 +1,10 @@
1
+
2
+ ---
3
+ en:
4
+ dynamic:
5
+ nested:
6
+ very:
7
+ nasty: Nasty
8
+ normal: Normal
9
+ with_colon: "Value: Rock"
10
+ yup: true
@@ -0,0 +1,10 @@
1
+
2
+ ---
3
+ pt:
4
+ dynamic:
5
+ nested:
6
+ very:
7
+ nasty: Nasty
8
+ normal: Normal
9
+ with_colon: "Value: Rock"
10
+ yup: Sim
@@ -0,0 +1,4 @@
1
+
2
+ en:
3
+ something: Something
4
+ another: Another
@@ -0,0 +1,3 @@
1
+
2
+ pt:
3
+ something: Algo
@@ -0,0 +1,3 @@
1
+ en:
2
+ blue: Blue
3
+ alpha: Alpha
@@ -0,0 +1,4 @@
1
+ pt:
2
+ zebra: Zebra
3
+ blue: Azul
4
+ alpha: Alfa
data/spec/work/pt.yml ADDED
@@ -0,0 +1,5 @@
1
+
2
+ pt:
3
+ sync: To Sync It!
4
+ test: Teste
5
+ new: "Uau, isso é novo"
@@ -0,0 +1,16 @@
1
+
2
+ ---
3
+ en:
4
+ another: Another
5
+ newone: "New One!"
6
+ newvery:
7
+ nasty:
8
+ nested:
9
+ hi: Hi
10
+ test: Test
11
+ very:
12
+ nasty:
13
+ nested:
14
+ bar: Bar
15
+ bax: Bax
16
+ foo: Foo
@@ -0,0 +1,16 @@
1
+
2
+ ---
3
+ pt:
4
+ another: Another
5
+ newone: "New One!"
6
+ newvery:
7
+ nasty:
8
+ nested:
9
+ hi: Hi
10
+ test: Teste
11
+ very:
12
+ nasty:
13
+ nested:
14
+ bar: Bar
15
+ bax: Bax
16
+ foo: Fu
@@ -0,0 +1,5 @@
1
+ # Comment cool
2
+
3
+ en:
4
+ sync: To Sync It!
5
+ test: Test
@@ -0,0 +1,6 @@
1
+
2
+ ---
3
+ en:
4
+ normal: Normal
5
+ with_colon: "Value: Rock"
6
+ yup: true
@@ -0,0 +1,6 @@
1
+
2
+ ---
3
+ pt:
4
+ normal: Normal
5
+ with_colon: "Value: Rock"
6
+ yup: Sim
@@ -0,0 +1,5 @@
1
+
2
+ ---
3
+ en:
4
+ another: Another
5
+ something: Something
@@ -0,0 +1,5 @@
1
+
2
+ ---
3
+ pt:
4
+ another: Another
5
+ something: Algo
@@ -0,0 +1,5 @@
1
+
2
+ ---
3
+ en:
4
+ alpha: Alpha
5
+ blue: Blue
@@ -0,0 +1,5 @@
1
+
2
+ ---
3
+ pt:
4
+ alpha: Alfa
5
+ blue: Azul
@@ -0,0 +1,5 @@
1
+
2
+ pt:
3
+ sync: To Sync It!
4
+ test: Teste
5
+ new: "Uau, isso é novo"
metadata CHANGED
@@ -1,115 +1,200 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: i18n_sync
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 3
8
- - 0
9
- version: 0.3.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ prerelease:
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Marcos Piccinini
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-06-06 00:00:00 -03:00
18
- default_executable: i18s
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: ya2yaml
12
+ date: 2012-09-09 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: i18n
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 0.6.0
22
+ type: :development
22
23
  prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
24
25
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- version: "0"
31
- type: :runtime
32
- version_requirements: *id001
33
- - !ruby/object:Gem::Dependency
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.6.0
30
+ - !ruby/object:Gem::Dependency
34
31
  name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 2.8.0
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.8.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: mongoid
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 2.3.0
54
+ type: :development
35
55
  prerelease: false
36
- requirement: &id002 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.3.0
62
+ - !ruby/object:Gem::Dependency
63
+ name: bson_ext
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 1.5.0
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.5.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: sqlite3
80
+ requirement: !ruby/object:Gem::Requirement
37
81
  none: false
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- segments:
42
- - 2
43
- - 5
44
- - 0
45
- version: 2.5.0
82
+ requirements:
83
+ - - ~>
84
+ - !ruby/object:Gem::Version
85
+ version: 1.3.0
46
86
  type: :development
47
- version_requirements: *id002
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: 1.3.0
94
+ - !ruby/object:Gem::Dependency
95
+ name: pg
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 0.12.2
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 0.12.2
110
+ - !ruby/object:Gem::Dependency
111
+ name: activerecord
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 3.1.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 3.1.0
48
126
  description: Gem to sync all locale yml/rb files based on a "master" one.
49
127
  email: x@nofxx.com
50
- executables:
128
+ executables:
51
129
  - i18s
52
130
  extensions: []
53
-
54
- extra_rdoc_files:
55
- - LICENSE
56
- - README.rdoc
57
- files:
58
- - .document
59
- - LICENSE
60
- - README.rdoc
61
- - Rakefile
62
- - VERSION
63
- - bin/i18s
64
- - i18n_sync.gemspec
131
+ extra_rdoc_files: []
132
+ files:
65
133
  - lib/i18n_sync.rb
66
- - spec/fixtures/children.en.yml
67
- - spec/fixtures/children.pt.yml
134
+ - spec/i18n_sync_spec.rb
135
+ - spec/work/en.yml
136
+ - spec/work/named.en.yml
137
+ - spec/work/order.en.yml
138
+ - spec/work/extra.en.yml
139
+ - spec/work/named.pt.yml
140
+ - spec/work/children.en.yml
141
+ - spec/work/extra.pt.yml
142
+ - spec/work/pt.yml
143
+ - spec/work/children.pt.yml
144
+ - spec/work/order.pt.yml
145
+ - spec/spec_helper.rb
146
+ - spec/results/order.en.yml
147
+ - spec/results/named.pt.yml
148
+ - spec/results/extra.pt.yml
149
+ - spec/results/children.pt.yml
68
150
  - spec/fixtures/en.yml
69
- - spec/fixtures/extra.en.yml
70
- - spec/fixtures/extra.pt.yml
71
151
  - spec/fixtures/named.en.yml
72
- - spec/fixtures/named.pt.yml
73
152
  - spec/fixtures/order.en.yml
74
- - spec/fixtures/order.pt.yml
153
+ - spec/fixtures/extra.en.yml
154
+ - spec/fixtures/named.pt.yml
155
+ - spec/fixtures/children.en.yml
156
+ - spec/fixtures/extra.pt.yml
75
157
  - spec/fixtures/pt.yml
76
- - spec/i18n_sync_spec.rb
77
- - spec/results/children.pt.yml
78
- - spec/results/extra.pt.yml
79
- - spec/results/named.pt.yml
80
- - spec/results/order.en.yml
81
- - spec/spec_helper.rb
82
- has_rdoc: true
158
+ - spec/fixtures/children.pt.yml
159
+ - spec/fixtures/order.pt.yml
160
+ - spec/workmulti/en.yml
161
+ - spec/workmulti/named.en.yml
162
+ - spec/workmulti/order.en.yml
163
+ - spec/workmulti/extra.en.yml
164
+ - spec/workmulti/named.pt.yml
165
+ - spec/workmulti/children.en.yml
166
+ - spec/workmulti/extra.pt.yml
167
+ - spec/workmulti/pt.yml
168
+ - spec/workmulti/children.pt.yml
169
+ - spec/workmulti/order.pt.yml
170
+ - README.md
171
+ - Rakefile
172
+ - bin/i18s
83
173
  homepage: http://github.com/nofxx/i18n_sync
84
174
  licenses: []
85
-
86
175
  post_install_message:
87
176
  rdoc_options: []
88
-
89
- require_paths:
177
+ require_paths:
90
178
  - lib
91
- required_ruby_version: !ruby/object:Gem::Requirement
179
+ required_ruby_version: !ruby/object:Gem::Requirement
92
180
  none: false
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- segments:
181
+ requirements:
182
+ - - ! '>='
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ segments:
97
186
  - 0
98
- version: "0"
99
- required_rubygems_version: !ruby/object:Gem::Requirement
187
+ hash: -2339892264994599709
188
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
189
  none: false
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- segments:
105
- - 0
106
- version: "0"
190
+ requirements:
191
+ - - ! '>='
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
107
194
  requirements: []
108
-
109
195
  rubyforge_project:
110
- rubygems_version: 1.3.7
196
+ rubygems_version: 1.8.23
111
197
  signing_key:
112
198
  specification_version: 3
113
199
  summary: Syncs all locale yml/rb files based on a "master" one.
114
200
  test_files: []
115
-
data/.document DELETED
@@ -1,5 +0,0 @@
1
- README.rdoc
2
- lib/**/*.rb
3
- bin/*
4
- features/**/*.feature
5
- LICENSE
data/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2009 Marcos Piccinini
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.3.0
data/i18n_sync.gemspec DELETED
@@ -1,68 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{i18n_sync}
8
- s.version = "0.3.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Marcos Piccinini"]
12
- s.date = %q{2011-06-06}
13
- s.default_executable = %q{i18s}
14
- s.description = %q{Gem to sync all locale yml/rb files based on a "master" one.}
15
- s.email = %q{x@nofxx.com}
16
- s.executables = ["i18s"]
17
- s.extra_rdoc_files = [
18
- "LICENSE",
19
- "README.rdoc"
20
- ]
21
- s.files = [
22
- ".document",
23
- "LICENSE",
24
- "README.rdoc",
25
- "Rakefile",
26
- "VERSION",
27
- "bin/i18s",
28
- "i18n_sync.gemspec",
29
- "lib/i18n_sync.rb",
30
- "spec/fixtures/children.en.yml",
31
- "spec/fixtures/children.pt.yml",
32
- "spec/fixtures/en.yml",
33
- "spec/fixtures/extra.en.yml",
34
- "spec/fixtures/extra.pt.yml",
35
- "spec/fixtures/named.en.yml",
36
- "spec/fixtures/named.pt.yml",
37
- "spec/fixtures/order.en.yml",
38
- "spec/fixtures/order.pt.yml",
39
- "spec/fixtures/pt.yml",
40
- "spec/i18n_sync_spec.rb",
41
- "spec/results/children.pt.yml",
42
- "spec/results/extra.pt.yml",
43
- "spec/results/named.pt.yml",
44
- "spec/results/order.en.yml",
45
- "spec/spec_helper.rb"
46
- ]
47
- s.homepage = %q{http://github.com/nofxx/i18n_sync}
48
- s.require_paths = ["lib"]
49
- s.rubygems_version = %q{1.3.7}
50
- s.summary = %q{Syncs all locale yml/rb files based on a "master" one.}
51
-
52
- if s.respond_to? :specification_version then
53
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
54
- s.specification_version = 3
55
-
56
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
57
- s.add_runtime_dependency(%q<ya2yaml>, [">= 0"])
58
- s.add_development_dependency(%q<rspec>, [">= 2.5.0"])
59
- else
60
- s.add_dependency(%q<ya2yaml>, [">= 0"])
61
- s.add_dependency(%q<rspec>, [">= 2.5.0"])
62
- end
63
- else
64
- s.add_dependency(%q<ya2yaml>, [">= 0"])
65
- s.add_dependency(%q<rspec>, [">= 2.5.0"])
66
- end
67
- end
68
-