rails_i18n_routes 1.1.9 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. metadata +18 -139
  3. data/MIT-LICENSE +0 -20
  4. data/README.rdoc +0 -50
  5. data/Rakefile +0 -38
  6. data/lib/rails_i18n_routes.rb +0 -8
  7. data/lib/rails_i18n_routes/action_controller/base.rb +0 -37
  8. data/lib/rails_i18n_routes/action_dispatch/mapper.rb +0 -71
  9. data/lib/rails_i18n_routes/action_dispatch/route_set/named_route_collection.rb +0 -28
  10. data/lib/rails_i18n_routes/railtie.rb +0 -14
  11. data/lib/rails_i18n_routes/version.rb +0 -5
  12. data/test/dummy/README.rdoc +0 -261
  13. data/test/dummy/Rakefile +0 -7
  14. data/test/dummy/app/assets/javascripts/application.js +0 -15
  15. data/test/dummy/app/assets/stylesheets/application.css +0 -13
  16. data/test/dummy/app/controllers/application_controller.rb +0 -4
  17. data/test/dummy/app/controllers/namespace/nested_controller.rb +0 -7
  18. data/test/dummy/app/controllers/namespace/nesteds_resources_controller.rb +0 -7
  19. data/test/dummy/app/controllers/params_controller.rb +0 -7
  20. data/test/dummy/app/controllers/resources_controller.rb +0 -7
  21. data/test/dummy/app/controllers/simples_controller.rb +0 -7
  22. data/test/dummy/app/helpers/application_helper.rb +0 -2
  23. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  24. data/test/dummy/app/views/namespace/nesteds/show.html.erb +0 -0
  25. data/test/dummy/app/views/params/show.html.erb +0 -0
  26. data/test/dummy/app/views/simples/show.html.erb +0 -0
  27. data/test/dummy/config.ru +0 -4
  28. data/test/dummy/config/application.rb +0 -66
  29. data/test/dummy/config/boot.rb +0 -10
  30. data/test/dummy/config/database.yml +0 -25
  31. data/test/dummy/config/environment.rb +0 -5
  32. data/test/dummy/config/environments/development.rb +0 -37
  33. data/test/dummy/config/environments/production.rb +0 -67
  34. data/test/dummy/config/environments/test.rb +0 -37
  35. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  36. data/test/dummy/config/initializers/inflections.rb +0 -15
  37. data/test/dummy/config/initializers/mime_types.rb +0 -5
  38. data/test/dummy/config/initializers/secret_token.rb +0 -7
  39. data/test/dummy/config/initializers/session_store.rb +0 -8
  40. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  41. data/test/dummy/config/locales/en-US.yml +0 -9
  42. data/test/dummy/config/locales/es-AR.yml +0 -9
  43. data/test/dummy/config/locales/es-UY.yml +0 -9
  44. data/test/dummy/config/routes.rb +0 -69
  45. data/test/dummy/db/development.sqlite3 +0 -0
  46. data/test/dummy/db/schema.rb +0 -16
  47. data/test/dummy/log/development.log +0 -99
  48. data/test/dummy/log/test.log +0 -4558
  49. data/test/dummy/public/404.html +0 -26
  50. data/test/dummy/public/422.html +0 -26
  51. data/test/dummy/public/500.html +0 -25
  52. data/test/dummy/public/favicon.ico +0 -0
  53. data/test/dummy/script/rails +0 -6
  54. data/test/rails_i18n_routes_test.rb +0 -9
  55. data/test/routes_test.rb +0 -96
  56. data/test/selection_test.rb +0 -34
  57. data/test/test_helper.rb +0 -15
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7ac5ddd87621b430e4ca218335bd8437a136e399
4
+ data.tar.gz: 56dd8db2e073a450ddbb465745cc35121c8ff6c9
5
+ SHA512:
6
+ metadata.gz: c5a9f5d233fc6d3a574774ece62a7a5c3a177270818a0a012648fea2b448976201952655fc5033c602fa2967f169041b551d4d42eeed16bd041888647f6228f6
7
+ data.tar.gz: f892801c1a729c74890f26694a52627b3b2f2c45d8543e63a99f5aa09874d178d72a0454b8bbda3b17fe968e4e8658188e4d5d1a861c992b7bc3e5d3efdbc544
metadata CHANGED
@@ -1,179 +1,58 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_i18n_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.9
5
- prerelease:
4
+ version: 1.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Mattways
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-06-27 00:00:00.000000000 Z
11
+ date: 2013-08-20 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: rails
14
+ name: translatable_routes
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
20
- - !ruby/object:Gem::Version
21
- version: 3.2.8
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- version: 3.2.8
30
- - !ruby/object:Gem::Dependency
31
- name: sqlite3
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
17
+ - - '>='
36
18
  - !ruby/object:Gem::Version
