localyzed 0.0.1.9 → 0.0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,9 +1,4 @@
1
- = define config in app config
2
-
3
- app.config.localized
4
-
5
- = expects user_interface in app to respond_to
6
-
7
- signed_in? => boolean
8
- current => a user instance which responds to
9
- -> language => locale (symbol)
1
+ NB: expects controllers and views to implement the following methods
2
+ -> user_signed_in?
3
+ -> current_user
4
+ -> responding to language
@@ -1,15 +1,5 @@
1
1
  module Localyzed
2
2
 
3
- mattr_accessor :user_interface
4
-
5
- def self.configure(config)
6
- @@user_interface = config[:user_interface] || nil
7
- end
8
-
9
- def self.user_interface
10
- @@user_interface.constantize
11
- end
12
-
13
3
  def self.localyze_routes(translations_file,options={})
14
4
  ActionDispatch::Routing::Translator.translate_from_file(translations_file, options)
15
5
  end
@@ -11,7 +11,7 @@ class ActionController::Base
11
11
 
12
12
  # sets the locale by checking user data then request param then session data then retrieving accept language data
13
13
  def set_locale
14
- if Localyzed.user_interface && Localyzed.user_interface.signed_in? and cl = Localyzed.user_interface.current.language and I18n.available_locales.include?(cl)
14
+ if user_signed_in? and cl = (current_user.respond_to?(:language) ? current_user.language : 'en') and I18n.available_locales.include?(cl)
15
15
  locale = I18n.locale = cl
16
16
  session[:locale] = locale
17
17
  else
@@ -1,3 +1,3 @@
1
1
  module Localyzed
2
- VERSION = "0.0.1.9"
2
+ VERSION = "0.0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localyzed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.9
4
+ version: 0.0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: