refinerycms-i18n 4.0.2 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.travis.yml +5 -5
- data/Gemfile +1 -1
- data/certs/parndt.pem +21 -0
- data/lib/refinery/i18n.rb +3 -2
- data/lib/refinery/i18n/engine.rb +7 -6
- data/refinerycms-i18n.gemspec +10 -4
- data/spec/controllers/refinery/admin/resources_controller_spec.rb +6 -6
- data/spec/controllers/refinery/pages_controller_spec.rb +21 -0
- metadata +50 -10
- metadata.gz.sig +1 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7e4694402d9ab606048504a265341229272cf39960a1b6da00d23714121f9e15
|
4
|
+
data.tar.gz: ed8550a299c0cb478d09ab8439cc1a9f0b817f67b5c7f54666acdc2f5f6f07d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d89135c6a0fedada205a87f55a54345502cfba5eca8763ba03fec18bba935f42be0f22fad26b0fee89c297215ab79fa12e6189d31e9aa63e9b5d8cb6e6f5c233
|
7
|
+
data.tar.gz: 9bf7319fdceb496d920d94b3d3445c5f6f1b7c35ca693eae6b1e373516200a213304dc874a689c21d65091db1f7be0236d6add05065da64f4fee06e97605ec9a
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -23,7 +23,7 @@ end
|
|
23
23
|
if !ENV["TRAVIS"] || ENV["DB"] == "mysql"
|
24
24
|
gem "activerecord-jdbcmysql-adapter", :platform => :jruby
|
25
25
|
gem "jdbc-mysql", "= 5.1.13", :platform => :jruby
|
26
|
-
gem
|
26
|
+
gem 'mysql2', '~> 0.4.10', :platform => :ruby
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EYEPZ2Vtc0BwLmFy
|
15
|
+
bmR0LmlvMA0GCSqGSIb3DQEBBQUAA4IBAQB12WMsC+yuuIeM0Ib6HUYZ2IbhRnuW
|
16
|
+
4uydNRvKDPdwzjChnOI0POGpcL8O1s1gh+19o/ITq6zRfTLhkwR2ir7XfwHJNppJ
|
17
|
+
yg48wbdL5gpZwggKWggKX5G9pqv9LjRsSAew6r0WB+5KW+ArCl/iNo9+AdeR3nUx
|
18
|
+
I+L/QiUxYU6XAXSrczL/i7kF5Xc3ZXQYuFsyGW9plA3i9faWUMvGKQc6pvUHIUZC
|
19
|
+
jOQmH9VbgbfUrXYM1YOKdlwW5sPR1f4PKLDlvEE+bppIUgKOgLOIv3i7KwrGvFOq
|
20
|
+
5r7Wz/HY31SM47mkK21saPJG4NvUFEycf0wlpzP657Pl9aVo47aKKbxX
|
21
|
+
-----END CERTIFICATE-----
|
data/lib/refinery/i18n.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Encoding: UTF-8 <-- required, please leave this in.
|
2
|
+
require 'mobility'
|
2
3
|
require 'refinerycms-core'
|
3
4
|
require 'routing-filter'
|
4
5
|
require 'rails-i18n'
|
@@ -42,8 +43,8 @@ module Refinery
|
|
42
43
|
end
|
43
44
|
|
44
45
|
def current_frontend_locale
|
45
|
-
if
|
46
|
-
|
46
|
+
if Mobility.locale.present? && Mobility.locale.to_s != config.default_frontend_locale.to_s
|
47
|
+
Mobility.locale
|
47
48
|
elsif config.default_frontend_locale.present?
|
48
49
|
config.default_frontend_locale
|
49
50
|
else
|
data/lib/refinery/i18n/engine.rb
CHANGED
@@ -27,12 +27,13 @@ module Refinery
|
|
27
27
|
if ::Refinery::I18n.has_locale?(locale = params[:locale].try(:to_sym))
|
28
28
|
::I18n.locale = locale
|
29
29
|
elsif locale.present? && locale != ::Refinery::I18n.default_frontend_locale
|
30
|
-
|
31
|
-
redirect_to(params
|
30
|
+
::I18n.locale = ::Refinery::I18n.default_frontend_locale
|
31
|
+
redirect_to(params.permit(:locale).merge(locale: ::I18n.locale),
|
32
|
+
notice: "The locale '#{locale}' is not supported.") and return
|
32
33
|
else
|
33
34
|
::I18n.locale = ::Refinery::I18n.default_frontend_locale
|
34
35
|
end
|
35
|
-
|
36
|
+
Mobility.locale = ::I18n.locale
|
36
37
|
end
|
37
38
|
|
38
39
|
prepend_before_action :find_or_set_locale
|
@@ -52,11 +53,11 @@ module Refinery
|
|
52
53
|
def globalize!
|
53
54
|
if ::Refinery::I18n.frontend_locales.any?
|
54
55
|
if params[:switch_locale]
|
55
|
-
|
56
|
+
Mobility.locale = params[:switch_locale].to_sym
|
56
57
|
elsif ::I18n.locale != ::Refinery::I18n.default_frontend_locale
|
57
|
-
|
58
|
+
Mobility.locale = ::Refinery::I18n.default_frontend_locale
|
58
59
|
else
|
59
|
-
|
60
|
+
Mobility.locale = ::I18n.locale
|
60
61
|
end
|
61
62
|
end
|
62
63
|
end
|
data/refinerycms-i18n.gemspec
CHANGED
@@ -2,12 +2,12 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{refinerycms-i18n}
|
5
|
-
s.version = %q{
|
5
|
+
s.version = %q{5.0.0}
|
6
6
|
s.description = %q{i18n logic extracted from Refinery CMS, for Refinery CMS.}
|
7
7
|
s.summary = %q{i18n logic for Refinery CMS.}
|
8
8
|
s.email = %q{info@refinerycms.com}
|
9
9
|
s.homepage = %q{https://refinerycms.com}
|
10
|
-
s.authors = ['Philip Arndt', 'Uģis Ozols']
|
10
|
+
s.authors = ['Philip Arndt', 'Uģis Ozols', 'Brice Sanchez']
|
11
11
|
s.require_paths = %w(lib)
|
12
12
|
s.license = %q{MIT}
|
13
13
|
|
@@ -16,6 +16,12 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.required_ruby_version = '>= 2.2.9'
|
18
18
|
|
19
|
-
s.add_dependency 'routing-filter', '
|
20
|
-
s.add_dependency 'rails-i18n', '~> 5.0
|
19
|
+
s.add_dependency 'routing-filter', '~> 0.4'
|
20
|
+
s.add_dependency 'rails-i18n', '~> 5.0'
|
21
|
+
s.add_dependency 'mobility', '~> 0.6.0'
|
22
|
+
|
23
|
+
s.cert_chain = [File.expand_path("../certs/parndt.pem", __FILE__)]
|
24
|
+
if $0 =~ /gem\z/ && ARGV.include?("build") && ARGV.include?(__FILE__)
|
25
|
+
s.signing_key = File.expand_path("~/.ssh/gem-private_key.pem")
|
26
|
+
end
|
21
27
|
end
|
@@ -4,30 +4,30 @@ module Refinery
|
|
4
4
|
module Admin
|
5
5
|
describe ResourcesController, type: :controller do
|
6
6
|
before do
|
7
|
-
|
7
|
+
Mobility.locale = :en
|
8
8
|
@resource = FactoryBot.create(:resource, :resource_title => "My resource in English")
|
9
9
|
|
10
10
|
# Add a translation
|
11
|
-
|
11
|
+
Mobility.locale = :es
|
12
12
|
@resource.resource_title = 'Mi recurso en español'
|
13
13
|
@resource.save
|
14
14
|
end
|
15
15
|
|
16
|
-
it 'reset
|
16
|
+
it 'reset Mobility as expected' do
|
17
17
|
get :index
|
18
|
-
expect(
|
18
|
+
expect(Mobility.locale).to eql(:en)
|
19
19
|
expect(::I18n.locale).to eql(:en)
|
20
20
|
expect(assigns(:resources).first.resource_title).to eql('My resource in English')
|
21
21
|
|
22
22
|
# Switch globalized content to ES
|
23
23
|
get :index, params: { switch_locale: :es }
|
24
|
-
expect(
|
24
|
+
expect(Mobility.locale).to eql(:es)
|
25
25
|
expect(::I18n.locale).to eql(:en)
|
26
26
|
expect(assigns(:resources).first.resource_title).to eql('Mi recurso en español')
|
27
27
|
|
28
28
|
# Should return to default locale for globalized content on next request
|
29
29
|
get :index
|
30
|
-
expect(
|
30
|
+
expect(Mobility.locale).to eql(:en)
|
31
31
|
expect(::I18n.locale).to eql(:en)
|
32
32
|
expect(assigns(:resources).first.resource_title).to eql('My resource in English')
|
33
33
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module Refinery
|
4
|
+
describe PagesController, type: :controller do
|
5
|
+
before do
|
6
|
+
FactoryBot.create(:page, title: 'test')
|
7
|
+
end
|
8
|
+
|
9
|
+
context 'when locale is unsupported' do
|
10
|
+
subject { get :show, params: { path: 'test', locale: 'en%20217' } }
|
11
|
+
|
12
|
+
it 'redirects to the location with the default frontend locale' do
|
13
|
+
expect(subject).to redirect_to ('/test')
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'flashes a notice message' do
|
17
|
+
expect(subject.request.flash[:notice]).to eq("The locale 'en%20217' is not supported.")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,44 +1,81 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-i18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philip Arndt
|
8
8
|
- Uģis Ozols
|
9
|
+
- Brice Sanchez
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
|
-
cert_chain:
|
12
|
-
|
12
|
+
cert_chain:
|
13
|
+
- |
|
14
|
+
-----BEGIN CERTIFICATE-----
|
15
|
+
MIIDhjCCAm6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBNMQ0wCwYDVQQDDARnZW1z
|
16
|
+
MREwDwYKCZImiZPyLGQBGRYBcDEVMBMGCgmSJomT8ixkARkWBWFybmR0MRIwEAYK
|
17
|
+
CZImiZPyLGQBGRYCaW8wHhcNMTcwNzI1MTMxMjIwWhcNMTgwNzI1MTMxMjIwWjBN
|
18
|
+
MQ0wCwYDVQQDDARnZW1zMREwDwYKCZImiZPyLGQBGRYBcDEVMBMGCgmSJomT8ixk
|
19
|
+
ARkWBWFybmR0MRIwEAYKCZImiZPyLGQBGRYCaW8wggEiMA0GCSqGSIb3DQEBAQUA
|
20
|
+
A4IBDwAwggEKAoIBAQDrjwB8be48TFEvGweP7Bw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by/object:Gem::Dependency
|
15
38
|
name: routing-filter
|
16
39
|
requirement: !ruby/object:Gem::Requirement
|
17
40
|
requirements:
|
18
|
-
- - "
|
41
|
+
- - "~>"
|
19
42
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.4
|
43
|
+
version: '0.4'
|
21
44
|
type: :runtime
|
22
45
|
prerelease: false
|
23
46
|
version_requirements: !ruby/object:Gem::Requirement
|
24
47
|
requirements:
|
25
|
-
- - "
|
48
|
+
- - "~>"
|
26
49
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.4
|
50
|
+
version: '0.4'
|
28
51
|
- !ruby/object:Gem::Dependency
|
29
52
|
name: rails-i18n
|
30
53
|
requirement: !ruby/object:Gem::Requirement
|
31
54
|
requirements:
|
32
55
|
- - "~>"
|
33
56
|
- !ruby/object:Gem::Version
|
34
|
-
version: 5.0
|
57
|
+
version: '5.0'
|
58
|
+
type: :runtime
|
59
|
+
prerelease: false
|
60
|
+
version_requirements: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - "~>"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '5.0'
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: mobility
|
67
|
+
requirement: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: 0.6.0
|
35
72
|
type: :runtime
|
36
73
|
prerelease: false
|
37
74
|
version_requirements: !ruby/object:Gem::Requirement
|
38
75
|
requirements:
|
39
76
|
- - "~>"
|
40
77
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
78
|
+
version: 0.6.0
|
42
79
|
description: i18n logic extracted from Refinery CMS, for Refinery CMS.
|
43
80
|
email: info@refinerycms.com
|
44
81
|
executables: []
|
@@ -302,6 +339,7 @@ files:
|
|
302
339
|
- bin/rake
|
303
340
|
- bin/rspec
|
304
341
|
- bin/spring
|
342
|
+
- certs/parndt.pem
|
305
343
|
- lib/generators/refinery/i18n_generator.rb
|
306
344
|
- lib/generators/refinery/templates/config/initializers/refinery/i18n.rb.erb
|
307
345
|
- lib/refinery/i18n-filter.rb
|
@@ -317,6 +355,7 @@ files:
|
|
317
355
|
- lib/translate/storage.rb
|
318
356
|
- refinerycms-i18n.gemspec
|
319
357
|
- spec/controllers/refinery/admin/resources_controller_spec.rb
|
358
|
+
- spec/controllers/refinery/pages_controller_spec.rb
|
320
359
|
- spec/features/set_locale_spec.rb
|
321
360
|
- spec/spec_helper.rb
|
322
361
|
- spec/support/refinery/i18n/set_defaults.rb
|
@@ -342,12 +381,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
342
381
|
version: '0'
|
343
382
|
requirements: []
|
344
383
|
rubyforge_project:
|
345
|
-
rubygems_version: 2.6
|
384
|
+
rubygems_version: 2.7.6
|
346
385
|
signing_key:
|
347
386
|
specification_version: 4
|
348
387
|
summary: i18n logic for Refinery CMS.
|
349
388
|
test_files:
|
350
389
|
- spec/controllers/refinery/admin/resources_controller_spec.rb
|
390
|
+
- spec/controllers/refinery/pages_controller_spec.rb
|
351
391
|
- spec/features/set_locale_spec.rb
|
352
392
|
- spec/spec_helper.rb
|
353
393
|
- spec/support/refinery/i18n/set_defaults.rb
|
metadata.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
C)U�c�?g�S(�L��Iԍ�L#]p,z}DȺƫffބ��(��g��,k��8����`��&�[�RF��?&�����Վ�?A5���ot�pp�?(����ЮQ���ܞ8��}lh��a�r���A�<�q�v�I���i,oZ�{��:�%�g��1<l�l���2�����:S�?9�J(ZE`��&Q-�C�ꂵ�}$��� Y�yVO��Z��R��@����#����-�~xښ�hцE�W&D��
|