37
19
  version: '0'
38
- type: :development
20
+ type: :runtime
39
21
  prerelease: false
40
22
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
23
  requirements:
43
- - - ! '>='
24
+ - - '>='
44
25
  - !ruby/object:Gem::Version
45
26
  version: '0'
46
- description: Minimalistic toolkit to handle i18n routes and detect locale from subdomain
47
- or prefix.
27
+ description: This gem has been renamed to just "translatable_routes".
48
28
  email:
49
29
  - contact@mattways.com
50
30
  executables: []
51
31
  extensions: []
52
32
  extra_rdoc_files: []
53
- files:
54
- - lib/rails_i18n_routes/action_controller/base.rb
55
- - lib/rails_i18n_routes/action_dispatch/mapper.rb
56
- - lib/rails_i18n_routes/action_dispatch/route_set/named_route_collection.rb
57
- - lib/rails_i18n_routes/railtie.rb
58
- - lib/rails_i18n_routes/version.rb
59
- - lib/rails_i18n_routes.rb
60
- - MIT-LICENSE
61
- - Rakefile
62
- - README.rdoc
63
- - test/dummy/app/assets/javascripts/application.js
64
- - test/dummy/app/assets/stylesheets/application.css
65
- - test/dummy/app/controllers/application_controller.rb
66
- - test/dummy/app/controllers/namespace/nested_controller.rb
67
- - test/dummy/app/controllers/namespace/nesteds_resources_controller.rb
68
- - test/dummy/app/controllers/params_controller.rb
69
- - test/dummy/app/controllers/resources_controller.rb
70
- - test/dummy/app/controllers/simples_controller.rb
71
- - test/dummy/app/helpers/application_helper.rb
72
- - test/dummy/app/views/layouts/application.html.erb
73
- - test/dummy/app/views/namespace/nesteds/show.html.erb
74
- - test/dummy/app/views/params/show.html.erb
75
- - test/dummy/app/views/simples/show.html.erb
76
- - test/dummy/config/application.rb
77
- - test/dummy/config/boot.rb
78
- - test/dummy/config/database.yml
79
- - test/dummy/config/environment.rb
80
- - test/dummy/config/environments/development.rb
81
- - test/dummy/config/environments/production.rb
82
- - test/dummy/config/environments/test.rb
83
- - test/dummy/config/initializers/backtrace_silencers.rb
84
- - test/dummy/config/initializers/inflections.rb
85
- - test/dummy/config/initializers/mime_types.rb
86
- - test/dummy/config/initializers/secret_token.rb
87
- - test/dummy/config/initializers/session_store.rb
88
- - test/dummy/config/initializers/wrap_parameters.rb
89
- - test/dummy/config/locales/en-US.yml
90
- - test/dummy/config/locales/es-AR.yml
91
- - test/dummy/config/locales/es-UY.yml
92
- - test/dummy/config/routes.rb
93
- - test/dummy/config.ru
94
- - test/dummy/db/development.sqlite3
95
- - test/dummy/db/schema.rb
96
- - test/dummy/log/development.log
97
- - test/dummy/log/test.log
98
- - test/dummy/public/404.html
99
- - test/dummy/public/422.html
100
- - test/dummy/public/500.html
101
- - test/dummy/public/favicon.ico
102
- - test/dummy/Rakefile
103
- - test/dummy/README.rdoc
104
- - test/dummy/script/rails
105
- - test/rails_i18n_routes_test.rb
106
- - test/routes_test.rb
107
- - test/selection_test.rb
108
- - test/test_helper.rb
109
- homepage: https://github.com/mattways/rails_i18n_routes
110
- licenses: []
33
+ files: []
34
+ homepage: https://github.com/mattways/translatable_routes
35
+ licenses:
36
+ - MIT
37
+ metadata: {}
111
38
  post_install_message:
112
39
  rdoc_options: []
113
40
  require_paths:
114
41
  - lib
115
42
  required_ruby_version: !ruby/object:Gem::Requirement
116
- none: false
117
43
  requirements:
118
- - - ! '>='
44
+ - - '>='
119
45
  - !ruby/object:Gem::Version
120
46
  version: '0'
121
47
  required_rubygems_version: !ruby/object:Gem::Requirement
122
- none: false
123
48
  requirements:
124
- - - ! '>='
49
+ - - '>='
125
50
  - !ruby/object:Gem::Version
126
51
  version: '0'
127
52
  requirements: []
128
53
  rubyforge_project:
129
- rubygems_version: 1.8.23
54
+ rubygems_version: 2.0.3
130
55
  signing_key:
131
- specification_version: 3
132
- summary: Toolkit for Rails i18n routes.
133
- test_files:
134
- - test/dummy/app/assets/javascripts/application.js
135
- - test/dummy/app/assets/stylesheets/application.css
136
- - test/dummy/app/controllers/application_controller.rb
137
- - test/dummy/app/controllers/namespace/nested_controller.rb
138
- - test/dummy/app/controllers/namespace/nesteds_resources_controller.rb
139
- - test/dummy/app/controllers/params_controller.rb
140
- - test/dummy/app/controllers/resources_controller.rb
141
- - test/dummy/app/controllers/simples_controller.rb
142
- - test/dummy/app/helpers/application_helper.rb
143
- - test/dummy/app/views/layouts/application.html.erb
144
- - test/dummy/app/views/namespace/nesteds/show.html.erb
145
- - test/dummy/app/views/params/show.html.erb
146
- - test/dummy/app/views/simples/show.html.erb
147
- - test/dummy/config/application.rb
148
- - test/dummy/config/boot.rb
149
- - test/dummy/config/database.yml
150
- - test/dummy/config/environment.rb
151
- - test/dummy/config/environments/development.rb
152
- - test/dummy/config/environments/production.rb
153
- - test/dummy/config/environments/test.rb
154
- - test/dummy/config/initializers/backtrace_silencers.rb
155
- - test/dummy/config/initializers/inflections.rb
156
- - test/dummy/config/initializers/mime_types.rb
157
- - test/dummy/config/initializers/secret_token.rb
158
- - test/dummy/config/initializers/session_store.rb
159
- - test/dummy/config/initializers/wrap_parameters.rb
160
- - test/dummy/config/locales/en-US.yml
161
- - test/dummy/config/locales/es-AR.yml
162
- - test/dummy/config/locales/es-UY.yml
163
- - test/dummy/config/routes.rb
164
- - test/dummy/config.ru
165
- - test/dummy/db/development.sqlite3
166
- - test/dummy/db/schema.rb
167
- - test/dummy/log/development.log
168
- - test/dummy/log/test.log
169
- - test/dummy/public/404.html
170
- - test/dummy/public/422.html
171
- - test/dummy/public/500.html
172
- - test/dummy/public/favicon.ico
173
- - test/dummy/Rakefile
174
- - test/dummy/README.rdoc
175
- - test/dummy/script/rails
176
- - test/rails_i18n_routes_test.rb
177
- - test/routes_test.rb
178
- - test/selection_test.rb
179
- - test/test_helper.rb
56
+ specification_version: 4
57
+ summary: Renamed to just "translatable_routes"
58
+ test_files: []
data/MIT-LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright 2012 Mattways
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/README.rdoc DELETED
@@ -1,50 +0,0 @@
1
- === NOTE: The localize method has been changed from localize to localized in version 1.1.2
2
-
3
- ---
4
-
5
- {<img src="https://codeclimate.com/github/mattways/rails_i18n_routes.png" />}[https://codeclimate.com/github/mattways/rails_i18n_routes] {<img src="https://secure.travis-ci.org/mattways/rails_i18n_routes.png?branch=master" alt="Build Status" />}[https://travis-ci.org/mattways/rails_i18n_routes] {<img src="https://gemnasium.com/mattways/rails_i18n_routes.png" alt="Dependency Status" />}[https://gemnasium.com/mattways/rails_i18n_routes]
6
-
7
- = Rails I18n Routes
8
-
9
- Minimalistic toolkit to handle i18n routes and detect locale from subdomain or prefix.
10
-
11
- = Install
12
-
13
- Put this line in your Gemfile:
14
- gem 'rails_i18n_routes'
15
-
16
- Then bundle:
17
- $ bundle
18
-
19
- = Usage
20
-
21
- Choose how the language would be selected in your application.rb...
22
-
23
- To use prefix (default):
24
- config.i18n_routes.selection = :prefix
25
-
26
- To use subdomain:
27
- config.i18n_routes.selection = :subdomain
28
- config.i18n_routes.mapping = {
29
- :es => [:ar, :uy]
30
- :pt => [:br]
31
- }
32
-
33
- In the case of subdomains you need to name the yml file in your locales dir using this format:
34
- es-UY.yml
35
- es-AR.yml
36
- pt-BR.yml
37
-
38
- Inside each yaml file:
39
- es-UY:
40
- routes:
41
- users: "usuarios"
42
- profile: "perfil"
43
- login: "entrar"
44
-
45
- (Please note each part of the path it's translated individually, you don't have to put translations for paths like "users/1/profile" just translate "users" and "profile", the plugin will do the rest)
46
-
47
- Finally in your routes.rb pass the routes you want to be localized to localize method:
48
- localized do
49
- math 'contact' => 'static#contact', :as => 'contact'
50
- end
data/Rakefile DELETED
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env rake
2
- begin
3
- require 'bundler/setup'
4
- rescue LoadError
5
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
- end
7
- begin
8
- require 'rdoc/task'
9
- rescue LoadError
10
- require 'rdoc/rdoc'
11
- require 'rake/rdoctask'
12
- RDoc::Task = Rake::RDocTask
13
- end
14
-
15
- RDoc::Task.new(:rdoc) do |rdoc|
16
- rdoc.rdoc_dir = 'rdoc'
17
- rdoc.title = 'RailsI18nRoutes'
18
- rdoc.options << '--line-numbers'
19
- rdoc.rdoc_files.include('README.rdoc')
20
- rdoc.rdoc_files.include('lib/**/*.rb')
21
- end
22
-
23
-
24
-
25
-
26
- Bundler::GemHelper.install_tasks
27
-
28
- require 'rake/testtask'
29
-
30
- Rake::TestTask.new(:test) do |t|
31
- t.libs << 'lib'
32
- t.libs << 'test'
33
- t.pattern = 'test/**/*_test.rb'
34
- t.verbose = false
35
- end
36
-
37
-
38
- task :default => :test
@@ -1,8 +0,0 @@
1
- require 'rails_i18n_routes/action_controller/base'
2
- require 'rails_i18n_routes/action_dispatch/route_set/named_route_collection'
3
- require 'rails_i18n_routes/action_dispatch/mapper'
4
- require 'rails_i18n_routes/railtie'
5
- require 'rails_i18n_routes/version'
6
-
7
- module RailsI18nRoutes
8
- end
@@ -1,37 +0,0 @@
1
- module RailsI18nRoutes
2
- module ActionController
3
- module Base
4
-
5
- def self.included(base)
6
- base.send :prepend_before_filter, :select_locale
7
- end
8
-
9
- protected
10
-
11
- def select_locale
12
- if Rails.application.config.i18n_routes.selection == :subdomain
13
- Rails.application.config.i18n_routes.mapping.each_pair do |key, value|
14
- if (value.is_a? Array and value.include? request.subdomain.to_sym) or value == request.subdomain.to_sym
15
- I18n.locale = "#{key}-#{request.subdomain.upcase}"
16
- break
17
- end
18
- end
19
- elsif not params[:locale].nil?
20
- I18n.locale = params[:locale]
21
- end
22
- end
23
-
24
- def subdomains
25
- @subdomains ||= begin
26
- values = []
27
- Rails.application.config.i18n_routes.mapping.values.each do |value|
28
- value = [value] unless value.is_a? Array
29
- values.concat value
30
- end
31
- values
32
- end
33
- end
34
-
35
- end
36
- end
37
- end
@@ -1,71 +0,0 @@
1
- module RailsI18nRoutes
2
- module ActionDispatch
3
- module Mapper
4
-
5
- def localized
6
- @locales = I18n.available_locales.dup
7
- case Rails.application.config.i18n_routes.selection
8
- when :prefix
9
- scope ':locale' do
10
- yield
11
- end
12
- when :subdomain
13
- @locales.shift # For some reason :en is always there
14
- yield
15
- end
16
- @locales = nil # Needed to routes below localize block to work
17
- end
18
-
19
- def add_route(action, options)
20
- if @locales
21
- @locales.each do |locale|
22
- path = @scope[:path].dup if @scope[:path].present?
23
- path_names = @scope[:path_names].dup
24
- @scope[:path] = i18n_path(path, locale) if @scope[:path].present?
25
- @scope[:path_names].each { |key, value| @scope[:path_names][key] = I18n.t("routes.#{key}", :locale => locale, :default => value) }
26
- super(*[i18n_path(action, locale), i18n_options(options, locale)])
27
- @scope[:path] = path if @scope[:path].present?
28
- @scope[:path_names] = path_names
29
- end
30
- @set.named_routes.define_i18n_route_helper @scope[:as] ? "#{@scope[:as]}_#{options[:as]}" : options[:as] unless @scope[:scope_level_resource].present?
31
- return
32
- end
33
- super
34
- end
35
-
36
- protected
37
-
38
- def i18n_options(options, locale)
39
- selection = Rails.application.config.i18n_routes.selection
40
- subdomain = locale.to_s.split('-')[1].downcase if selection == :subdomain
41
- changes = { :constraints => selection == :prefix ? {:locale => locale.to_s} : {:subdomain => subdomain.to_s} }
42
- suffix = selection == :prefix ? locale.to_s.gsub('-', '_').downcase : subdomain
43
- if options[:as].present?
44
- changes[:as] = "#{options[:as]}_#{suffix}"
45
- elsif @scope[:scope_level_resource].present?
46
- resource = @scope[:scope_level_resource]
47
- ['singular', 'plural'].each do |context|
48
- resource.instance_variable_set "@original_#{context}".to_sym, resource.send(context.to_sym) unless resource.instance_variable_get "@original_#{context}".to_sym
49
- resource.instance_variable_set "@#{context}".to_sym, "#{resource.instance_variable_get "@original_#{context}".to_sym}_#{suffix}"
50
- end
51
- end
52
- options.merge changes
53
- end
54
-
55
- def i18n_path(path, locale)
56
- unless path.is_a? Symbol
57
- i18n_path = []
58
- path.split('/').each do |part|
59
- next if part == ''
60
- part.gsub!(/-/, '_')
61
- i18n_path << ((part[0] == ':' or part[0] == '*') ? part : I18n.t("routes.#{part}", :locale => locale, :default => part.gsub(/_/, '-')))
62
- end
63
- i18n_path.join('/')
64
- else
65
- path
66
- end
67
- end
68
-
69
- end
70
- end
71
- end
@@ -1,28 +0,0 @@
1
- module RailsI18nRoutes
2
- module ActionDispatch
3
- module RouteSet
4
- module NamedRouteCollection
5
-
6
- def define_i18n_route_helper(name)
7
- ['url', 'path'].each do |kind|
8
- selector = url_helper_name(name, kind)
9
- @module.module_eval <<-END_EVAL, __FILE__, __LINE__ + 1
10
- remove_possible_method :#{selector}
11
- def #{selector}(*args)
12
- options = args.extract_options!
13
- if Rails.application.config.i18n_routes.selection == :subdomain
14
- suffix = (options[:subdomain] ? options[:subdomain] : request.subdomain)
15
- else
16
- suffix = (options[:locale] ? options[:locale] : I18n.locale).to_s.gsub('-', '_').downcase
17
- end
18
- send ("#{name}_" + suffix.to_s + "_#{kind}"), *(args << options)
19
- end
20
- END_EVAL
21
- helpers << selector
22
- end
23
- end
24
-
25
- end
26
- end
27
- end
28
- end