omniauth-naranya_id 0.0.6 → 0.0.7

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
  SHA1:
3
- metadata.gz: be4c890ad9d9568a6c142195044bdd60ed0b286c
4
- data.tar.gz: 2d6dbadabd4a3ba6687c2c0de71ac30e063d3aa1
3
+ metadata.gz: ba256048e9c8b966cc79af434fc0d5397ff5ab18
4
+ data.tar.gz: 34a0e867a161f76d21be126eee7f2bda3644091e
5
5
  SHA512:
6
- metadata.gz: c5cda0b059647862c547318d80853394ce46dc7aeefd4a086a383dd49afa66a6a01df0ab3051d6ffb697659f3ab38fd26fb34898004f89a05e1c7070c0e5f26e
7
- data.tar.gz: d3287fb9930b130a77026e0c1599c428053b91370c466587928d2b916fdeabeb95c5486b00526f7b7fb026933ce37f67fa6b72a17e284b78647e54dbde3ee885
6
+ metadata.gz: cc946786f9db73d9b69d459cf00663abc4c56310717aea0a657bd8101c5d7fdac5c3712b74fe7a8039f5fa85ff72b61bbeac7f59176ec84f50a33a510af180aa
7
+ data.tar.gz: 20ba6eea2a612917b7d0fe52e4b83aa074a48028e071b51cf245964b02452660f8191456a12ffc97f5660f02183de42372ee6e94c7ff9a62be46ff1f86c3eadd
@@ -31,6 +31,7 @@ module OmniAuth
31
31
  session['oauth'][name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}
32
32
 
33
33
  # Setup de parametros de lang/locale:
34
+ set_locale
34
35
  locale_params = if defined?(I18n) && I18n.respond_to?(:locale) && I18n.locale.present?
35
36
  { lang: I18n.locale.to_s.split('-').first, locale: I18n.locale.to_s }
36
37
  else
@@ -103,6 +104,29 @@ module OmniAuth
103
104
  end
104
105
  end
105
106
 
107
+ private
108
+
109
+ def set_locale
110
+ client_locale = if request.params[:locale].present?
111
+ request.params[:locale]
112
+ end
113
+
114
+ if client_locale.present?
115
+ # If the complete locale is not available, we'll use the language part of the client locale:
116
+ client_language = client_locale.split('-').first
117
+
118
+ # User the client_locale or the client_language, if the former is not available:
119
+ if defined?(I18n) && I18n.respond_to?(:locale_available?) && I18n.respond_to?(:locale)
120
+ if I18n.locale_available? client_locale
121
+ I18n.locale = client_locale
122
+ elsif I18n.locale_available? client_language
123
+ I18n.locale = client_language
124
+ end
125
+ end
126
+ end
127
+
128
+ end
129
+
106
130
  end
107
131
  end
108
132
  end
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module NaranyaId
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-naranya_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-10 00:00:00.000000000 Z
11
+ date: 2014-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport